<?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  23/01/11, 00:03
  @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>


  <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_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><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br />') ;?></p>
      </div>

      <?php if ($addresses_count > 1) { ?>
          <div class="contentBox shippingAddress">
          <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 $radio_buttons = 0;
            while ($addresses = tep_db_fetch_array($addresses_query)) {
              $format_id = tep_get_address_format_id($addresses['country_id']);
            ?>
            <?php echo tep_output_string_protected($addresses['firstname'] . ' ' . $addresses['lastname']); ?>
            <?php echo tep_draw_radio_field('address', 'address', $addresses['address_book_id'], ($addresses['address_book_id'] == $billto)); ?>
             <br />
            <?php echo tep_address_format($format_id, $addresses, true, ' ', ', ').'<br />'; ?>
    <?php $radio_buttons++;
          }
        echo '</div>';
        }
      }

    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="formBt">
      <label><?php echo  TITLE_CONTINUE_CHECKOUT_PROCEDURE . '<br />' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></label>
      <?php echo tep_draw_hidden_field('action', 'submit') ;?>
      <input type="submit" class="submitBt" value="<?php echo IMAGE_BUTTON_CONTINUE; ?>"  />
    </p>
  </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>
    <div class="bottom_prod_box_big"></div>
  </div>



</div>