<?php
/*
  $Id: affiliate_account_details.php,v 2.0 2002/09/29 SDK

  OSC-Affiliate

  Contribution based on:

 	osCommerce, Open Source E-Commerce Solutions 
	http://www.oscommerce.com 
	
	Copyright (c) 2003 osCommerce 
	
	osCommRes, Services Oline 
	http://www.oscommres.com 
	Copyright (c) 2005 osCommRes 
	
	Freeway eCommerce 
	http://www.zac-ware.com/freeway 
	Copyright (c) 2007 ZacWare 
	
	Released under the GNU General Public License
*/

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();



    require('includes/javascript/http.js'); 
/*	$command=isset($HTTP_GET_VARS['command'])?$HTTP_GET_VARS['command']:'';
	$country=isset($HTTP_GET_VARS['country_id'])?$HTTP_GET_VARS['country_id']:0;
	$content="";
	//ajax start
		if($command=='show_state'){
			 	$zone_ids="";
			 	$zone_name="";
		      $zones_query = tep_db_query("select zone_id,zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($country) . "' order by zone_name");
		      while ($zones_values = tep_db_fetch_array($zones_query)) {
		         $zone_ids.=$zones_values['zone_name'].",";
		         $zone_name.=$zones_values['zone_name'].",";
		      }
		   echo 'show_state'.substr($zone_ids,0,-1)."^".substr($zone_name,0,-1)."^".$zone;     
		   exit;
		}   
 //ajax end*/
?>
  <script>
 function do_pwd_check(obj)
 { 
  <?php //if(MODULE_CUSTOMERS_PASSWORD_STRENGTH==4){?>	
 	pwd=obj.value;
	if(pwd.length==0)
	  document.all.pwd_str.innerHTML='';
	else if(pwd.length<<?php echo ENTRY_PASSWORD_MIN_LENGTH;?>)
		document.all.pwd_str.innerHTML='<?php echo ENTRY_PASSWORD_STRENGTH_ERROR;?>';
	else if(!check_password_strength(pwd))
		document.all.pwd_str.innerHTML='<?php echo ENTRY_PASSWORD_STRENGTH_ERROR;?>';
	else
		document.all.pwd_str.innerHTML='';
  <?php //} ?>
 }
</script>
<?php 
  if (!isset($is_read_only)) $is_read_only = false;
  if (!isset($processed)) $processed = false;
?>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  <tr>
    <td class="formAreaTitle"><?php echo CATEGORY_PERSONAL; ?></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
<?php
  if (ACCOUNT_GENDER == 'true') {
    $male = ($affiliate['affiliate_gender'] == 'm') ? true : false;
    $female = ($affiliate['affiliate_gender'] == 'f') ? true : false;
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_GENDER; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo ($affiliate['affiliate_gender'] == 'm') ? MALE : FEMALE;
    } elseif ($error == true) {
      if ($entry_gender_error == true) {
        echo tep_draw_radio_field('a_gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('a_gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;</td><td class="inputRequirement">' . ENTRY_GENDER_ERROR;
      } else {
        echo ($a_gender == 'm') ? MALE : FEMALE;
        echo tep_draw_hidden_field('a_gender');
      }
    } else {
      echo tep_draw_radio_field('a_gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('a_gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;</td><td class="inputRequirement">' . ENTRY_GENDER_TEXT;
    }
?>
            </td>
          </tr>
<?php
  }
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_FIRST_NAME; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_firstname'];
  } elseif ($error == true) {
    if ($entry_firstname_error == true) {
      echo tep_draw_input_field('a_firstname') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_FIRST_NAME_ERROR;
    } else {
      echo $a_firstname . tep_draw_hidden_field('a_firstname');
    }
  } else {
    echo tep_draw_input_field('a_firstname', $affiliate['affiliate_firstname']) . '&nbsp;</td><td class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT;
  }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_LAST_NAME; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_lastname'];
  } elseif ($error == true) {
    if ($entry_lastname_error == true) {
      echo tep_draw_input_field('a_lastname') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_LAST_NAME_ERROR;
    } else {
      echo $a_lastname . tep_draw_hidden_field('a_lastname');
    }
  } else {
    echo tep_draw_input_field('a_lastname', $affiliate['affiliate_lastname']) . '&nbsp;</td><td class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT;
  }
?>
            </td>
          </tr>
