<?php
/**
  @licence GPL 2005-2011  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  29/01/11, 11:43
  @author oscim <mail aurelien@oscim.fr> <www http://www.oscim.fr>
  @encode UTF-8
*/
?>
<div id="checkoutPaymentAddress">
  <?php $boxe =$page->oscss_boxes->_return('checkout_progressbar'); ?>
  <?php echo unhtmlentities($boxe->content) ?>

  <?php $page->messageStack->_draw('checkout_address');?>

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

  <?php echo tep_draw_form('checkout_address', tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL'), 'post', 'onsubmit="return check_form_optional(\'checkout_address\');"'); ?>

    <?php if ($process == false): ?>

      <div class="contentBox paymentAddress">
        <h3><?php echo TABLE_HEADING_PAYMENT_ADDRESS ;?></h3>
          <p><?php echo TEXT_SELECTED_PAYMENT_DESTINATION ;?></p>
        <h4><?php echo TITLE_PAYMENT_ADDRESS ;?></h4>
          <p class="Adress"><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />') ;?></p>
      </div>

      <?php if ($addresses_count > 1): ?>
	<div class="contentBox paymentAddress">
          <h3><?php echo TABLE_HEADING_ADDRESS_BOOK_ENTRIES ;?></h3>
            <p><?php echo TEXT_SELECT_OTHER_PAYMENT_DESTINATION ;?><p>
          <h4><?php echo TITLE_PLEASE_SELECT ;?></h4>

	  <?php while ($addresses = tep_db_fetch_array($addresses_query)) :
		$format_id = tep_get_address_format_id($addresses['country_id']); ?>
	      <p>
		<label><?php echo tep_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']); ?></label>
		<?php echo tep_draw_radio_field('address', 'address', $addresses['address_book_id'], ($addresses['address_book_id'] == $billto)); ?>
	      </p>
	      <p  class="Adress"> <?php echo tep_address_format($format_id, $addresses, true, ' ', ', '); ?></p>
	  <?php endwhile; ?>

        </div>
      <?php endif; //if ($addresses_count > 1) ?>
    <?php endif; // if ($process == false) ?>

   <?php if ($addresses_count < MAX_ADDRESS_BOOK_ENTRIES) { ?>

      <h3><?php echo TABLE_HEADING_NEW_PAYMENT_ADDRESS; ?></h3>
        <p><?php echo TEXT_CREATE_NEW_PAYMENT_ADDRESS; ?></p>

        <?php  echo tep_get_include_contents('address_book_details'); ?>
    <?php } ?>

    <p class="infoForms"><?php echo  TITLE_CONTINUE_CHECKOUT_PROCEDURE . '<br />' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></p>

    <div class="navBt">
      <p class="formBt">
	<?php echo tep_draw_hidden_field('action', 'submit') ;?>
	<input type="submit" class="submitBt" value="<?php echo IMAGE_BUTTON_CONTINUE; ?>"  />
      </p>
      <p>
	<?php echo '<a class="navBt" href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL') . '">' . IMAGE_BUTTON_BACK . '</a>'; ?>
      </p>
    </div>
  </form>

  <?php /*if ($process == true) { ?>
    <div class="navBt">
      <?php echo '<a class="navBt" href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . IMAGE_BUTTON_BACK . '</a>'; ?>
    </div>
  <?php }*/ ?>

</div>