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

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce
  
  osCommRes, Services Online
  http://www.oscommres.com

  Copyright (c) 2005 osCommRes

  Released under the GNU General Public License
  
  Freeway eCommerce from ZacWare
http://www.zac-ware.com/freeway

Copyright 2007 ZacWare Pty. Ltd
*/
  $newsletter_array = array(array('id' => '1',
                                  'text' => ENTRY_NEWSLETTER_YES),
                            array('id' => '0',
                                  'text' => ENTRY_NEWSLETTER_NO));
   		  
function sbs_get_zone_name($country_id, $zone_id) {
    $zone_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($country_id) . "' and zone_id = '" . tep_db_input($zone_id) . "'");
    if (tep_db_num_rows($zone_query)) {
      $zone = tep_db_fetch_array($zone_query);
      return $zone['zone_name'];
    } else {      
      return $default_zone;
    }
  }
 
 // Returns an array with countries
// TABLES: countries
  function sbs_get_countries($countries_id = '', $with_iso_codes = false) {
    $countries_array = array();
    if ($countries_id) {
      if ($with_iso_codes) {
        $countries = tep_db_query("select countries_name, countries_iso_code_2, countries_iso_code_3 from " . TABLE_COUNTRIES . " where countries_id = '" . tep_db_input($countries_id) . "' order by countries_name");
        $countries_values = tep_db_fetch_array($countries);
        $countries_array = array('countries_name' => $countries_values['countries_name'],
                                 'countries_iso_code_2' => $countries_values['countries_iso_code_2'],
                                 'countries_iso_code_3' => $countries_values['countries_iso_code_3']);
      } else {
        $countries = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " where countries_id = '" . tep_db_input($countries_id) . "'");
        $countries_values = tep_db_fetch_array($countries);
        $countries_array = array('countries_name' => $countries_values['countries_name']);
      }
    } else {
      $countries = tep_db_query("select countries_id, countries_name from " . TABLE_COUNTRIES . " order by countries_name");
      while ($countries_values = tep_db_fetch_array($countries)) {
        $countries_array[] = array('countries_id' => $countries_values['countries_id'],
                                   'countries_name' => $countries_values['countries_name']);
      }
    }

    return $countries_array;
  } 
  ////
function sbs_get_country_list($name, $selected = '', $parameters = '') { 
   $countries_array = array(array('id' => '', 'text' => PULL_DOWN_DEFAULT)); 
   $countries = sbs_get_countries(); 
   $size = sizeof($countries); 
   for ($i=0; $i<$size; $i++) { 
     $countries_array[] = array('id' => $countries[$i]['countries_id'], 'text' => $countries[$i]['countries_name']); 
   } 

   return tep_draw_pull_down_menu($name, $countries_array, $selected, $parameters); 
}


////
// Alias function to tep_get_countries, which also returns the countries iso codes
 /* function tep_get_countries_with_iso_codes($countries_id) {
    return tep_get_countries($countries_id, true);
  }*/
?>
<script>
 function do_pwd_check(obj)
 {
  <?php //if((MODULE_ADMIN_PASSWORD_STRENGTH=){?>	
 	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>
<table border="0" width="100%" cellspacing="0" cellpadding="2">
  
   <?php tep_content_title_top(CATEGORY_PERSONAL); ?>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" >
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
<?php
  if (ACCOUNT_GENDER == 'true') {
    $male = ($account['customers_gender'] == 'm') ? true : false;
    $female = ($account['customers_gender'] == 'f') ? true : false;
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_GENDER; ?></td>
            <td class="main">
<?php
    if ($is_read_only) {
      echo ($account['customers_gender'] == 'm') ? MALE : FEMALE;
    } elseif ($error) {
      if ($entry_gender_error) {
        echo tep_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . ENTRY_GENDER_ERROR;
      } else {
        echo ($gender == 'm') ? MALE : FEMALE;
        echo tep_draw_hidden_field('gender');
      }
    } else {
      echo tep_draw_radio_field('gender', 'm', $male) . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('gender', 'f', $female) . '&nbsp;&nbsp;' . FEMALE . '&nbsp;' . ENTRY_GENDER_TEXT;
    }
?></td>
          </tr>
<?php
  }
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_FIRST_NAME; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['customers_firstname'];
  } elseif ($error) {
    if ($entry_firstname_error) {
      echo tep_draw_input_field('firstname') . '&nbsp;' . ENTRY_FIRST_NAME_ERROR;
    } else {
      echo $firstname . tep_draw_hidden_field('firstname');
    }
  } else {
    echo tep_draw_input_field('firstname', $account['customers_firstname']) . '&nbsp;' . ENTRY_FIRST_NAME_TEXT;
  }
