<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com � 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "../includes/config.php";
include "../includes/session.php";
include "../includes/functions.php";
include_once "../includes/arrays.inc.php";

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}

$sql2 = "SELECT approve_affiliates FROM ".$tableprefix."settings "	;
		$res2 = mysql_query($sql2);
		if(mysql_num_rows($res2)!= 0){
			$rw = mysql_fetch_array($res2);
			$afiliateapproval=$rw["approve_affiliates"];
			if($afiliateapproval==1)
			{ // if approval is automatic then set Staus =Y
				$txtapproveafiliates="Y";
			} // end if 
			else
			{ // if seller is not 
				$txtapproveafiliates="NN";
			} //end else	
			
}

$txtUserName = $_POST["txtUserName"];
$txtFirstName = $_POST["txtFirstName"];
$txtLastName = $_POST["txtLastName"];
$txtAddress1 = $_POST["txtAddress1"];
$txtAddress2 = $_POST["txtAddress2"];
$txtCity 	 = $_POST["txtCity"];
/*$txtState = $_POST["txtState"];
$ddlCountry = $_POST["ddlCountry"];*/

 $txtState = $_POST["bill_state"];
 $ddlCountry = $_POST["bill_country"];

$txtZIP = $_POST["txtZIP"];
$txtEmail = $_POST["txtEmail"];
$txtPhone = $_POST["txtPhone"];
$txtFAX = $_POST["txtFAX"];
$txtPassword = $_POST["txtPassword"];
$txtConfirmPassword = $_POST["txtCnfPassword"];
$txtTaxId = $_POST["txtTaxId"];

