<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
?>

<script type="text/javascript" language="javascript">
var submitter = 0;
function submitFunction() {
   if (document.checkout_payment.customer_shopping_points_spending.checked == false) {
  submitter = 1;
  } else {
  submitter = 0;
   }
}
</script>

<?php echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_CONFIRMATION, '', 'SSL'), 'post', 'onsubmit="return check_form();"'); ?>

<table border="0" width="100%" cellspacing="0" cellpadding="0" align="center">
<!-- Naglowek BOF -->
<tr>
<td>

  <?php
  $info_box_contents = array();
  $info_box_contents[] = array('text' => sprintf(HEADING_TITLE));
  new contentBoxHeading($info_box_contents);
  ?>

</td>
</tr>
<tr>
<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
</tr>
<!-- Naglowek EOF -->

<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">

<!-- TRESC STRONY START -->

  <?php
  if (isset($HTTP_GET_VARS['payment_error']) && is_object(${$HTTP_GET_VARS['payment_error']}) && ($error = ${$HTTP_GET_VARS['payment_error']}->get_error())) {
    ?>
    <tr>
      <td>
        <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="main"><b><?php echo tep_output_string_protected($error['title']); ?></b></td>
          </tr>
        </table>
      </td>
    </tr>

    <tr>
      <td>
        <table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBoxNotice">
          <tr class="infoBoxNoticeContents">
            <td>
              <table border="0" width="100%" cellspacing="0" cellpadding="2">
                <tr>
                  <td class="main" width="100%" valign="top"><?php echo tep_output_string_protected($error['error']); ?></td>
                </tr>
              </table>
            </td>
          </tr>
        </table>
      </td>
    </tr>

    <tr>
      <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
    </tr>
  <?php
  }
  ?>

  <tr>
    <td>
      <fieldset>
      <legend><?php echo TABLE_HEADING_BILLING_ADDRESS; ?></legend>
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
              <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            <td class="main" width="50%" valign="top">
            <?php echo ((!tep_session_is_registered('customer_is_guest') )? TEXT_SELECTED_BILLING_DESTINATION . '<br><br><a href="' . tep_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, '', 'SSL') . '">' . tep_image_button('button_change_address.gif', IMAGE_BUTTON_CHANGE_ADDRESS) . '</a>':'&nbsp;'); ?>
            <td align="right" width="50%" valign="top">
              <table border="0" cellspacing="0" cellpadding="2">
                <tr>
                  <td class="main" align="center" valign="top"><b><?php echo TITLE_BILLING_ADDRESS; ?></b><br><?php echo tep_image(DIR_WS_TEMPLATES . 'images/misc/shipping_address.gif'); ?></td>
                </tr>
                <tr>
                  <td class="main" valign="top"><?php echo tep_address_label($customer_id, $billto, true, ' ', '<br>'); ?></td>
                </tr>
              </table>
            </td>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
          </tr>
        </table>
      </fieldset>
      </tr>
    </td>
  </tr>

  <tr>
    <td>
      <fieldset>
      <legend><?php echo TABLE_HEADING_PAYMENT_METHOD; ?></legend>
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <?php
          $selection = $payment_modules->selection();

          if (sizeof($selection) > 1) {
            ?>
            <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              <td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_PAYMENT_METHOD; ?></td>
              <td class="main" width="50%" valign="top" align="right"><b><?php echo TITLE_PLEASE_SELECT; ?></b><br><?php echo tep_image(DIR_WS_TEMPLATES . 'images/misc/payment.gif'); ?></td>
              <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            </tr>
            <?php
          } else {
            ?>
            <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              <td class="main" width="100%" colspan="2"><?php echo TEXT_ENTER_PAYMENT_INFORMATION; ?></td>
              <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            </tr>
            <?php
          }

          $radio_buttons = 0;
          for ($i=0, $n=sizeof($selection); $i<$n; $i++) {
            ?>
            <tr>
                <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
              <td colspan="2">
                <table border="0" width="100%" cellspacing="0" cellpadding="2">
                  <?php
                  if ( ($selection[$i]['id'] == $payment) || ($n == 1) ) {
                    echo '<tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
                  } else {
                    echo '<tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
                  }
                  ?>
                  <td class="main" colspan="3"><b><?php echo $selection[$i]['module']; ?></b></td>
                  <td class="main" align="right">
                    <?php
                    if (sizeof($selection) > 1) {
                      echo tep_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $payment));
                    } else {
                      echo tep_draw_hidden_field('payment', $selection[$i]['id']);
                    }
                    ?>
                  </td>
                  </tr>
                  <?php
                  if (isset($selection[$i]['error'])) {
                    ?>
                    <tr>
                      <td class="main" colspan="4"><?php echo $selection[$i]['error']; ?></td>
                    </tr>
                    <?php
                  } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) {
                    ?>
                    <tr>
                      <td colspan="4">
                        <table border="0" cellspacing="0" cellpadding="2">
                          <?php
                          for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) {
                            ?>
                            <td class="TableFrame" align="center">
                              <table border="0" cellspacing="0" cellpadding="0">
                                <tr><td class="main" height="65" valign="middle"><?php echo $selection[$i]['fields'][$j]['title']; ?></td></tr>
                                <tr><td class="main" align="center"><?php echo $selection[$i]['fields'][$j]['field']; ?></td>
                              </tr></table>
                            </td>
                            <?php
                            if ( $j == 4 || $j == 9 || $j == 14 || $j == 19 || $j == 25 ) {
                              echo '</tr><tr>';
                            }
                          }
                          ?>
                        </table>
                      </td>
                    </tr>
                    <?php
                  }
                  ?>
                </table>
              </td>
              <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            </tr>
            <?php
            $radio_buttons++;
          }
          ?>
        </table>
      </fieldset>
    </td>
  </tr>

  <!-- Points/Rewards Module V2.1rc2a Redeemption box bof -->
  <?php
  if ( !tep_session_is_registered('customer_is_guest') ) {
    if ((USE_POINTS_SYSTEM == 'true') && (USE_REDEEM_SYSTEM == 'true')) {
      echo points_selection();
      if (tep_not_null(USE_REFERRAL_SYSTEM) && (tep_count_customer_orders() == 0)) {
        echo referral_input();
      }
    }
  }
  ?>
  <!-- Points/Rewards Module V2.1rc2a Redeemption box eof -->

  <?php
  if ((TEXT_PARAGON != '') && (TEXT_FAKTURA != '')) {
    ?>
    <tr>
      <td>
        <fieldset>
        <legend><?php echo TABLE_HEADING_DOKUMENT_SPRZEDAZY; ?></legend>
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            <td class="main" width="50%" valign="top"><?php echo TEXT_SELECT_DOKUMENT_SPRZEDAZY; ?></td>
            <td class="main" width="50%" valign="top" align="right"><b><?php echo TITLE_PLEASE_SELECT; ?></b></td>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
          </tr>

          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            <td colspan="2">
              <table border="0" width="100%" cellspacing="0" cellpadding="2">
                <?php
                if (CZY_PARAGON != '0' || !defined('CZY_PARAGON')) {
                  ?>
                  <tr id="fakt1" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="javascript:this.className='moduleRowSelected';document.getElementById('fakt2').className='moduleRow';document.forms['checkout_payment'].paragon[0].checked=true">
                    <td class="main" colspan="3"><b><?php echo TEXT_PARAGON; ?></b></td>
                    <td class="main" align="right"><input type="radio" name="paragon" value="paragon" checked></td>
                  </tr>
                  <?php
                }
                $sprawdz_nip = mysql_query("select entry_nip, entry_company from address_book where customers_id = '" . $customer_id . "' && entry_nip = '' && entry_company != ''");
                if (mysql_num_rows($sprawdz_nip) > 0) {
                  ?>
                  <tr id="fakt2" class="moduleRow">
                    <td class="main" colspan="3"><b><?php echo TEXT_FAKTURA; ?></b><br>
                      <span class="smallText"></span><?php echo FAKTURA_NIP; ?></td>
                    <td class="main" align="right"><input type="radio" name="paragon" value="faktura" disabled></td>
                  </tr>
                  <?php
                } else {
                  ?>
                  <tr id="fakt2" class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="javascript:this.className='moduleRowSelected';document.getElementById('fakt1').className='moduleRow';document.forms['checkout_payment'].paragon[1].checked=true">
                  <td class="main" colspan="3"><b><?php echo TEXT_FAKTURA; ?></b></td>
                  <?php
                  if (CZY_PARAGON == '0' && defined('CZY_PARAGON')) { $pole = 'checked'; }
                    ?>
                    <td class="main" align="right"><input type="radio" name="paragon" value="faktura" <?php echo $pole; ?>></td>
                  </tr>
                  <?php
                }
                ?>
              </table>
            </td>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
          </tr>
        </table>
        </fieldset>
    </td>
    </tr>
    <?php
  }
  ?>

  <tr>
    <td>
      <fieldset>
      <legend><?php echo TABLE_HEADING_COMMENTS; ?></legend>
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td align="center"><?php echo tep_draw_textarea_field('comments', 'soft', '100', '5', $comments); ?></td>
          </tr>
        </table>
      </fieldset>
    </td>
  </tr>

  <?php
  /* kgt - discount coupons */
  if ( !tep_session_is_registered('customer_is_guest') ) {
  if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_STATUS == 'true' ) {
    ?>
  <tr>
    <td>
      <fieldset>
      <legend><?php echo TABLE_HEADING_COUPON; ?></legend>
        <table border="0" width="100%" cellspacing="0" cellpadding="2">
          <tr>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
            <td class="main"><?php echo ENTRY_DISCOUNT_COUPON.' '.tep_draw_input_field('coupon', '', 'size="32"'); ?></td>
            <td><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
          </tr>
        </table>
      </fieldset>
    </td>
  </tr>
    <?php
  }
}
  /* end kgt - discount coupons */
  ?>

  <!-- Przyciski BOF -->
  <tr>
    <td>
      <table border="0" width="100%" cellspacing="0" cellpadding="2">
        <tr>
          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
          <td class="main" align="left"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING) . '">' . tep_image_button('button_back.gif', 'back') . '</a>'; ?></td><td class="main" align="center"><b><?php echo TITLE_CONTINUE_CHECKOUT_PROCEDURE . '</b><br>' . TEXT_CONTINUE_CHECKOUT_PROCEDURE; ?></td>
          <td class="main" align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
          <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
        </tr>
      </table>
    </td>
  </tr>
  <!-- Przyciski EOF -->