?></td>
          </tr>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_LAST_NAME; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['customers_lastname'];
  } elseif ($error) {
    if ($entry_lastname_error) {
      echo tep_draw_input_field('lastname') . '&nbsp;' . ENTRY_LAST_NAME_ERROR;
    } else {
      echo $lastname . tep_draw_hidden_field('lastname');
    }
  } else {
    echo tep_draw_input_field('lastname', $account['customers_lastname']) . '&nbsp;' . ENTRY_LAST_NAME_TEXT;
  }
?></td>
          </tr>
<?php
  if (ACCOUNT_DOB == 'true') {
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
            <td class="main">
<?php
    if ($is_read_only) {
      echo format_date($account['customers_dob']);
    } elseif ($error) {
      if ($entry_date_of_birth_error) {
        echo tep_draw_input_field('dob') . '&nbsp;' . ENTRY_EVENT_DATE_OF_BIRTH_ERROR;
      } else {
        echo $dob . tep_draw_hidden_field('dob');
      }
    } else {
      echo tep_draw_input_field('dob', format_date($account['customers_dob'])) . '&nbsp;' . ENTRY_EVENT_DATE_OF_BIRTH_TEXT;
    }
?></td>
          </tr>
<?php
  }
?>
<?php
  if (ACCOUNT_USERNAME == 'true') {
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_USERNAME; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['customers_username'];
  } elseif ($error) {
    if ($entry_username_error) {
      echo tep_draw_input_field('username','','maxlength=20') . '&nbsp;' . ENTRY_USERNAME_ERROR;
    } elseif ($entry_username_exists) {
      echo tep_draw_input_field('username','','maxlength=20') . '&nbsp;' . ENTRY_USERNAME_ERROR_EXISTS;
    } else {
      echo $username . tep_draw_hidden_field('username');
    }
  } else {
    echo tep_draw_input_field('username', $account['customers_username'],'maxlength=20') . '&nbsp;' . ENTRY_USERNAME_TEXT;
  }
?></td>
          </tr>
<?php }?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
            <td class="main">
<?php $con_email=false;
	 $er=ENTRY_EMAIL_ADDRESS_ERROR;
 // if($entry_email_address_match_error) $er=ENTRY_CONFIRM_EMAIL_ADDRESS_ERROR;
  if ($is_read_only) {
    echo $account['customers_email_address'];
  } elseif ($error) {
    if ($entry_email_address_error || $entry_email_address_match_error) {
      echo tep_draw_input_field('email_address') . '&nbsp;' . $er;
    } elseif ($entry_email_address_check_error) {
      echo tep_draw_input_field('email_address') . '&nbsp;' . ENTRY_EMAIL_ADDRESS_CHECK_ERROR;
    } elseif ($entry_email_address_exists) {
      echo tep_draw_input_field('email_address') . '&nbsp;' . ENTRY_EMAIL_ADDRESS_ERROR_EXISTS;
    } else {
      echo $email_address . tep_draw_hidden_field('email_address');
      $con_email=true;
    }
  } else {
    echo tep_draw_input_field('email_address', $account['customers_email_address']) . '&nbsp;' . ENTRY_EMAIL_ADDRESS_TEXT;
  }
?></td>
    </tr>
    <!--<tr>
    	<td class="main"><?php //echo ENTRY_CONFIRM_EMAIL_ADDRESS;?></td>
    	<td class="main"><?php 
    	/*if($con_email)
    		echo $email_address . tep_draw_hidden_field('confirm_email_address');
    	else
    		echo tep_draw_input_field('confirm_email_address');*/
    	?></td>
    </tr>!-->
