<?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" type="text/javascript">
function chk(){
	var errorstr = '';
	var msgstr = "Sorry, we cannot complete your request.\nKindly provide us the missing or incorrect information enclosed below.\n\n";
	var checked = false; 
	var buttons = document.shipmethod.ship_method; 
	var radio = document.shipmethod.ship_method; 
		if("undefined"==typeof(radio.length) )
	   {
		 if(radio.checked)
		  return radio.value;
		}else{
			for (var i=0; i<buttons.length; i++)  
			{  
				if (buttons[i].checked) {  
					checked = true; 
					break;  
				}  
			} 
		}
		<?php if(empty($shipopt)){?>
		checked = true; 
		<?php } ?>
		if(!checked) {
			errorstr += "- Please Select any shipping option.\n";
		}	
		if (errorstr != '')
		{
			msgstr = msgstr + errorstr;
			alert(msgstr);
			return false;
		}
		else
		{
			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 name="shipmethod" id="shipmethod" action="<?php echo $html->url('/carts/payment');?>" method="post">
			
                  <?php if($prodtype <> "Digital") { ?>
				   <div id="admin_heading">Shipping Address</div>
				  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Name</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                     <span class="toplinks">
						
                       <p class="maintext_inner"><?php echo $shipadd["UserAddress"]["fname"]." ".$shipadd["UserAddress"]["lname"];?></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">Address</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                      <span class="toplinks">
						<p class="maintext_inner">
						
						<?php 
						 if(isset($shipadd["UserAddress"]["address"]) && $shipadd["UserAddress"]["address"] <> '')
						  { 
						   echo $shipadd["UserAddress"]["address"].' ,<br/>';
						  } 
						  if(isset($shipadd["UserAddress"]["city"]) && $shipadd["UserAddress"]["city"] <> '')
						  { 
						   echo $shipadd["UserAddress"]["city"].' ,<br/>';
						  } 
						  if(isset($shipadd["UserAddress"]["state"]) && $shipadd["UserAddress"]["state"] <> '')
						  { 
						   echo $shipadd["UserAddress"]["state"].' ,<br/>';
						  } 
						  if(isset($shipadd["UserAddress"]["country_name"]) && $shipadd["UserAddress"]["country_name"] <> '')
						  { 
						   echo $shipadd["UserAddress"]["country_name"].' ,<br/>';
						  } 
						  if(isset($shipadd["UserAddress"]["zip"]) && $shipadd["UserAddress"]["zip"] <> '')
						  { 
						   echo 'Postal Code : '.$shipadd["UserAddress"]["zip"].'<br/>';
						  } 
						  ?>		
						
						</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(isset($shipadd["UserAddress"]["phone"]) && $shipadd["UserAddress"]["phone"] <> '')
				  {?>				   
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Phone</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                     <span class="toplinks">
						<p class="maintext_inner"><?php echo $shipadd["UserAddress"]["phone"]; ?></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(isset($shipadd["UserAddress"]["fax"]) && $shipadd["UserAddress"]["fax"] <> '')
				  {?>		
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Fax</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                     <span class="toplinks">
						<p class="maintext_inner"><?php echo $shipadd["UserAddress"]["fax"]; ?></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(isset($shipadd["UserAddress"]["mobile"]) && $shipadd["UserAddress"]["mobile"] <> '')
				  {?>		
                  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner">Mobile</p>
                    </div>
                    <div align="right" id="inner_rightcontent">
                      
					  <span class="toplinks">
						<p class="maintext_inner"><?php echo $shipadd["UserAddress"]["mobile"]; ?></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 } ?> 
				  
				  
				  <div id="grid_admin">
                    <div align="left" id="inner_leftcontent">
                      <p class="maintext_inner"> Shipping Method</p>
                    </div>
					 <?php 
			if(!empty($shipopt)){
				foreach($shipopt as $meth){
			 ?>
                    <div align="right" id="inner_rightcontent">
                      <span class="toplinks">
					   <p class="maintext_inner">
						<input type="radio" name="ship_method" value="<?php echo $shippingmethod.'-***-'.$meth['title'].'-***-'.$meth['cost'];?>">
                       <?php echo $meth['title'].'- $'.$meth['cost'];?></p>
                        </span>
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
					 <?php 
				  }
			  ?>
			   <?php }else { ?>
					<?php if($shippingmethod == "Flat Rate Shipping"){ ?>
					 <div align="right" id="inner_rightcontent">
                      <span class="toplinks">
						
                       <p class="maintext_inner">Shipping charge for first item will be $ <?php echo $cnfg["flat_shipping_first"]; ?> and for each additional item it will charge $ <?php echo $cnfg["flat_shipping_additional"]; ?></p>
                        </span>
                    </div>
                    <div align="left" class="float_clear1"><?php echo $html->image('/img/clear.gif');?></div>
					<?php }else{?>
					<div align="right" id="inner_rightcontent">
                      <span class="toplinks">
						
                       <p class="maintext_inner">Sorry, there is no shipping service available to the address you provided. So we will charge a flat shipping rate of $<?php echo $cnfg["flat_shipping_first"]; ?> for first item and for each additional item it will charge $ <?php echo $cnfg["flat_shipping_additional"]; ?></p>
                        </span>
                    </div>
                   
					
					<?php }}?>
			   <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="hidden" name="ship_method" value="<?php echo "Flat Rate Shipping".'-***-'."Flat Rate Shipping".'-***-'.$pshipchrg; ?>" >
					<input type="submit" value="Continue" onClick="return chk();" class="buttn_admin" >
					<input type="button" value="Cancel" onClick="javascript:history.go(-1);" 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>
				<?php }else{?>
				<?php if(!isset($pshipchrg)){
   	$pshipchrg=0;
	}
   ?>
  <input type="hidden" name="ship_method" value="<?php echo "Not Applicable".'-***-'."Not Applicable".'-***-'.$pshipchrg; ?>" >
				<?php } ?>
                <!--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>
			 <?php if($prodtype == "Digital") { ?>
			 <script language="javascript" type="text/javascript">
			 document.shipmethod.submit();
			 </script>
			 <?php } ?>