$registered= false;
if ($_POST["txtUserName"]){
    $message = "" ;
    if (!isNotNull($txtUserName)) {
        $message .= VAL_MSG_UNAME;
    } else {
        $qry = "SELECT  LOWER(affiliate_name) FROM  " . $tableprefix . "affiliates WHERE affiliate_name='" . strtolower(addslashes($txtUserName)) . "' ";
        if (mysql_num_rows(mysql_query($qry)) > 0) {
            $message .= VAL_MSG_UNAME_EXIST;;
        }
    }
   /* if (!isValidUsername($txtUserName)) {
        $message .= VAL_MSG_INVALID_UNAME;
    }*/
    if (!isNotNull($txtPassword)) {
        $message .= VAL_MSG_PASS_EMP;
    }
	if (!isNotNull($txtConfirmPassword)) {
        $message .= VAL_MSG_CPASS_EMP;
    }
    if (strcmp($txtPassword, $txtConfirmPassword) != 0) {
        $message .= VAL_MSG_PASS_MISS;
    }

	if (!isNotNull($txtFirstName)) {
        $message .= VAL_MSG_FIRST_NAME;
    }
    if(is_numeric($txtFirstName)){
        $message .= VAL_MSG_FNAME_NUM;
    }
    if(is_numeric($txtLastName)){
        $message .= VAL_MSG_LNAME_NUM;
    }
	if (!isNotNull($txtAddress1)) {
        $message .=VAL_MSG_ADDR_NAME;
    }
	if (!isNotNull($txtCity)) {
        $message .= VAL_MSG_CITY;
    }
	if (!isNotNull($txtState)) {
        $message .= VAL_MSG_STATE;
    }
	if(isNotNull($txtPhone))
	{ 
		if(!check_phone($txtPhone,$ddlCountry))
		{
		 $message .= VAL_MSG_PHONE;
		}
	}
	/*if(isNotNull($txtFAX))
	{
		if(!check_fax($txtFAX))
		{
		 $message .= "* Fax number should be valid!";
		}
	} */
	if (!isNotNull($txtEmail)) {
        $message .= VAL_MSG_EMAIL;
    }
	 else{
		if (!isValidEmail($txtEmail)) {
	        $message .= VAL_MSG_INVALID_MAIL;
	    }
	}

    $qry2 = "select email from  " . $tableprefix . "affiliates where email='" . addslashes($txtEmail) . "'";
    if (mysql_num_rows(mysql_query($qry2)) > 0) {
        $message .= "* The email address '".htmlentities($txtEmail)."' is already in use!. <br>";
    }

    if ($message != "") { // error
        $message = VAL_MSG_PLS_CORRECT . $message;
    } else { // no error so insert user details
		$sql = "INSERT INTO ".$tableprefix."affiliates (
			affiliate_name ,
			password,
			first_name,
			last_name,
			address1,
			address2,
			city,
			state,
			country,
			phone,
			fax,
			zip,
			email,
			date_registered,
			vapproved
			) VALUES (
			'".addslashes($txtUserName)."',
			'".addslashes(md5($txtPassword))."',
			'".addslashes($txtFirstName)."',
			'".addslashes($txtLastName)."',
			'".addslashes($txtAddress1)."',
			'".addslashes($txtAddress2)."',
			'".addslashes($txtCity)."',
			'".addslashes($txtState)."',
			'".addslashes($ddlCountry)."',
			'".addslashes($txtPhone)."',
			'".addslashes($txtFAX)."',
			'".addslashes($txtZIP)."',
			'".addslashes($txtEmail)."',
			now(),
			'".addslashes($txtapproveafiliates)."'
			)";
		mysql_query($sql);
		$userid = mysql_insert_id();
		$message = "" ;
		$_SESSION["sess_affiliateid_new"] = $userid;
		
		$userfullname = $txtFirstName;
		if($txtLastName != ""){
			$userfullname .= " ". $txtLastName;
		}
		$to = $txtEmail;
		
/*---------Multicart 2.0 Upgradation------------*/		
		$subject = MAIL_AFFILIATE_ACCOUNT_SUBJECT_1." ".stripslashes(SITE_NAME);
		
/*-------Email Template Reading Fuction Call--------*/				
				
		$mailcontent = readEmailTemplate('affiliate_registration','affiliates');
				
		$mailcontent = str_replace('[user_name]',$txtUserName,$mailcontent);					
		$mailcontent = str_replace('[password]',$txtPassword,$mailcontent);			
		
/*---------------Affiliate Login Url-------------------*/			
		
		
		if($afiliateapproval==3)
		{ // check if seller approval is through Email - Activation 
			$userid=base64_encode($userid);;
			$mailcontent.="\r\n"."<b>".MAIL_AFFILIATE_ACCOUNT_LINK_NOTE."</b>\r\n\n";
			$mailcontent.="\r\n"."<a href=".SITE_URL."/afiliates_activation.php?aid=$userid&status='Y'>".MAIL_AFFILIATE_ACCOUNT_LINK."</a>\r\n\n";
		
		} // end email activation check 
		if($afiliateapproval==1)
		{
		$mailcontent .= "\r\n".MAIL_PLAN_PURCHASE_TEXT_CLICK."&nbsp;<a href=".SITE_URL."/affiliates/login.php>".MAIL_PLAN_PURCHASE_TEXT_HERE."</a> ".MAIL_PLAN_PURCHASE_TEXT_TO_LOGIN."\r\n\n";
		}
		if($afiliateapproval==2)
		{
		$mailcontent .= "\r\n".MAIL_AFFILIATE_ACCOUNT_ACTIVATION_NOTE."\r\n\n";
		}
		
		
/*---------------Seller Login Url-------------------*/		
		
		/*$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Reply-To: ".SITE_NAME."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Return-Path: ".SITE_NAME."<noreply@".SITE_EMAIL.">" . "\r\n";*/
		
//********************HEADERS*************************
$headers  = "MIME-Version: 1.0" . "\r\n";
$headers .= "Reply-To: ".SITE_NAME."<".SITE_EMAIL.">" . "\r\n";
$headers .= "Return-Path:  ".SITE_NAME."<noreply@".SITE_EMAIL.">" . "\r\n";
$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
$headers .= "Organization: ".SITE_NAME."\r\n"; 
$headers .= "Content-Type: text/html\r\n"; 
//**************************************************** 
		
		$mailcontent = nl2br($mailcontent);
				
		
		$mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title >'.SITE_NAME.'</title>
  <link href="./themes/'. $active_template[4].' rel="stylesheet" type="text/css">
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';
		
		$mailsent = mail($to, $subject, $mail_send_details, $headers);
		
/************************** End send mail to the new affiliate *****************/

// **********************************************************************Send Mail To Administrator 
		
		
		$subject_admin = MAIL_AFFILIATE_ACCOUNT_REGISTRATION_SUBJECT." ".SITE_NAME;
		
/*-------Email Template Reading Fuction Call--------*/				
				
		$mailcontent_admin = readEmailTemplate('affiliate_registration_admin','affiliates');
		
		$mailcontent_admin = str_replace('[user_name]',$txtUserName,$mailcontent_admin);			
				
		$mailcontent_admin = str_replace('[password]',$txtPassword,$mailcontent_admin);	
		
		$mailcontent_admin = str_replace('[seller_first_name]',$_POST['txtFirstName'],$mailcontent_admin);		
					
		$mailcontent_admin = str_replace('[seller_last_name]',$_POST['txtLastName'],$mailcontent_admin);	
		
/*---------------User Login Url-------------------*/			
		
		$mailcontent_admin .= "\r\n";
		$mailcontent_admin .= "\r\n".MAIL_PLAN_PURCHASE_TEXT_CLICK."&nbsp;<a href=".SITE_URL."/admin/login.php>".MAIL_PLAN_PURCHASE_TEXT_HERE."</a> ".MAIL_AFFILIATE_ACCOUNT_TO_LOGIN_TO_VIEW_DETAILS."\r\n\n";
				
/*---------------User Login Url-------------------*/							
		
		$from= "From: ".SITE_EMAIL."\n";
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Reply-To: ".SITE_NAME."<".SITE_EMAIL.">" . "\r\n";
		$headers .= "Return-Path: ".SITE_NAME."<".SITE_EMAIL.">"."\r\n"; 
		$headers .= "Organization: ".SITE_NAME."\r\n";
		
		$mailcontent_admin = nl2br($mailcontent_admin);
				
		
		
		
				 $mail_send_details_admin = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title >'.SITE_NAME.'</title>
  <link href="./themes/'. $active_template[4].' rel="stylesheet" type="text/css">
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent_admin.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';
		
		
		$adminemail	=getSettingsValue('site_email');

		
		$mailsent = mail($adminemail, $subject_admin, $mail_send_details_admin, $headers);
                
                
               
/*-------function call to manage the different sessions--------*/

		
		
		
		
		
/*---------Multicart 2.0 Upgradation------------*/				
		
		/*$mailmessage = MAIL_ORDER_TEXT_DEAR." $userfullname,\r\n<br>";
		$mailmessage .= "Thank you for registering with  ".stripslashes(SITE_NAME)."\r\n\n<br><br>";
		$mailmessage .= "Your affiliate account details are as follows:\r\n<br>";
		$mailmessage .= "User Name:\t$txtUserName\r\n<br>";
		$mailmessage .= "Password:\t$txtPassword\r\n\n<br><br>";
		$mailmessage .= "Thank you once again for your interest in ".stripslashes(SITE_NAME)."\r\n\n<br>";
		$mailmessage .= MAIL_SUBSCRIPTION_REMINDER_END.", \r\n<br>";
		$mailmessage .= "Administrator,\r\n\n ".stripslashes(SITE_NAME)."\r\n\n<br><br>";
		$headers  = "MIME-Version: 1.0\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
		$headers .= "From: ".SITE_EMAIL." <".SITE_EMAIL.">\r\n";
		$mailsent = mail($to, $subject, $mailmessage, $headers);
		$message = "Registration successfully completed! Please <a class=\"links\" href='login.php'><b>login here.</b></a>";*/

                
		/*-------function call to manage the different sessions--------*/

		manageSession(4);
		$_SESSION["sess_affiliatename"] = '';
		$_SESSION["sess_affiliateid"]   = '';
                
		if($afiliateapproval==1)
		{ // set for Autonmatic Aproval 
		
		$_SESSION["sess_affiliatename"] = $txtUserName;
		$_SESSION["sess_affiliateid"] = $userid;						
		header("Location:".SITE_URL."/affiliates/affiliatemain.php");
		exit;
		} // end if 
		
		if($afiliateapproval==3)
		{ // Aproval After Email Confirmation 
		header("Location:validate.php?approval=3");
		exit;
		} // end if 
		if($afiliateapproval==2)
		{ // Aproval After Email Confirmation 
		header("Location:validate.php?approval=2");
		exit;
		} // end if 
		
		
					
/*---------------Multicart 2.0 Upgradation------------------*/				
				

				
/*---------------Multicart 2.0 Upgradation------------------*/										
					

		$txtUserName = "";
	    $txtFirstName = "";
	    $txtLastName = "";
	    $txtAddress1 = "";
	    $txtAddress2 ="";
	    $txtCity = "";
	    $txtState = "";
	    $ddlCountry ="";
	    $txtZIP = "";
	    $txtEmail ="";
		$txtPhone = "";
		$txtFAX ="";
		$txtPassword = "";
		$txtConfirmPassword = "";
		$txtTaxId = "";
		$registered= true;
    }
}
$adminCurrency	= GetAdminCurrency();

