<?php

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

include(DIR_WS_INCLUDES.'general.js');
include(DIR_WS_INCLUDES.'javascript/http.js');
include(DIR_WS_INCLUDES.'password_strength.js.php');
 echo tep_draw_form('create_account', tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'), 'post', 'onSubmit="return check_form(create_account);"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB; ?>">
 <script>
 function do_pwd_check(obj)
 {
 	pwd=obj.value;
	if(pwd.length==0 && document.getElementById("pwd_str"))
	  document.getElementById("pwd_str").innerHTML='';
	else if(pwd.length<<?php echo ENTRY_PASSWORD_MIN_LENGTH;?>)
		document.getElementById("pwd_str").innerHTML='<?php echo ENTRY_PASSWORD_STRENGTH_ERROR;?>';
	else if(!check_password_strength(pwd))
		document.getElementById("pwd_str").innerHTML='<?php echo ENTRY_PASSWORD_STRENGTH_ERROR;?>';
	else
		document.getElementById("pwd_str").innerHTML='';
 }
</script>
<?php
// BOF: Lango Added for template MOD
if (SHOW_HEADING_TITLE_ORIGINAL == 'yes') {
$header_text = '&nbsp;'
//EOF: Lango Added for template MOD
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_account.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
        </table></td>
      </tr>
<?php
// BOF: Lango Added for template MOD
}else{
$header_text = HEADING_TITLE;
}
// EOF: Lango Added for template MOD
	if(!isset($hide_row_top)) {
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
	}
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_top(false, false, $header_text);
}
// EOF: Lango Added for template MOD
?>
      <tr>
        <td class="smallText"><br><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  if ($messageStack->size('create_account') > 0) { 
?>
      <tr>
        <td><?php echo $messageStack->output('create_account'); ?></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
<?php
  } 
?>
      <tr>
        <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td class="main"><b><?php echo CATEGORY_PERSONAL; ?></b></td>
           <td class="inputRequirement" align="right"><?php echo FORM_REQUIRED_INFORMATION; ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" cellspacing="2" cellpadding="2">