<?php if (ACCOUNT_SECOND_EMAIL=='true') {
if($action!='process' || ($action=='process' && $second_email_address!='')){
?>
    <tr>
      <td class="main" width="200"><?php echo ENTRY_SECOND_EMAIL_ADDRESS; ?></td>
      <td class="main">
<?php 
   $con_sec_email=false;
	$er=ENTRY_SECOND_EMAIL_ADDRESS_ERROR;
  if($entry_second_email_address_match_error) $er=ENTRY_SECOND_EMAIL_ADDRESS_CHECK_ERROR; 
  if ($is_read_only) {
    echo $account['customers_second_email_address'];
  } elseif ($error) {
    if ($entry_second_email_address_error || $entry_second_email_address_match_error) {
      echo tep_draw_input_field('second_email_address') . '&nbsp;' . $er;
    } elseif ($entry_second_email_address_check_error) {
      echo tep_draw_input_field('second_email_address') . '&nbsp;' . ENTRY_SECOND_EMAIL_ADDRESS_CHECK_ERROR;
    }  else if($second_email_address!='') { 
      echo $second_email_address . tep_draw_hidden_field('second_email_address');
      $con_sec_email=true; 
    } 
  } else  {
     echo tep_draw_input_field('second_email_address', $account['customers_second_email_address']);
  }
?></td>
     </tr>
     <!--<tr id="sec_email_address" <?php echo (!$con_sec_email && !$error)?'style="display:none"':'';?>>
    	<td class="main"><?php //echo ENTRY_CONFIRM_EMAIL_ADDRESS;?></td> 
    	<td class="main"><?php
    	/*if($con_sec_email && $second_email_address!='')  
    		echo $second_email_address . tep_draw_hidden_field('second_confirm_email_address');
    	else
    		echo tep_draw_input_field('second_confirm_email_address');	*/
    	?></td>
    </tr>!--> 
    <?php }  
 }
?>
        </table></td>
      </tr>
    </table></td>
  </tr>
   <?php tep_content_title_bottom(); ?>
<?php
  if (ACCOUNT_COMPANY == 'true') {
?>  
 <!-- <tr>
    <td><br>!--><?php //echo CATEGORY_COMPANY; ?> <?php tep_content_title_top(CATEGORY_COMPANY); ?><!--</td>!-->
 <!-- </tr>!-->
   
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200"><?php echo ENTRY_COMPANY; ?></td>
            <td class="main">
<?php
    if ($is_read_only) {
      echo $account['entry_company'];
    } elseif ($error) {
      if ($entry_company_error) {
        echo tep_draw_input_field('company') . '&nbsp;' . ENTRY_COMPANY_ERROR;
      } else {
        echo $company . tep_draw_hidden_field('company');
      }
    } else {
      echo tep_draw_input_field('company', $account['entry_company']) . '&nbsp;' . ENTRY_COMPANY_TEXT;
    }
?></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
<?php tep_content_title_bottom();
  }
?>
  
  
  <?php tep_content_title_top(CATEGORY_ADDRESS); ?>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" >
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200"><?php echo ENTRY_STREET_ADDRESS; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['entry_street_address'];
  } elseif ($error) {
    if ($entry_street_address_error) {
      echo tep_draw_input_field('street_address') . '&nbsp;' . ENTRY_STREET_ADDRESS_ERROR;
    } else {
      echo $street_address . tep_draw_hidden_field('street_address');
    }
  } else {
    echo tep_draw_input_field('street_address', $account['entry_street_address']) . '&nbsp;' . ENTRY_STREET_ADDRESS_TEXT;
  }
?></td>
          </tr>
<?php
  if (ACCOUNT_SUBURB == 'true') {
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_SUBURB; ?></td>
            <td class="main">
<?php
    if ($is_read_only) {
      echo $account['entry_suburb'];
    } elseif ($error) {
      if ($entry_suburb_error) {
        echo tep_draw_input_field('suburb') . '&nbsp;' . ENTRY_SUBURB_ERROR;
      } else {
        echo $suburb . tep_draw_hidden_field('suburb');
      }
    } else {
      echo tep_draw_input_field('suburb', $account['entry_suburb']) . '&nbsp;' . ENTRY_SUBURB_TEXT;
    }
?></td>
          </tr>
<?php
  }
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_POST_CODE; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['entry_postcode'];
  } elseif ($error) {
    if ($entry_post_code_error) {
      echo tep_draw_input_field('postcode') . '&nbsp;' . ENTRY_POST_CODE_ERROR;
    } else {
      echo $postcode . tep_draw_hidden_field('postcode');
    }
  } else {
    echo tep_draw_input_field('postcode', $account['entry_postcode']) . '&nbsp;' . ENTRY_POST_CODE_TEXT;
  }