<?php
  if (ACCOUNT_DOB == 'true') {
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_DATE_OF_BIRTH; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo format_date($affiliate['affiliate_dob']);
    } elseif ($error == true) {
      if ($entry_date_of_birth_error == true) {
        echo tep_draw_input_field('a_dob') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_EVENT_DATE_OF_BIRTH_ERROR;
      } else {
        echo $a_dob . tep_draw_hidden_field('a_dob');
      }
    } else {
      echo tep_draw_input_field('a_dob', format_date($affiliate['affiliate_dob'])) . '&nbsp;</td><td class="inputRequirement">' . ENTRY_EVENT_DATE_OF_BIRTH_TEXT;
    }
?>
            </td>
          </tr>
<?php
  }
?>
<?php
  if (ACCOUNT_USERNAME == 'true') {
?>
              <tr>
                <td class="main" width="200">&nbsp;<?php echo ENTRY_USERNAME; ?></td>
                <td class="main">&nbsp;
						<?php
							if ($is_read_only == true) {
							  echo $affiliate['affiliate_username'];
							} elseif ($error == true) {
							  if ($entry_username_error == true) {
								echo tep_draw_input_field('a_username',$affiliate['affiliate_username'],'maxlength="20"') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_USERNAME_ERROR_EXISTS;
							  } else {
								echo $a_username . tep_draw_hidden_field('a_username');
							  }
							} else {
							  echo tep_draw_input_field('a_username', $affiliate['affiliate_username'],'maxlength="20"') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_USERNAME_TEXT;
							}
						?>
				<?php //echo tep_draw_input_field('username','','maxlength=20') . '&nbsp;' . (tep_not_null(ENTRY_USERNAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_USERNAME_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
  }
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_EMAIL_ADDRESS; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_email_address'];
  } elseif ($error == true) {
    if ($entry_email_address_error == true) {
      echo tep_draw_input_field('a_email_address') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_ERROR;
    } elseif ($entry_email_address_check_error == true) {
      echo tep_draw_input_field('a_email_address') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
    } elseif ($entry_email_address_exists == true) {
      echo tep_draw_input_field('a_email_address') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS;
    } else {
      echo $a_email_address . tep_draw_hidden_field('a_email_address');
    }
  } else {
    echo tep_draw_input_field('a_email_address', $affiliate['affiliate_email_address']) . '&nbsp;</td><td class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT;
  }
?>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <?php
 /* if (AFFILATE_INDIVIDUAL_PERCENTAGE == 'true') {
?>  
  <tr>
    <td class="formAreaTitle"><br><?php echo CATEGORY_COMMISSION; ?></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_COMMISSION; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_commission_percent'];
    } elseif ($error == true) {
      if ($entry_commission_error == true) {
        echo tep_draw_input_field('affiliate_commission_percent') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_COMMISSION_ERROR;
      } else {
        echo $a_commission_percent . tep_draw_hidden_field('a_commission_percent');
      }
    } else {
      echo tep_draw_input_field('a_commission_percent', $affiliate['affiliate_commission_percent']) . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_COMMISSION_TEXT;
    }
?>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
<?php
  }*/
?>  

<?php
  if (ACCOUNT_COMPANY == 'true') {
?>  
  <tr>
    <td class="formAreaTitle"><br><?php echo CATEGORY_COMPANY; ?></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_COMPANY; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_company'];
    } elseif ($error == true) {
      if ($entry_company_error == true) {
        echo tep_draw_input_field('a_company') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_COMPANY_ERROR;
      } else {
        echo $a_company . tep_draw_hidden_field('a_company');
      }
    } else {

      echo tep_draw_input_field('a_company', $affiliate['affiliate_company']) . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_COMPANY_TEXT;
    }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_COMPANY_TAXID; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_company_taxid'];
    } elseif ($error == true) {
      if ($entry_company_taxid_error == true) {
        echo tep_draw_input_field('a_company_taxid') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_COMPANY_TAXID_ERROR;
      } else {
        echo $a_company_taxid . tep_draw_hidden_field('a_company_taxid');
      }
    } else {
      echo tep_draw_input_field('a_company_taxid', $affiliate['affiliate_company_taxid']) . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_COMPANY_TAXID_TEXT;
    }
