<?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>             		  |
// +----------------------------------------------------------------------+
?>
<?php 
echo $javascript->link('jquery.js'); 
echo $javascript->link('alphanumeric.js'); 
?>
<script>
function validateForm(thisform)
{
    var i=0;
    var fcs_fld=new Array();
    var errorstr = ''    
    var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";	
    if ($.trim($('#txtCCNumber').val()) == '') { errorstr += "- Please enter Credit Card Number.\n";  fcs_fld[i]='txtCCNumber'; i++;}        
    if ($.trim($('#txtCVV2').val()) == '') { errorstr += "- Please enter Credit Card Validation Code.\n";  fcs_fld[i]='txtCVV2'; i++;}    
    if (errorstr != '')
	{
		msgstr = msgstr + errorstr;
		alert(msgstr);
		$('#'+fcs_fld[0]+'').focus();$('#'+fcs_fld[0]+'').select();
		return false;
	}
	else
	{
		thisform.submit();
		return true;
	}

}
</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 ?>">
					<input type="hidden" name="totaltopay" value="<?php echo $totaltopay ?>">
					<input type="hidden" name="paymentMethod" value="<?php echo $paymentMethod ?>">
				   <div id="admin_heading">Pay Now</div>
				   
				   
				   
				  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent" class="lft-cell01">
                      <p class="maintext_inner">Total to Pay</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell">
                     <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>
				  
				  
				    <?php if($taxamnt > 0 ) { ?>
				   <div id="grid_admin">
                    <div align="left" id="inner_leftcontent" class="lft-cell01">
                      <p class="maintext_inner">Tax</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell">
                     <span class="toplinks">
						
                       <p class="maintext_inner"><?php			
									                $taxamnt = number_format($taxamnt,2,".","");
												  	echo $curlogo;echo "&nbsp;";echo  $taxamnt; ?></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>
				  <?php } ?>
				  
				   <?php if($discount > 0 ) { ?>
				   <div id="grid_admin">
                    <div align="left" id="inner_leftcontent" class="lft-cell01">
                      <p class="maintext_inner">Promocode Discount</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell">
                     <span class="toplinks">
						
                       <p class="maintext_inner"><?php			
								                $discount = number_format($discount,2,".","");
											  	echo $curlogo;echo "&nbsp;";echo  $discount; ?></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>
				  <?php } ?>
				  
				  
				  
				  
				   <?php if($shipping_cost > 0 ) { ?> 
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent" class="lft-cell01">
                     <p class="maintext_inner"> Total Shipping Cost</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell">
                      <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>
				  <?php } ?>
				  
			<?php 
                   if($session->check('GiftCardDiscount')) { ?>
                   
				    <div id="grid_admin">
                    <div align="left" id="inner_leftcontent" class="lft-cell01">
                      <p class="maintext_inner">Gift Card Discount</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell">
                     <span class="toplinks">
						
                       <p class="maintext_inner">
					   <?php
                                        $giftcardamtdetails =   $session->read('GiftCardDiscount');
                                        $giftcardamt       = $giftcardamtdetails['GiftcardDetail']['balance'];
			                $giftcardamt = number_format($giftcardamt,2,".","");
						  	echo $curlogo;echo "&nbsp;";echo  $giftcardamt; 
                                                        
                                        //$gtotal = $gtotal-  $giftcardamt;               
                                     ?>	
                        </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>
		<?php  } ?>	  
				  
				  
				  
				  
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent" class="lft-cell01">
                      <p class="maintext_inner">Grand Total</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell">
                     <span class="toplinks">
						 <p class="maintext_inner"><input type="hidden" name="cart_total" value="<?php echo $gtotal;?>">
												<?php 				
												echo $curlogo;
												echo "&nbsp;";
												echo $gtotal;
												?></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" class="lft-cell01">
                      <p class="maintext_inner">Card Number</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell" style="margin-top:8px; margin-bottom:8px">
                     <span class="toplinks">
						<input type=text name="txtCCNumber" id="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" class="lft-cell01">
                      <p class="maintext_inner">Card Validation Code</p>
                    </div>
                    <div align="right" id="inner_rightcontent" class="ryt-cell" style="margin-top:8px; margin-bottom:8px">
                      
					  <span class="toplinks">
						<input type="text" name="txtCVV2" id="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" class="lft-cell01">
                      <p class="maintext_inner">Expiration Date :(MM/YYYY)</p>
                    </div>
					 
                    <div align="right" id="inner_rightcontent" class="ryt-cell" style="margin-top:8px; margin-bottom:8px">
                      <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" style="margin-bottom:15px">
				<div align="left" id="inner_leftcontent" class="lft-cell01">
				  <p class="maintext_inner">&nbsp;</p>
				</div>
				<div align="right" id="inner_rightcontent" class="ryt-cell">
					<span class="toplinks">		
					
													<input type="button"  name="btnCompleteOrder" value="Pay Now" onclick="return validateForm(document.frmPayment);" class="btn-usr01">
					
					</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>
			