?></td>
          </tr>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_CITY; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['entry_city'];
  } elseif ($error) {
    if ($entry_city_error) {
      echo tep_draw_input_field('city') . '&nbsp;' . ENTRY_CITY_ERROR;
    } else {
      echo $city . tep_draw_hidden_field('city');
    }
  } else {
    echo tep_draw_input_field('city', $account['entry_city']) . '&nbsp;' . ENTRY_CITY_TEXT;
  }
?></td>
          </tr>
         
      <tr>
               <td class="main" width="200"><?php echo ENTRY_COUNTRY; ?></td>
               <td class="main">
<?php
      $account['entry_country_id'] = STORE_COUNTRY;
	  if ($is_read_only) { 
	       echo tep_get_country_name($account['entry_country_id']);    
	  } elseif ($error) {
       if ($entry_country_error) {
		 	echo sbs_get_country_list('country','','onchange="javascript:show_state();"') . '&nbsp;' . ENTRY_COUNTRY_ERROR;
       } else {
         echo tep_get_country_name($country) . tep_draw_hidden_field('country');
       }
     } else {
       echo sbs_get_country_list('country', $account['entry_country_id'],'onchange="javascript:show_state();"') . '&nbsp;' . ENTRY_COUNTRY_TEXT;
     }
?></td>
          </tr>
          <tr>
          <td class="main" width="200"><?php echo ENTRY_STATE;?></td>
          <td class="main">
<?php if (ACCOUNT_STATE == 'true') { 	  
      $zones_query = tep_db_query("select zone_id,zone_name from " . TABLE_ZONES . " where zone_country_id = '" . tep_db_input($account['entry_country_id']) . "' order by zone_name");
 	   if($account['state'])
 	   	$entry_state = sbs_get_zone_name($account['entry_country_id'], $account['state']);
 	    
 	  	while ($zones_values = tep_db_fetch_array($zones_query)) { 
	      $zones_array[]=array('id'=>$zones_values['zone_name'],'text'=>$zones_values['zone_name']);
	   }
 	  /* if($action!='process'){ 
 	  		 echo tep_draw_pull_down_menu('state',array(),'','style="display:none"').' '.tep_draw_input_field('state1',$state);
 	   }*/
	   if($action!='process'){ 
			$default_zone_sql = "select zone_name from " . TABLE_ZONES . " where zone_country_id='" . STORE_COUNTRY . "' and zone_id='" . STORE_ZONE . "'";
			$default_zone_query = tep_db_query($default_zone_sql);
			$default_zone_result = tep_db_fetch_array($default_zone_query);
		 echo tep_draw_pull_down_menu('state',$zones_array,$default_zone_result["zone_name"],' id="country" '.((sizeof($zones_array)>0)?'':'style="display:none"')).' '.tep_draw_input_field('state1',$state,((sizeof($zones_array)<=0)?'':'style="display:none"'));
 	   }
	   else if($state=='' && $action=='process'){
 	   	 echo tep_draw_pull_down_menu('state',$zones_array).' ' .ENTRY_STATE_ERROR;
 	   }
	   else {
 	 		echo $state . 	tep_draw_hidden_field('entry_zone_id') . tep_draw_hidden_field('state');
 	   }  
	} ?> 
 		</td>
	 </tr> 
        </table></td>
      </tr>
    </table></td>
  </tr>
   <?php tep_content_title_bottom(); ?>
 
    <?php tep_content_title_top(CATEGORY_CONTACT); ?>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" >
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
<?php
  if (ACCOUNT_TELEPHONE == 'true') {
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['customers_telephone'];
  } elseif ($error) {
    if ($entry_telephone_error) {
      echo tep_draw_input_field('telephone') . '&nbsp;' . ENTRY_TELEPHONE_NUMBER_ERROR;
    } else {
      echo $telephone . tep_draw_hidden_field('telephone');
    }
  } else {
    echo tep_draw_input_field('telephone', $account['customers_telephone']) . '&nbsp;' . ENTRY_TELEPHONE_NUMBER_TEXT;
  }