?>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
<?php
  } if((AFFILIATE_USE_CHECK == 'true')  || (AFFILIATE_USE_PAYPAL == 'true') ||  (AFFILIATE_USE_BANK == 'true')){
?>  
  <tr>
    <td class="formAreaTitle"><br><?php echo CATEGORY_PAYMENT_DETAILS; ?></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
		<tr>
			<td class="main" width="200">&nbsp;<?php echo ENTRY_PAYMENT;?></td>
			<td>
				<table cellpadding="0" cellspacing="2" border="0" width="100%">
					<tr>
						<?php 
								if ($is_read_only == true) {
								  echo '<td class="main">&nbsp;' . $affiliate['affiliate_payment'] . '</td>';
								} elseif ($error == true) {
								  	$value.='<td class="main">&nbsp;' ;
									 if($a_payment == 'C' )
									 	$value.= 'Check';
									else if($a_payment == 'P')
										$value.= 'Paypal';
									else if($a_payment=='D')
										$value.= 'Direct Deposit';
									 echo $value .tep_draw_hidden_field('a_payment') . '</td>';
								} else {
									if (AFFILIATE_USE_CHECK == 'true') { 
										echo '<td class="main">' . tep_draw_radio_field('a_payment','C',($affiliate['affiliate_payment_type']=='C')?true:false,'onClick="javascript:do_action();"') . ENTRY_AFFILIATE_CHECK . '</td>'; 
									}
									if (AFFILIATE_USE_PAYPAL == 'true') {
										echo '<td class="main">' . tep_draw_radio_field('a_payment','P',($affiliate['affiliate_payment_type']=='P')?true:false,'onClick="javascript:do_action();"') .ENTRY_AFFILIATE_PAYPAL . '</td>'; 
									}	
									if (AFFILIATE_USE_BANK == 'true') {
										echo '<td class="main">' . tep_draw_radio_field('a_payment','D',($affiliate['affiliate_payment_type']=='D')?true:false,'onClick="javascript:do_action();"') . ENTRY_AFFILIATE_BANK . '</td>'; 
									}
								}
						?>
						<td width="5"></td>
					</tr>	
				</table>
			</td>
		</tr>					
<?php
 // if (AFFILIATE_USE_CHECK == 'true') {
?>  
          <tr id="affiliate_cheque" style="display:none">
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_PAYMENT_CHECK; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_payment_check'];
    } elseif ($error == true) {
      if ($entry_payment_check_error == true) {
        echo tep_draw_input_field('a_payment_check') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_CHECK_ERROR;
      } else {
        echo $a_payment_check . tep_draw_hidden_field('a_payment_check');
      }
    } else {
      echo tep_draw_input_field('a_payment_check', $affiliate['affiliate_payment_check']) . '&nbsp;<span class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_CHECK_TEXT . '</span>';
    }
?>
            </td>
          </tr>
<?php

 // }
  if (AFFILIATE_USE_PAYPAL == 'true') {
?>  
          <tr id="affiliate_paypal" style="display:none">
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_PAYMENT_PAYPAL; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_payment_paypal'];
    } elseif ($error == true) {
      if ($entry_payment_paypal_error == true) {
        echo tep_draw_input_field('a_payment_paypal') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
      } else {
        echo $a_payment_paypal . tep_draw_hidden_field('a_payment_paypal');
      }
    } else {
      echo tep_draw_input_field('a_payment_paypal', $affiliate['affiliate_payment_paypal']) . '&nbsp;<span class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_PAYPAL_TEXT . '<span>';
    }
?>
            </td>
          </tr>
