<?php

// Check to ensure this file is included in Freeway!
defined('_FEXEC') or die();
 include('includes/general.js');
include('includes/password_strength.js.php');
echo tep_draw_form('affiliate_details', tep_href_link(FILENAME_AFFILIATE_DETAILS, '', 'SSL'), 'post', 'onSubmit="return check_form(this);"') . tep_draw_hidden_field('action', 'process'); ?><table border="0" width="100%" cellspacing="0" cellpadding="<?php echo CELLPADDING_SUB; ?>">
<?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 colspan="2" >	
				<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td class="infoBoxHeadingpage" valign="middle"><?php echo tep_template_image('arrow_1.gif','','align="absmiddle"') . '&nbsp;' .  HEADING_TITLE;?></td>
					</tr>
				</table>			
			</td>
		</tr>	

      <tr>
        <td>
<?php
  require(DIR_WS_MODULES . 'affiliate_account_details.php');
?>
        </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 align="right" class="main"><br><?php echo tep_template_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
      </tr>
    </table></form>
	  <script language="javascript">
	  do_action();
   function show_state(){
		var this_=document.getElementById("a_country");
		id=this_.options[this_.selectedIndex].value;
		var qry_str="";
		if(id){
			command="<?php echo tep_href_link(FILENAME_AFFILIATE_DETAILS,'command=show_state','SSL',true,false);?>&country_id="+id;
			do_get_command(command);	
		}
	} 
	function do_result(result){
	//alert(result);
	 if(result!='' && result.substr(result.indexOf('show_state'),10)=='show_state'){
	   result=result.substr(result.indexOf('show_state')+10,result.length);
	   var textArr=new Array();
		var valueArr=new Array();
		splt=result.split("^");
		valueArr=splt[0].split(",");		
		textArr=splt[1].split(",");
		var sel=document.getElementById("a_state");		
		var sta1=document.getElementById("a_state1");
		if(valueArr.length==1) {
			if(sta1) sta1.style.display="";
			if(sel)sel.style.display="none";
		}else {
			if(sta1) {
				sta1.style.display="none";	
				sta1.value="";
			}
			if(sel)sel.style.display="";
			optionElement=sel;
			// clear the previous details
			while(optionElement.options.length>0){
				optionElement.remove(optionElement.options.length - 1);
			}
			//create the new details
			for (icnt=0;icnt<textArr.length;icnt++){
			  var option = document.createElement('option');
			  option.text = textArr[icnt];
			  option.value = valueArr[icnt];
			 
			  try {
				optionElement.add(option, null); // standards compliant; doesn't work in IE
			  }
			  catch(ex) {
				optionElement.add(option); // IE only
			  }
			}
			if(typeof(default_zone) != "undefined")
			for(i=0;i<optionElement.options.length;i++){
				if(optionElement.options[i].value==default_zone)
					optionElement.options[i].selected = true;
			}
			if(document.getElementById("a_state1") && typeof(default_country) != "undefined")
			if(default_country!=document.getElementById("country"))
				document.getElementById("a_state1").value="";
		}
	  }	 
	}
  </script>