?></td>
          </tr>
<?php
  }
  if (ACCOUNT_SECOND_PHONE=='true'){
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_SECOND_TELEPHONE_NUMBER; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['customers_second_telephone'];
  } elseif ($error) {
    if ($entry_second_telephone_error) {
      echo tep_draw_input_field('second_telephone') . '&nbsp;' . ENTRY_SECOND_TELEPHONE_NUMBER_ERROR;
    } else {
      echo $second_telephone . tep_draw_hidden_field('second_telephone');
    }
  } else {
    echo tep_draw_input_field('second_telephone', $account['customers_second_telephone']);
  }
?></td>
          </tr>
<?php 
 } 
?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_MOBILE_NUMBER; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    echo $account['customers_fax'];
  } elseif ($error) {
    if ($entry_mobile_error) {
      echo tep_draw_input_field('mobile') . '&nbsp;' . ENTRY_MOBILE_NUMBER_ERROR;
    } else {
      echo $mobile . tep_draw_hidden_field('mobile');
    }
  } else {
      echo tep_draw_input_field('mobile', $account['customers_fax']) . '&nbsp;' . ENTRY_MOBILE_NUMBER_TEXT;
  }
?></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <?php tep_content_title_bottom(); ?>
  
   <?php tep_content_title_top(CATEGORY_OPTIONS); ?>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" >
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
		<?php if (ACCOUNT_NEWSLETTER=='true'){?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_NEWSLETTER; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    if ($account['customers_newsletter'] == '1') {
      echo ENTRY_NEWSLETTER_YES;
    } else {
      echo ENTRY_NEWSLETTER_NO;
    }
  } elseif ($processed) {
    if ($newsletter == '1') {
      echo ENTRY_NEWSLETTER_YES;
    } else {
      echo ENTRY_NEWSLETTER_NO;
    }
    echo tep_draw_hidden_field('newsletter');  
  } else {
    echo tep_draw_pull_down_menu('newsletter', $newsletter_array, $account['customers_newsletter']) . '&nbsp;' . ENTRY_NEWSLETTER_TEXT;
  }
?></td>
          </tr>
		  <?php } 
		  if (ACCOUNT_RESERVATION_NEWSLETTER =='true'){ ?>
          <tr>
            <td class="main" width="200"><?php echo ENTRY_RESERVE_NEWSLETTER; ?></td>
            <td class="main">
<?php
  if ($is_read_only) {
    if ($account['customers_reserve_newsletter'] == '1') {
      echo ENTRY_NEWSLETTER_YES;
    } else {
      echo ENTRY_NEWSLETTER_NO;
    }
  } elseif ($processed) {
    if ($reserve_newsletter == '1') {
      echo ENTRY_NEWSLETTER_YES;
    } else {
      echo ENTRY_NEWSLETTER_NO;
    }
    echo tep_draw_hidden_field('reserve_newsletter');  
  } else {
    echo tep_draw_pull_down_menu('reserve_newsletter', $newsletter_array, $account['customers_reserve_newsletter']) . '&nbsp;' . ENTRY_NEWSLETTER_TEXT;
  }
?></td></tr>
<?php } 
if (ACCOUNT_SUBSCRIPTION_NEWSLETTER=='true'){ ?>
<tr>
	<td class="main" width="200">
		<?php echo SUBSCRIPTION_NEWSLETTER;?>
	</td>
	<td class="main">
	<?php
  if ($is_read_only) {
    if ($account['customers_subscription_newsletter'] == '1') {
      echo ENTRY_NEWSLETTER_YES;
    } else {
      echo ENTRY_NEWSLETTER_NO;
    }
  } elseif ($processed) {
    if ($newsletter == '1') {
      echo ENTRY_NEWSLETTER_YES;
    } else {
      echo ENTRY_NEWSLETTER_NO;
    }
    echo tep_draw_hidden_field('subscription_newsletter');  
  } else {
    echo tep_draw_pull_down_menu('subscription_newsletter', $newsletter_array, $account['customers_subscription_newsletter']) . '&nbsp;' . ENTRY_NEWSLETTER_TEXT;
  }
 ?></td>
</tr>
<?php }  
?>
	<tr>
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif',1,5); ?></td>
	</tr>