<?php
  }
  if (AFFILIATE_USE_BANK == 'true') {
?>  
	<tr  id="affiliate_bank" style="display:none">
		<td colspan="2"><table cellpadding="0" cellspacing="2" border="0" width="100%">
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_PAYMENT_BANK_NAME; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_payment_bank_name'];
    } elseif ($error == true) {
      if ($entry_payment_bank_name_error == true) {
        echo tep_draw_input_field('a_payment_bank_name') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_NAME_ERROR;
      } else {
        echo $a_payment_bank_name . tep_draw_hidden_field('a_payment_bank_name');
      }
    } else {
      echo tep_draw_input_field('a_payment_bank_name', $affiliate['affiliate_payment_bank_name']) . '&nbsp;<span class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_NAME_TEXT .'</span>';
    }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_PAYMENT_BANK_BRANCH_NUMBER; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_payment_bank_branch_number'];
    } elseif ($error == true) {
      if ($entry_payment_bank_branch_number_error == true) {
        echo tep_draw_input_field('a_payment_bank_branch_number') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_BRANCH_NUMBER_ERROR;
      } else {
        echo $a_payment_bank_branch_number . tep_draw_hidden_field('a_payment_bank_branch_number');
      }
    } else {
      echo tep_draw_input_field('a_payment_bank_branch_number', $affiliate['affiliate_payment_bank_branch_number']) . '&nbsp;<span class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_BRANCH_NUMBER_TEXT . '</span>';
    }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_PAYMENT_BANK_SWIFT_CODE; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_payment_bank_swift_code'];
    } elseif ($error == true) {
      if ($entry_payment_bank_swift_code_error == true) {
        echo tep_draw_input_field('a_payment_bank_swift_code') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_SWIFT_CODE_ERROR;
      } else {
        echo $a_payment_bank_swift_code . tep_draw_hidden_field('a_payment_bank_swift_code');
      }
    } else {
      echo tep_draw_input_field('a_payment_bank_swift_code', $affiliate['affiliate_payment_bank_swift_code']) . '&nbsp;<span class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_SWIFT_CODE_TEXT . '</span>';
    }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NAME; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_payment_bank_account_name'];
    } elseif ($error == true) {
      if ($entry_payment_bank_account_name_error == true) {
        echo tep_draw_input_field('a_payment_bank_account_name') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NAME_ERROR;
      } else {
        echo $a_payment_bank_account_name . tep_draw_hidden_field('a_payment_bank_account_name');
      }
    } else {
      echo tep_draw_input_field('a_payment_bank_account_name', $affiliate['affiliate_payment_bank_account_name']) . '&nbsp;<span class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NAME_TEXT . '</span>';
    }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NUMBER; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_payment_bank_account_number'];
    } elseif ($error == true) {
      if ($entry_payment_bank_account_number_error == true) {
        echo tep_draw_input_field('a_payment_bank_account_number') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NUMBER_ERROR;
      } else {
        echo $a_payment_bank_account_number . tep_draw_hidden_field('a_payment_bank_account_number');
      }
    } else {
      echo tep_draw_input_field('a_payment_bank_account_number', $affiliate['affiliate_payment_bank_account_number']) . '&nbsp;<span class="inputRequirement">' . ENTRY_AFFILIATE_PAYMENT_BANK_ACCOUNT_NUMBER_TEXT . '</span>';
    }
?>
            </td>
          </tr>
		 </table>
		 </td>
		 </tr> 
<?php
  }
?> 
	      </table></td>
      </tr>
    </table></td>
  </tr>
  <?php }?> 
  <tr>
    <td class="formAreaTitle"><br><?php echo CATEGORY_ADDRESS; ?></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_STREET_ADDRESS; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_street_address'];
  } elseif ($error == true) {
    if ($entry_street_address_error == true) {
      echo tep_draw_input_field('a_street_address') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_STREET_ADDRESS_ERROR;
    } else {
      echo $a_street_address . tep_draw_hidden_field('a_street_address');
    }
  } else {
    echo tep_draw_input_field('a_street_address', $affiliate['affiliate_street_address']) . '&nbsp;<font color="#ff0000">' . ENTRY_STREET_ADDRESS_TEXT .'</font>';
  }
?>
            </td>
          </tr>
