<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: 			*/
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004-2010 ARMIA INC                                    |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts VistaCart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson<jipson.thomas@armiasystems.com>             		  |
// +----------------------------------------------------------------------+
?>
<script language="javascript" >
	function validateForm(){
		var frm = window.document.frmPayment;
		var d = new Date();
		var curr_year = d.getFullYear();
		
		if (frm.txtCCType.value.length == 0 ) {		    
			alert('Please Select a Card type!');
			frm.txtCCType.focus();
			return false;
		}
		else if (frm.txtCCHolder.value.length == 0 ) {
			alert('Please enter your name on Card!');
			frm.txtCCHolder.focus();
			return false;
		}
		else if (frm.txtCCNumber.value.length == 0 ) {
			alert('Please enter a valid credit card number!');
			frm.txtCCNumber.focus();
			return false;
		}
		else if (frm.txtCVV2.value.length == 0 ) {
			alert('Please enter the Verification Code!');
			frm.txtCVV2.focus();
			return false;
		}
		else if (frm.txtMM.value.length == 0 || frm.txtYY.value.length == 0 || frm.txtYY.value < curr_year || frm.txtMM.value > 12 ) {
			alert('Please enter a valid credit card expiry date!');
			frm.txtMM.focus();
			return false;
		}else{
			return true;
		}
	}
	function onlyNumeric(){
		if (event.keyCode<48||event.keyCode>57)
		return false;
	}
	function checkNumber(t) {
		if(t.value.length == 0 ||  isNaN(t.value) || t.value.substr(0,1) == " " || parseInt(t.value) < 0) {
			t.value="";
		}
	}
</script>
            <div align="center" class="subheading">
              <div align="left">Checkout</div>
            </div>
            <br />
            <div align="left" id="item_details_admin">
              <!--items display area start -->
              <div align="center" id="items_display_area_admin">
                <div align="left" class="inner_content_area_admin">
				<?php $session->flash(); ?>
               <form action="" method="post" name="frmPayment" >
			   <input type="hidden" name="userid" value="<?php echo $userid ?>">
				   <div id="admin_heading">Pay Now</div>
				  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Total to Pay</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                     <span class="toplinks">
						
                       <p class="maintext_inner"><?php
			
			$display_total = number_format($totaltopay,2,".","");
			
			echo $curlogo;
			echo "&nbsp;";
			echo $display_total;
			?></p>
                        </span>
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                     <p class="maintext_inner"> Total Shipping Cost</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                      <span class="toplinks">
						<p class="maintext_inner"><?php 				
			echo $curlogo;
			echo "&nbsp;";
			echo $shipping_cost;
			?></p>
                        </span>
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Grand Total</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                     <span class="toplinks">
						 <p class="maintext_inner"><input type="hidden" name="cart_total" value="<?php echo $display_total + $shipping_cost;?>">
			<?php 				
			echo $curlogo;
			echo "&nbsp;";
			echo $display_total + $shipping_cost;
			?> </p>
                      
                        </span>
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                       <p class="maintext_inner">Card Type</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                      <span class="toplinks">
						<select name="txtCCType" class="box2_admin">
		<option value=''>------- Select -------</option>
		<option value='American Express'>American Express</option>
		<option value='Visa Card'>Visa Card</option>
		<option value='Master Card'>Master Card</option>
		</select>	
                      
                        </span>
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Name on card</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                     <span class="toplinks">
						<input type=text name="txtCCHolder" maxlength="16" class="box2_admin" size="27">
                      
                        </span>
					
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Card Number</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                     <span class="toplinks">
						<input type=text name="txtCCNumber" maxlength=16  class="box2_admin" size="27">
                      
                        </span>
					
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Card Validation Code</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                      
					  <span class="toplinks">
						<input type="text" name="txtCVV2" maxlength="10" class="box2_admin" size="27">
                      
                        </span>
						
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Expiration Date :(MM/YYYY)</p>
                    </div>
					 
                    <div align="right" id="inner_rightcontent">
                      <span class="toplinks">
					   <select name="txtMM" class="box2_admin" style="width:50px;">
						<?php 
						for($mnth=1;$mnth<=12;$mnth++){		
						if($mnth < 10){
						$mnth	=	'0'.$mnth;
						}					
						?>
						<option value="<?php echo $mnth; ?>"><?php echo $mnth; ?></option>
						<?php }  ?>
						</select>
						/
						<select name="txtYY" class="box2_admin"  style="width:75px;">
						<?php 
						$pyear	=	date("Y");
						$nyr	=	$pyear + 25;
						for($year=$pyear;$year<=$nyr;$year++){							
						?>
						<option value="<?php echo $year; ?>"><?php echo $year; ?></option>
						<?php }  ?>
						</select>
                        </span>
                    </div>
                 
					
			   <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
                  </div>
                  <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
				  
                 <div id="admin_bottom">
				<div align="left" id="inner_leftcontent">
				  <p class="maintext_inner">&nbsp;</p>
				</div>
				<div align="right" id="inner_rightcontent">
					<span class="toplinks">		
					
					<input type="submit"  name="btnCompleteOrder" value="Pay Now" onclick="return validateForm();" class="buttn_admin">
					
					</span>
				</div>
				<div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif', array('width' => 1, 'height' => 1));?></div>
			</div>
                </div>
				
                <!--form area end -->
				</form>
              </div>
              <div align="left" class="float_clear1"></div>
            </div>
            <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
			