$txtCurrency = $adminCurrency['currency_code'];
$deafultCountry  = $currencyBasedCountries[$txtCurrency];
$countrylist = makeCountryList();

include "../includes/htmltop.php";
?>
<script type="text/javascript">
    defaultCountryCode = '<?php echo $deafultCountry;?>';            
</script>
<script src="../js/registration_ajax.js"></script>
<script src="../js/javascript_check_userside.js"></script>

<script>
function checkUserRegisterForm()
{
  var form_name = new Array('txtUserName','txtPassword','txtCnfPassword','txtFirstName','txtLastName','txtAddress1','txtCity','bill_state','txtPhone','txtEmail');
  var display_name = new Array('User Name','Password','Confirm Password','First Name','Last Name','Address1','City','State','Phone','Email');
  var count = 10;	
  var email           = document.frmRegister.txtEmail.value;
  
  
  
  if(check_fieldsUser('frmRegister',form_name,display_name,count))	
  {
      
    	if(email != '')
        {
            if(!echeck(email))
            {
                return false;
            }
        }
	 showListAffiliateRegistration(document.frmRegister.txtUserName.value,document.frmRegister.txtEmail.value);	
   
  }
  else
  {
  
  		return false;
  
  }
   
}


function init() {
document.getElementById('txtUserName').focus();
}
window.onload = init; 