<?php
  if (ACCOUNT_SUBURB == 'true') {
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_SUBURB; ?></td>
            <td class="main">&nbsp;
<?php
    if ($is_read_only == true) {
      echo $affiliate['affiliate_suburb'];
    } elseif ($error == true) {
      if ($entry_suburb_error == true) {
        echo tep_draw_input_field('a_suburb') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_SUBURB_ERROR;
      } else {
        echo $a_suburb . tep_draw_hidden_field('a_suburb');
      }
    } else {
      echo tep_draw_input_field('a_suburb', $affiliate['affiliate_suburb']) . '&nbsp;<font color="#ff0000">' . ENTRY_SUBURB_TEXT .'</font>';
    }
?>
            </td>
          </tr>
<?php
  }
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_POST_CODE; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_postcode'];
  } elseif ($error == true) {
    if ($entry_post_code_error == true) {
      echo tep_draw_input_field('a_postcode') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_POST_CODE_ERROR;
   } else {
      echo $a_postcode . tep_draw_hidden_field('a_postcode');
   }
  } else {
    echo tep_draw_input_field('a_postcode', $affiliate['affiliate_postcode'],'maxlength=10') . '&nbsp;<font color="#ff0000">' . ENTRY_POST_CODE_TEXT .'</font>';
  }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_CITY; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_city'];
  } elseif ($error == true) {
    if ($entry_city_error == true) {
      echo tep_draw_input_field('a_city') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_CITY_ERROR;
    } else {
      echo $a_city . tep_draw_hidden_field('a_city');
    }
  } else {
    echo tep_draw_input_field('a_city', $affiliate['affiliate_city']) . '&nbsp;<font color="#ff0000">' . ENTRY_CITY_TEXT .'</font>';
  }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_COUNTRY; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo tep_get_country_name($affiliate['affiliate_country_id']);
  } elseif ($error == true) {
    if ($entry_country_error == true) {
      echo tep_get_country_list('a_country','','id="a_country" onchange="javascript:show_state();"') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_COUNTRY_ERROR;
    } else {
      echo tep_get_country_name($a_country) . tep_draw_hidden_field('a_country');
    }
  } else {
    echo tep_get_country_list('a_country', $affiliate['affiliate_country_id'],'id="a_country" onchange="javascript:show_state();"') . '&nbsp;<font color="#ff0000">' . ENTRY_COUNTRY_TEXT .'</font>';
  }
?>
            </td>
          </tr>
