<?php
/**
  @licence GPL 2005-2010  The osCSS developers - osCSS Open Source E-commerce
  @portion code Copyright (c) 2002 osCommerce
  @package osCSS-2 <www http://www.oscss.org>
  @version 2.1.0
  @date  18/11/10, 21:54
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
?>
<div id ="checkoutShipping" class="orderProcess">
  <?php $boxe =$page->oscss_boxes->_return('checkout_progressbar'); ?>
  <?php echo unhtmlentities($boxe->content) ?>

 <h2 class="content title <?php echo $language ;?>"><?php echo HEADING_TITLE; ?></h2>

  <div class="prod_box_big">
    <div class="top_prod_box_big"></div>
      <div class="center_prod_box_big">

  <?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL')) . '<p>' . tep_draw_hidden_field('action', 'process') . '</p>'; ?>

    <div class="contentBox shippingAddress">

      <h3><?php echo TABLE_HEADING_SHIPPING_ADDRESS; ?></h3>
      <p><?php echo TEXT_CHOOSE_SHIPPING_DESTINATION ;?></p>

      <h4><?php echo TITLE_SHIPPING_ADDRESS ; ?></h4>
      <p class="currentAdress"><?php echo tep_address_label($customer_id, $sendto, true, ' ', '<br />'); ?></p>
      <p class="currentAdress navBt"><?php echo '<a class="navBt" href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, '', 'SSL') . '">' . IMAGE_BUTTON_CHANGE_ADDRESS . '</a>'; ?></p>

   </div>

  <br class="spacer" />

  <?php if (tep_count_shipping_modules() > 0) { ?>
    <div class="contentBox shippingMethod">
    <h3><?php echo TABLE_HEADING_SHIPPING_METHOD; ?></h3>

    <?php if (sizeof($quotes) > 1 && sizeof($quotes[0]) > 1): ?>
      <p class="infoText"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></p>
    <?php elseif ($free_shipping == false): ?>
      <p class="infoText"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></p>
    <?php endif; ?>
    <p class="infoText weight"><?php echo TOTAL_WEIGHT.' '.$cart->show_weight().' '.UNIT_WEIGHT_NAME; ?></p>

    <?php /** Free shipping */ if ($free_shipping == true) { ?>
      <p><?php echo FREE_SHIPPING_TITLE; ?>&nbsp;<?php if (isset($quotes[0]['icon'])) echo $quotes[0]['icon']; ?></p>
      <p><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . tep_draw_hidden_field('shipping', 'free_free'); ?></p>

    <?php /** choose method shipping */ } else {
      $radio_buttons = 0;
      for ($i=0, $n=sizeof($quotes); $i<$n; $i++) :?>
	<p class="shippingSelect" onmouseover="this.id='mouseOver';" onmouseout="this.id='mouseOutpost';">
	  <label for="shipping<?php echo $i; ?>">
	    <span class="methodName"><?php echo $quotes[$i]['module']; ?></span>
	    <span class="methodIcon"><?php if (isset($quotes[$i]['icon']) && tep_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></span>
	  </label>
	    <?php if (isset($quotes[$i]['error'])): ?>
	      <span><?php echo $quotes[$i]['error']; ?></span>
	    <?php else: ?>
	      <ul>
		<?php for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {// set the radio button to be checked if it is the method chosen
			$checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false); ?>
		    <li>
		      <span class="methodTitle"><?php echo $quotes[$i]['methods'][$j]['title']; ?></span>
		      <?php if(isset($quotes[$i]['methods'][$j]['detail'])): ?>
			<span class="methodDetail"><?php echo $quotes[$i]['methods'][$j]['detail']; ?></span>
		      <?php endif; ?>
		      <?php if ( ($n >= 1) || ($n2 >= 1) ): ?>
			  <span class="methodPrice"><?php echo $currencies->format($quotes[$i]['methods'][$j]['cost']); ?></span>
			<?php echo tep_draw_radio_field('shipping','shipping'.$i, $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?>
		      <?php else: ?>
			  <?php echo $currencies->format($quotes[$i]['methods'][$j]['cost']) . tep_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?>
		      <?php endif; ?>
		    </li>
		<?php $radio_buttons++;
		    } ?>
	      </ul>
	    <?php endif; ?>
	</p>
      <?php endfor; ?>
    <?php } ?>
    </div>

    <p class="shippingComment">
      <label for="comment"><?php echo TABLE_HEADING_COMMENTS; ?></label>
      <?php echo tep_draw_textarea_field('comments', 'comment', '48', '5'); ?>
    </p>

    <?php if(strlen(tep_address_label($customer_id, $sendto, true, ' ', '<br />')) > 25) : ?>
      <div class="navBt">
	<p class="formBt">
	  <label><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE ;?></label>
	  <br />
	  <input type="submit" class="submitBt" value="<?php echo IMAGE_BUTTON_CONTINUE; ?>"  />
	</p>
      </div>
    <?php endif; ?>

  <?php /** No shipping possible Alert and Block process */ }elseif (tep_count_shipping_modules() ===0) { ?>

    <p class="alert"><?php echo TXT_ALERT_NO_SHIPPING_POSSIBLE ?></p>

    <div class="navBt">
	<?php echo '<a class="navBt" href="javascript: history.go(-1)">' . IMAGE_BUTTON_BACK . '</a>'; ?>
    </div>

  <?php } ?>

  </form>

    </div>
    <div class="bottom_prod_box_big"></div>
  </div>

</div>