<?php
  if (ACCOUNT_GENDER == 'true') {
?>
              <tr>
                <td class="main"><?php echo ENTRY_GENDER; ?></td>
                <td class="main"><?php echo tep_draw_radio_field('gender', 'm') . '&nbsp;&nbsp;' . MALE . '&nbsp;&nbsp;' . tep_draw_radio_field('gender', 'f') . '&nbsp;&nbsp;' . FEMALE . '&nbsp;&nbsp;&nbsp;' . (tep_not_null(ENTRY_GENDER_TEXT) ? '<span class="inputRequirement">' . ENTRY_GENDER_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
  }
?>
              <tr>
                <td class="main" width="160"><?php echo ENTRY_FIRST_NAME; ?></td>
                <td class="main"><?php echo tep_draw_input_field('firstname') . '&nbsp;' . (tep_not_null(ENTRY_FIRST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_FIRST_NAME_TEXT . '</span>': ''); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo ENTRY_LAST_NAME; ?></td>
                <td class="main"><?php echo tep_draw_input_field('lastname') . '&nbsp;' . (tep_not_null(ENTRY_LAST_NAME_TEXT) ? '<span class="inputRequirement">' . ENTRY_LAST_NAME_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
  if (ACCOUNT_DOB == 'true') {
?>
              <tr>
                <td class="main"><?php echo ENTRY_DATE_OF_BIRTH; ?></td>
                <td class="main"><?php echo tep_draw_input_field('dob') . '&nbsp;' . (tep_not_null(ENTRY_EVENT_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_EVENT_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
  }
?>
<?php
  if (ACCOUNT_USERNAME == 'true') {
?>
              <tr>
                <td class="main"><?php echo ENTRY_USERNAME; ?></td>
                <td class="main"><?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"><?php echo ENTRY_EMAIL_ADDRESS; ?></td>
                <td class="main"><?php echo tep_draw_input_field('email_address') . '&nbsp;' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo ENTRY_CONFIRM_EMAIL_ADDRESS; ?></td>
                <td class="main"><?php echo tep_draw_input_field('confirm_email_address') . '&nbsp;' . (tep_not_null(ENTRY_EMAIL_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>': ''); ?></td>
              </tr>
<?php 
  if (ACCOUNT_SECOND_EMAIL=='true') {
?>
              <tr>
                <td class="main"><?php echo ENTRY_SECOND_EMAIL_ADDRESS; ?></td>
                <td class="main"><?php echo tep_draw_input_field('second_email_address','','id="second_email_address" onKeyup="set_action(this);"'); ?></td>
              </tr>
             <tr id="sec_email_address"  style="display:none" >
				    	<td class="main"><?php echo ENTRY_SEC_CONFIRM_EMAIL_ADDRESS;?></td> 
				    	<td class="main"><?php
				    	   	echo tep_draw_input_field('second_confirm_email_address','','id="second_confirm_email_address"').'<span class="inputRequirement">' . ENTRY_EMAIL_ADDRESS_TEXT . '</span>';	
				    	?></td>
    			</tr> 
<?php 
  }
?>
	<script language="javascript">
    	function set_action(this_){
    		var sec=document.getElementById('sec_email_address');
    		var sec_box=document.getElementById("second_confirm_email_address");
    		sec.style.display="none";
    		if(this_.value=='') sec_box.value="";
    		if(this_.value) sec.style.display="";
    	}
    </script>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  if (ACCOUNT_COMPANY == 'true') {
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><b><?php echo CATEGORY_COMPANY; ?></b></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td class="main" width="160"><?php echo ENTRY_COMPANY; ?></td>
                <td class="main"><?php echo tep_draw_input_field('company') . '&nbsp;' . (tep_not_null(ENTRY_COMPANY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COMPANY_TEXT . '</span>': ''); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
  }
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><b><?php echo CATEGORY_ADDRESS; ?></b></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td class="main" width="160"><?php echo ENTRY_STREET_ADDRESS; ?></td>
                <td class="main"><?php echo tep_draw_input_field('street_address') . '&nbsp;' . (tep_not_null(ENTRY_STREET_ADDRESS_TEXT) ? '<span class="inputRequirement">' . ENTRY_STREET_ADDRESS_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
  if (ACCOUNT_SUBURB == 'true') {
?>
              <tr>
                <td class="main"><?php echo ENTRY_SUBURB; ?></td>
                <td class="main"><?php echo tep_draw_input_field('suburb') . '&nbsp;' . (tep_not_null(ENTRY_SUBURB_TEXT) ? '<span class="inputRequirement">' . ENTRY_SUBURB_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
  }
?>
              <tr>
                <td class="main"><?php echo ENTRY_POST_CODE; ?></td>
                <td class="main"><?php echo tep_draw_input_field('postcode') . '&nbsp;' . (tep_not_null(ENTRY_POST_CODE_TEXT) ? '<span class="inputRequirement">' . ENTRY_POST_CODE_TEXT . '</span>': ''); ?></td>
              </tr>
              <tr>
                <td class="main"><?php echo ENTRY_CITY; ?></td>
                <td class="main"><?php echo tep_draw_input_field('city') . '&nbsp;' . (tep_not_null(ENTRY_CITY_TEXT) ? '<span class="inputRequirement">' . ENTRY_CITY_TEXT . '</span>': ''); ?></td>
              </tr>
              
             <tr>
                <td class="main"><?php echo ENTRY_COUNTRY; ?></td>
                <td class="main"><?php echo tep_get_country_list('country',(($country)?$country:STORE_COUNTRY),'id="country" onchange="javascript:show_state();"') . '&nbsp;' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
              </tr>
              <?php
  					if (ACCOUNT_STATE == 'true') {
					?>
				              <tr>
				                <td class="main"><?php echo ENTRY_STATE; ?></td>
				                <td class="main">
				<?php
				     $zones_array = array();
				     $zones_query = tep_db_query("select zone_id,zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int)(($country)?$country: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']);
				     }
					echo tep_draw_input_field('state','','id="state" '.((count($zones_array)>0)?' style="display:none"':'') );
				    echo tep_draw_pull_down_menu('zone_id', $zones_array,$state,'id="zone_id" '.((count($zones_array)<=0)?' style="display:none"':''));
				    if (tep_not_null(ENTRY_STATE_TEXT)) echo '&nbsp;<span class="inputRequirement">' . ENTRY_STATE_TEXT;
				?>
				                </td>
				              </tr>       
			<?php
			  }
			?>              
            </table></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><b><?php echo CATEGORY_CONTACT; ?></b></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" cellspacing="2" cellpadding="2">
<?php 
  if (ACCOUNT_TELEPHONE=='true') {
?>

              <tr>
                <td class="main" width="160"><?php echo ENTRY_TELEPHONE_NUMBER; ?></td>
                <td class="main"><?php echo tep_draw_input_field('telephone') . '&nbsp;' . (tep_not_null(ENTRY_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
              </tr>
<?php 
  }
  if (ACCOUNT_SECOND_PHONE=='true') {
?>
              <tr>
                <td class="main"><?php echo ENTRY_SECOND_TELEPHONE_NUMBER; ?></td>
                <td class="main"><?php echo tep_draw_input_field('second_telephone') . '&nbsp;' . (tep_not_null(ENTRY_SECOND_TELEPHONE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_SECOND_TELEPHONE_NUMBER_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
 }
?>
             <tr>
                <td class="main"><?php echo ENTRY_MOBILE_NUMBER; ?></td>
                <td class="main"><?php echo tep_draw_input_field('mobile') . '&nbsp;' . (tep_not_null(ENTRY_MOBILE_NUMBER_TEXT) ? '<span class="inputRequirement">' . ENTRY_MOBILE_NUMBER_TEXT . '</span>': ''); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php if(ACCOUNT_NEWSLETTER=='true' || ACCOUNT_RESERVATION_NEWSLETTER=='true' || ACCOUNT_SUBSCRIPTION_NEWSLETTER=='true' || HIDE_CUSTOMER_OCCUPATION_FRONT=='false' || HIDE_CUSTOMER_INTEREST_FRONT=='false') { ?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><b><?php echo CATEGORY_OPTIONS; ?></b></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" cellspacing="2" cellpadding="2">
              <?php if(ACCOUNT_NEWSLETTER=='true'){?>
			  <tr>
                <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>
                <td class="main"><?php echo tep_draw_checkbox_field('newsletter', '1') . '&nbsp;' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
              </tr>
			  <?php }
			  if(ACCOUNT_RESERVATION_NEWSLETTER=='true'){?>
              <tr>
                <td class="main"><?php echo ENTRY_RESERVE_NEWSLETTER; ?></td>
                <td class="main"><?php echo tep_draw_checkbox_field('reserve_newsletter', '1') . '&nbsp;' . (tep_not_null(ENTRY_SECOND_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
              </tr>
			  <?php }
			  if(ACCOUNT_SUBSCRIPTION_NEWSLETTER=='true'){?>
			  <tr>
			  	<td class="main"><?php echo ENTRY_RESERVE_SUBSCRIPTION;?></td>
				<td class="main"><?php echo tep_draw_checkbox_field('subscription_newsletter', '1') . '&nbsp;' . (tep_not_null(ENTRY_NEWSLETTER_TEXT) ? '<span class="inputRequirement">' . ENTRY_NEWSLETTER_TEXT . '</span>': ''); ?></td>
			  </tr>
			  <?php } 
			  if (HIDE_CUSTOMER_OCCUPATION_FRONT=='false') {
			  ?>
			  <tr>
			  	<td class="main"><?php echo ENTRY_OCCUPATION;?></td>
                <td class="main"><?php echo tep_draw_pull_down_menu("occupation",tep_get_customer_options('O')) .'&nbsp;' . (tep_not_null(ENTRY_OCCUPATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_OCCUPATION_TEXT . '</span>': ''); ?></td>
			  </tr>
			  <?php } 
			  if (HIDE_CUSTOMER_INTEREST_FRONT=='false') {
			  ?>
			  <tr>
			  	<td class="main"><?php echo ENTRY_INTEREST;?></td>
                <td class="main"><?php echo tep_draw_pull_down_menu("interest",tep_get_customer_options('I')) .'&nbsp;' . (tep_not_null(ENTRY_INTEREST_TEXT) ? '<span class="inputRequirement">' . ENTRY_INTEREST_TEXT . '</span>': ''); ?></td>
			  </tr>
			  <?php } ?>
            </table></td>
          </tr>
        </table></td>
      </tr>
	  
<!-- //rmh referral start -->
<?php } if (HIDE_REFERRAL_FRONT=='false'){?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><b><?php echo CATEGORY_SOURCE; ?></b></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td class="main" width="160"><?php echo ENTRY_SOURCE; ?></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;' . (tep_not_null(ENTRY_SOURCE_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_TEXT . '</span>': ''); ?></td>
              </tr>
	<?php 
  		if (DISPLAY_REFERRAL_OTHER == 'true') {
	?>
              <tr id="refer_other" style="display:none"> 
                <td class="main"><?php echo ENTRY_SOURCE_OTHER; ?></td>
                <td class="main"><?php echo tep_draw_input_field('source_other') . '&nbsp;' . (tep_not_null(ENTRY_SOURCE_OTHER_TEXT) ? '<span class="inputRequirement">' . ENTRY_SOURCE_OTHER_TEXT . '</span>': ''); ?></td>
              </tr>
<?php
  }
?>
            </table></td>
          </tr>
        </table></td>
      </tr>
	 <?php } ?>
<!-- //rmh referral end -->

      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><b><?php echo CATEGORY_PASSWORD; ?></b></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" cellspacing="2" cellpadding="2">
              <tr>
                <td class="main" width="160"><?php echo ENTRY_PASSWORD; ?></td>
                <td class="main"><table><tr><td><?php echo tep_draw_password_field('password','','onKeyUp=javascript:do_pwd_check(this);') . '&nbsp;' . (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></td></tr></table></td>
              </tr>
              <tr>
                <td class="main"><?php echo ENTRY_PASSWORD_CONFIRMATION; ?></td>
                <td class="main"><?php echo tep_draw_password_field('confirmation') . '&nbsp;' . (tep_not_null(ENTRY_PASSWORD_CONFIRMATION_TEXT) ? '<span class="inputRequirement">' . ENTRY_PASSWORD_CONFIRMATION_TEXT . '</span>': ''); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
<?php
// BOF: Lango Added for template MOD
if (MAIN_TABLE_BORDER == 'yes'){
table_image_border_bottom();
}
// EOF: Lango Added for template MOD
?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
      </tr>
      <tr>
        <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
          <tr class="infoBoxContents">
            <td><table border="0" width="100%" cellspacing="0" cellpadding="2">
              <tr>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                <td><?php echo tep_template_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
                <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></form>