<?php 

if (HIDE_CUSTOMER_OCCUPATION_BACK=='false'){ ?>
	<tr>
		<td class="main" width="200"><?php echo ENTRY_CUSTOMER_OCCUPATION; ?></td>
		<td class="main"><?php echo tep_draw_pull_down_menu('occupation',tep_get_customer_options('O')) . '&nbsp;' . ENTRY_CUSTOMER_OCCUPATION_TEXT; ?></td>
	</tr>
<?php } 
if (HIDE_CUSTOMER_INTEREST_BACK=='false'){
?>
	<tr>
		<td class="main" width="200"><?php echo ENTRY_CUSTOMER_INTEREST; ?></td>
		<td class="main"><?php echo tep_draw_pull_down_menu('interest',tep_get_customer_options('I')) . '&nbsp;' . ENTRY_CUSTOMER_INTEREST_TEXT; ?></td>
	</tr>
<?php } ?>
	<tr>
		<td class="main"><?php echo tep_draw_separator('pixel_trans.gif',1,5); ?></td>
	</tr>
     <!--CGDiscountSpecials start-->
	 <tr>
        <td class="main"><?php echo ENTRY_CUSTOMERS_DISCOUNT; ?></td>
        <td class="main">
              <select name="customers_discount_sign">
                 <option name="minus" value="-" <?php if (strstr($cInfo->customers_discount,"-")) echo "selected=\"selected\"" ?>>-</option>
                 <option name="plus" value="+" <?php if (strstr($cInfo->customers_discount,"+")) echo "selected=\"selected\"" ?>>+</option>
              </select>&nbsp;<?php echo tep_draw_input_field('customers_discount', substr($cInfo->customers_discount,1,strlen($cInfo->customers_discount)), 'maxlength="9"'); ?>&nbsp;%
        </td>
     </tr>
	 <tr>
       <td class="main" width="200"><?php echo ENTRY_CUSTOMERS_GROUPS_NAME; ?></td>
         <?php 
             $groups_query = tep_db_query("select customers_groups_id, customers_groups_name from " . TABLE_CUSTOMERS_GROUPS ." order by customers_groups_name");
             while($groups = tep_db_fetch_array($groups_query)) {
                $groups_array[] = array('text' => $groups['customers_groups_name'],
                                        'id' => $groups['customers_groups_id']);
             }
         ?>
        <td class="main"><?php echo tep_draw_pull_down_menu('customers_groups_id', $groups_array, $customers['customers_groups_id']); ?></td>
     </tr>
     <!--CGDiscountSpecials end-->
	  <?php $_array=array('d','m','Y');  $replace_array=array('DD','MM','YYYY'); 	$date_format=str_replace($_array,$replace_array,EVENTS_DATE_FORMAT);?>
	 <tr>
	 <td nowrap="nowrap"  class="main" width="200"><?php echo TEXT_SUSPEND_DATE ;?><small>(<?php echo $date_format;?>)</small></td>
	 <td class="main" ><?php echo tep_draw_input_field("txt_suspend_date",format_date($account['suspend_from']),"size=10",false,'text',false);?>
							<a href="javascript:show_calendar('account_edit.txt_suspend_date',null,null,'<?php echo $date_format; ?>');"
							onmouseover="window.status='Date Picker';return true;"
							onmouseout="window.status='';return true;"><img border="none" src="images/icon_calendar.gif"/>  
							</a>
		</td>
		</tr>
		<tr>
			<td nowrap="nowrap" class="main"  width="200"><?php echo TEXT_RESUME_DATE; ?><small>(<?php echo $date_format;?>)</small></td>
			<td class="main"><?php echo tep_draw_input_field("txt_resume_date",format_date($account['resume_from']) ,"size=10",false,'text',false);?>
							<a href="javascript:show_calendar('account_edit.txt_resume_date',null,null,'<?php echo $date_format; ?>');"
							onmouseover="window.status='Date Picker';return true;"
							onmouseout="window.status='';return true;"><img border="none" src="images/icon_calendar.gif"/>  
							</a>
						</td>
	 </tr>
          <tr>
            <td class="main" width="200">