<?php
  if (ACCOUNT_STATE == 'true') {
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_STATE; ?></td>
            <td class="main">&nbsp;
<?php
    /*$state = tep_get_zone_name($a_country, $a_zone_id, $a_state);
    if ($is_read_only == true) {
      echo tep_get_zone_name($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']);
    } elseif ($error == true) {

      if ($entry_state_error == true) {
        if ($entry_state_has_zones == true) {
          $zones_array = array();
          $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($a_country) . "' order by zone_name");
          while ($zones_values = tep_db_fetch_array($zones_query)) {
            $zones_array[] = array('id' => $zones_values['zone_name'], 'text' => $zones_values['zone_name']);
          }
          echo tep_draw_pull_down_menu('a_state', $zones_array) . '&nbsp;' . ENTRY_STATE_ERROR;
        } else {
          echo tep_draw_input_field('a_state') . '&nbsp;' . ENTRY_STATE_ERROR;
        }
      } else {
        echo $state . tep_draw_hidden_field('a_zone_id') . tep_draw_hidden_field('a_state');
      }
    } else {
      echo tep_draw_input_field('a_state', tep_get_zone_name($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state'])) . '&nbsp;' . ENTRY_STATE_TEXT;
    }*/
    ///echo $a_country.'inerer';
    $state = tep_get_zone_name($a_country, $a_zone_id, $a_state);
    $zones_array = array();         
	$zones_query = tep_db_query("select zone_id,zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (($affiliate['affiliate_country_id'])?tep_db_input($affiliate['affiliate_country_id']):STORE_COUNTRY) . "' order by zone_name");
	while ($zones_values = tep_db_fetch_array($zones_query)) {
	   $zones_array[] = array('id' => $zones_values['zone_id'], 'text' => $zones_values['zone_name']);
	}
    if ($is_read_only == true) {
      echo tep_get_zone_name($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']);
    } elseif ($error == true) {
      if ($entry_state_error == true) {
        if ($entry_state_has_zones == true) {                     
          echo tep_draw_input_field('a_state1','','id="a_state1"') . '&nbsp;' . ENTRY_STATE_ERROR;
    	  echo tep_draw_pull_down_menu('a_state', $zones_array,'','id="a_state" style="display:none"').(sizeof($zones_array))?ENTRY_STATE_ERROR:'';
        } else {
          echo tep_draw_input_field('a_state') . '&nbsp;' . ENTRY_STATE_ERROR;
        }
      } else {
        echo $state . tep_draw_hidden_field('a_zone_id') . tep_draw_hidden_field('a_state');
      }
    } else {                             
      $state=$affiliate['affiliate_state'];
      if(!$state) $state = tep_get_zone_name($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'],'');      
      echo tep_draw_input_field('a_state1',$state,'id="a_state1"'.((count($zones_array)>0)?' style="display:none"':''));
      echo tep_draw_pull_down_menu('a_state', $zones_array,$affiliate['affiliate_zone_id'],'id="a_state"'.((count($zones_array)<=0)?' style="display:none"':'')); 
    }
?>
            </td>
          </tr>
<?php
  }
?>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="formAreaTitle"><br><?php echo CATEGORY_CONTACT; ?></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_telephone'];
  } elseif ($error == true) {
    if ($entry_telephone_error == true) {
      echo tep_draw_input_field('a_telephone') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_ERROR;
    } else {
      echo $a_telephone . tep_draw_hidden_field('a_telephone');
    }
  } else {
    echo tep_draw_input_field('a_telephone', $affiliate['affiliate_telephone']) . '&nbsp;<font color="#ff0000">' . ENTRY_TELEPHONE_NUMBER_TEXT.'</font>';
  }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_MOBILE_NUMBER; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_fax'];
  } elseif ($error == true) {
    if ($entry_fax_error == true) {
      echo tep_draw_input_field('a_fax') . '&nbsp;' . ENTRY_MOBILE_NUMBER_ERROR;
    } else {
      echo $a_fax . tep_draw_hidden_field('a_fax');
    }
  } else {
    echo tep_draw_input_field('a_fax', $affiliate['affiliate_fax']) . '&nbsp;' ;
  }
?>
            </td>
          </tr>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_AFFILIATE_HOMEPAGE; ?></td>
            <td class="main">&nbsp;
<?php
  if ($is_read_only == true) {
    echo $affiliate['affiliate_homepage'];
  } elseif ($error == true) {
    if ($entry_homepage_error == true) {
      echo tep_draw_input_field('a_homepage') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_AFFILIATE_HOMEPAGE_ERROR;
    } else {
      echo $a_homepage . tep_draw_hidden_field('a_homepage');
    }
  } else {
    echo tep_draw_input_field('a_homepage', $affiliate['affiliate_homepage']) . '&nbsp;<font color="#ff0000">' . ENTRY_AFFILIATE_HOMEPAGE_TEXT .'</font>';
  }
?>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
<?php
  if ($is_read_only == false) {
?>
  <tr>
    <td class="formAreaTitle"><br><?php echo CATEGORY_PASSWORD; ?></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_PASSWORD; ?></td>
            <td class="main">&nbsp;

<?php 
    if ($error == true) {
      if ($entry_password_error == true) {
        echo tep_draw_password_field('a_password') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_PASSWORD_ERROR;
      } else {
        echo PASSWORD_HIDDEN . tep_draw_hidden_field('a_password') . tep_draw_hidden_field('a_confirmation');
      }
    } else {
      echo tep_draw_password_field('a_password','','onKeyUp=javascript:do_pwd_check(this);') . '&nbsp;<font color="#ff0000">' . ENTRY_PASSWORD_TEXT .'</font>';
	   // echo tep_draw_password_field('a_password','','onKeyUp=javascript:do_pwd_check(this);') . '&nbsp;</td><td class="inputRequirement">' . ENTRY_PASSWORD_ERROR;
		//echo tep_draw_password_field('a_password','','onKeyUp=javascript:do_pwd_check(this);') . (tep_not_null(ENTRY_PASSWORD_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_TEXT . '</span>': ''); ?></td><td id='pwd_str' class="inputRequirement" style="font-color:red;font-size:11"></td>
<?php }
?>
           </td> 
          </tr> 
<?php
    if ( ($error == false) || ($entry_password_error == true) ) {
?>
          <tr>
            <td class="main" width="200">&nbsp;<?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>
            <td class="inputRequirement">&nbsp;
<?php
      echo tep_draw_password_field('a_confirmation') . '&nbsp;<font color="#ff0000">' . ENTRY_PASSWORD_CONFIRMATION_TEXT .'</font>';
?>
            </td>
          </tr>
<?php
    }
?>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td class="formAreaTitle"><br></td>
  </tr>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" class="main">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main">&nbsp;</td>
            <td class="main">&nbsp;
<?php 
	echo tep_draw_checkbox_field('a_agb', $value = '1', $checked = $affiliate['affiliate_agb']) . ENTRY_AFFILIATE_ACCEPT_AGB;
    if ($entry_agb_error == true) {
      echo "<br>".ENTRY_AFFILIATE_AGB_ERROR;
    }
?>
            </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
<?php
  }
?>
</table>
<?php //if($error == true){?>
<script>
disable('<?php echo $a_payment;?>');
</script>
<?php //}?>