</script>

	<link href="<?php echo $site_url; ?>/themes/<?php echo $active_template[4] ?>" rel="stylesheet" type="text/css">
	<link href="<?php echo $site_url; ?>/themes/responsive/css/commonstyle.css" rel="stylesheet" type="text/css">
	<link href="<?php echo $site_url; ?>/themes/responsive/css/bootstrap.min.css" rel="stylesheet" type="text/css">
	<link href="<?php echo $site_url; ?>/themes/responsive/css/bootstrap.css" rel="stylesheet" type="text/css">
	<link href="<?php echo $site_url; ?>/style/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css">
	<link href="<?php echo $site_url; ?>/style/bootstrap-modal.css" rel="stylesheet" type="text/css">
	<link href="<?php echo $site_url; ?>/themes/responsive/css/font-awesome.css" rel="stylesheet" type="text/css">
	<link href="<?php echo $site_url; ?>/themes/responsive/css/font-awesome.min.css" rel="stylesheet" type="text/css">
	
	<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
	<script type="text/javascript" language="javascript" src="<?php echo $site_url; ?>/themes/responsive/js/bootstrap.js"></script>
	<script type="text/javascript" language="javascript" src="<?php echo $site_url; ?>/themes/responsive/js/bootstrap.min.js"></script>
	<script type="text/javascript" language="javascript" src="<?php echo $site_url; ?>/js/bootstrap-modalmanager.js"></script>
	<script type="text/javascript" language="javascript" src="<?php echo $site_url; ?>/js/bootstrap-modal.js"></script>
	<script type="text/javascript" language="javascript" src="<?php echo $site_url; ?>/themes/responsive/js/responsivemobilemenu.js"></script>
	<script type="text/javascript" language="javascript" src="<?php echo $site_url; ?>/themes/responsive/js/responsive-tables.js"></script>