<?php
  if ($is_read_only) {
      echo ($account['customers_type']=='V'? ENTRY_VIP_CUSTOMER:'');
  } elseif ($processed) {
     echo tep_draw_hidden_field('customers_type',$customers_type) . '&nbsp;' . ($customers_type=='V'? ENTRY_VIP_CUSTOMER:'');
  }else { ?>
   <?php
    echo tep_draw_checkbox_field('customers_type', 'V') . '&nbsp;' . ENTRY_VIP_CUSTOMER; ?>
<?php	
    }
?></td>
<td class="main">
      <?php echo tep_draw_checkbox_field('is_blocked', 'Y') . '&nbsp;' . ENTRY_BLOCKED_CUSTOMER;?>
	  </td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
   <?php tep_content_title_bottom(); ?>
 <?php if (HIDE_REFERRAL_BACK=='false'){?>



<?php tep_content_title_top(TEXT_REFERRAL_SOURCE); ?>
<tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" >
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200"><?php echo HOW_DID_U_HEAR; ?></td>
            <td class="main"><?php
            $refer_thr=(defined("DISPLAY_REFERRAL_OTHER"))?DISPLAY_REFERRAL_OTHER:'false';   
            echo tep_get_source_list('source','','onchange="javascript:(this.options[this.selectedIndex].value==\'9999\' && '.$refer_thr.'==true)?document.getElementById(\'refer_other\').style.display=\'\':document.getElementById(\'refer_other\').style.display=\'none\';"') . '&nbsp;<small><font color="#AABBDD">required</font></small>';?></td>
		  </tr>
<?php if (DISPLAY_REFERRAL_OTHER == 'true') { ?>
		  <tr id="refer_other" style="display:none">
		  	<td class="main" width="200"><?php echo TEXT_OTHER;?></td>
			<td class="main"><?php echo tep_draw_input_field('source_other') . '&nbsp;'; ?></td>
		  </tr>
<?php } ?>
		  </table>
		</td>
	  </tr> 	
	 </table>
	</td>
</tr>
 <?php tep_content_title_bottom(); ?>
<?php 
} ?>

<?php  if (!$is_read_only) {
?>
  
   <?php tep_content_title_top(CATEGORY_PASSWORD); ?>
  <tr>
    <td class="main"><table border="0" width="100%" cellspacing="0" cellpadding="2" >
      <tr>
        <td class="main"><table border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main" width="200" ><?php echo ENTRY_PASSWORD; ?></td>
            <td class="main">
				<table><tr><td>
<?php
    if ($error) {
      if ($entry_password_error) {
        echo tep_draw_password_field('password','',false,'onKeyUp=javascript:do_pwd_check(this);') . '&nbsp;' . ENTRY_PASSWORD_ERROR;
      } 
	  elseif($entry_password_strength_error)
	  {
        echo tep_draw_password_field('password','',false,'onKeyUp=javascript:do_pwd_check(this);') . '&nbsp;' . ENTRY_PASSWORD_STRENGTH_ERROR;
	  }
	  else {
        echo PASSWORD_HIDDEN . tep_draw_hidden_field('password') . tep_draw_hidden_field('confirmation');
      }
    } else {
      echo tep_draw_password_field('password','',false,'onKeyUp=javascript:do_pwd_check(this);') . '&nbsp;' . ENTRY_PASSWORD_TEXT;
    }
?></td><td id='pwd_str' style="font-color:red;font-size:14"></td></tr></table>
</td>
         </tr>
<?php
    if ( (!$error) || ($entry_password_error) || ($entry_password_strength_error)) {
?>
          <tr>
            <td class="main"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>
            <td class="main">
<?php
      echo tep_draw_password_field('confirmation') . '&nbsp;' . ENTRY_PASSWORD_CONFIRMATION_TEXT;
?>
</td>
          </tr>
<?php
    }
?>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <?php tep_content_title_bottom(); 
 }
?>
</table>