<!-- TRESC STRONY KONIEC -->

</table>
</td>
</tr>

 <tr>
  <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
 </tr>
 <tr>
  <td>
   <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
     <td width="25%">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
       <tr>
        <td width="50%" align="right"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
       </tr>
      </table>
   </td>
     <td width="25%">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
       <tr>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
        <td><?php echo tep_image(DIR_WS_TEMPLATES . 'images/misc/checkout_bullet.gif'); ?></td>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
       </tr>
      </table>
   </td>
     <td width="25%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
     <td width="25%">
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
       <tr>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td>
        <td width="50%"><?php echo tep_draw_separator('pixel_silver.gif', '1', '5'); ?></td>
       </tr>
      </table>
     </td>
    </tr>
    <tr>
     <td align="center" width="25%" class="checkoutBarFrom"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '" class="checkoutBarFrom">' . CHECKOUT_BAR_DELIVERY . '</a>'; ?></td>
     <td align="center" width="25%" class="checkoutBarCurrent"><?php echo CHECKOUT_BAR_PAYMENT; ?></td>
     <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_CONFIRMATION; ?></td>
     <td align="center" width="25%" class="checkoutBarTo"><?php echo CHECKOUT_BAR_FINISHED; ?></td>
    </tr>
   </table>
  </td>
 </tr>

</table>
</form>