<body>
		
		<center>
		
		<div align="left" id="layout">
				<!--header area start -->
					<?php
						include_once("../includes/topheader_affiliate.php")
					?>
				<!--header area end -->
				<div align="left" class="main_body">
				<!--main body start -->
					<?php
						//include_once("../includes/afftopmenu.php")
					?>		
					<div class="col-sm-12 col-lg-4 col-md-4"></div>
					<div class="col-sm-12 col-lg-4 col-md-4">
						<div class="text_information" align="center"><?php echo $message;?></div>						
                                                <div class="clear"></div>
						<div class="form_wrapper">
							<div class="register_form_outer">
								<div class="registrationform_container">
									<h3><?php echo TEXT_AFFL_REG;?></h3>
									<form name="frmRegister" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"], ENT_QUOTES, 'UTF-8')?>" method="POST">
									
										<!-- The id of the country field(s).  If more than one, seperate with spaces -->
										<input type="hidden" value="billCountrySelect" name="cs_config_country_field" id="cs_config_country_field">
										<input type="hidden" value="billStateSelect" name="cs_config_state_field"   id="cs_config_state_field">
						
										<!-- The id of the the fields holding the default values.  If more than one, seperate with spaces -->
										<input type="hidden" value="billCountryDefault" name="cs_config_country_default" id="cs_config_country_default">
										<input type="hidden" value="billStateDefault"   name="cs_config_state_default"   id="cs_config_state_default">
										<!-- The actual default values -->
                                                                                <?php 
                                                                                        if($_POST['bill_country']!=NULL){
                                                                                            $countryCode = $_POST['bill_country'];
                                                                                        }else{
                                                                                            $countryCode = $deafultCountry;
                                                                                        } 
                                                                                ?>
										<input type="hidden" value="<?PHP ECHO $countryCode?>" name="billCountryDefault" id="billCountryDefault">
										<input type="hidden" value="<?php echo $txtState;?>"   name="billStateDefault"   id="billStateDefault">
										<script type="text/javascript" src="../js/country-state.js"></script>
											<?php
											 if(!$registered)
											 {
											?>
										<div class="sellerreg_styles">
											<div class="field_wrapper formfield_row">
												<div class="createacc_link">
													<p>
														<span class="required">*</span> <?php echo MSG_FIELD_MANDATORY;?>
													</p>
												</div>	
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_USER_NAME;?> <span class="required">*</span></label>
												<input class="form-control" type="text" value="<?php echo htmlentities($txtUserName);?>" name="txtUserName" id="txtUserName"  maxlength="100">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_PASS;?> <span class="required">*</span></label>
												<input type="password" value="" class="form-control" name="txtPassword"   maxlength="30" >
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_CONF?><?php echo TEXT_PASS;?> <span class="required">*</span></label>
												<input type="password" class="form-control" value="" name="txtCnfPassword"   maxlength="30">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_FIRST_NAME;?> <span class="required">*</span></label>
												<input type="text" class="form-control" value="<?php echo htmlentities($txtFirstName);?>" name="txtFirstName"   maxlength="100">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_LAST_NAME;?> <span class="required">*</span></label>
												<input type="text" class="form-control" value="<?php echo htmlentities($txtLastName);?>" name="txtLastName"   maxlength="100">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_ADDR1;?> <span class="required">*</span></label>
												<input class="form-control" type="text" value="<?php echo htmlentities($txtAddress1);?>" name="txtAddress1"   maxlength="100">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_ADDR2;?></label>
												<input class="form-control" type="text" value="<?php echo htmlentities($txtAddress2);?>" name="txtAddress2"   maxlength="100">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_CITY;?> <span class="required">*</span></label>
												<input class="form-control" type="text" value="<?php echo htmlentities($txtCity);?>" name="txtCity"   maxlength="100">
											</div>
											<!--<div class="field_wrapper formfield_row">
												<label>Country</label>
												<?php 
                                                                                                if($_POST['bill_country']!=NULL){
                                                                                                    $countryCode = $_POST['bill_country'];
                                                                                                }else{
                                                                                                    $countryCode = 'US';
                                                                                                } 
                                                                                                echo makeDropDownList("ddlCountry", $countrylist, $countryCode, false, "textarea", $properties, $behaviors)?>
											</div>-->
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_COUNTRY;?> <span class="required">*</span></label>
												<select id='billCountrySelect' class='form-control' name='bill_country' onchange='updateState(this.id)' style="width:100%;"></select>
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_STATE;?> <span class="required">*</span></label>
												<!--<input class="textarea" type="text" value="<?php echo htmlentities($txtState);?>" name="txtState"   maxlength="100">-->
												<select id='billStateSelect' name='bill_state' class='form-control' style="width:100%;"></select>
												<script type="text/javascript">initCountry(); </script>
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_ZIP;?></label>
												<input type="text" value="<?php echo htmlentities($txtZIP);?>" name="txtZIP"   maxlength="20" class="form-control">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_PHONE;?> <span class="required">*</span></label>
												<input type="text" value="<?php echo htmlentities($txtPhone);?>" name="txtPhone"   maxlength="100" class="form-control">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_FAX;?></label>
												<input type="text" value="<?php echo htmlentities($txtFAX);?>" name="txtFAX"   maxlength="100" class="form-control">
											</div>
											<div class="field_wrapper formfield_row">
												<label><?php echo TEXT_EMAIL;?>&nbsp;<span class="required">*</span></label>
												<input type="text" value="<?php echo htmlentities($txtEmail);?>" name="txtEmail"   maxlength="100" class="form-control">
											</div>
											<!--<div class="field_wrapper formfield_row">
												<label>Tax Id</label>
												<input type="text" value="<?php echo htmlentities($txtTaxId);?>" name="txtTaxId"   maxlength="100" class="textarea">
											</div>-->
											<div class="field_wrapper formfield_row">
												<input type="reset" name="reset" value="<?php echo BTN_RESET;?>" class="login_btn">
												<input type="submit" value="<?php echo BTN_REG;?>" name="btnRegister" class="login_btn" onClick="return checkUserRegisterForm();">
											</div>
											<div class="clear"></div>
										</div>
										<?php 
											}
											else
											{
										?>
										<div class="text_information grey_trtext_information grey_tr" align="center"><?php echo $message;?></div>
										<?php 
										}
											?>
									</form>
								<div class="clear"></div>
								</div>
							</div>
						</div>
					</div>
					<div class="col-sm-12 col-lg-4 col-md-4"></div>
				<div class="clear"></div>
				</div>
		<?php
			include "../includes/footer.php";
		?>
		
		