<?php
/*
  www.oscGold.com (C) Kamelia-Net Jacek Krysiak
  modul oscGold wer 4.0
*/
$modules_template = 'upcoming_products';
$ilosc_col = MAX_DISPLAY_COLUMN_UPCOMING_PRODUCTS;
if (!isset($ilosc_maksymalna) || $ilosc_maksymalna == 0) {
$max_display = 1; } else { $max_display = $ilosc_maksymalna; }
$max_wiersz =  $max_display/$ilosc_col;

$szer_tab = round(100/$ilosc_col,0) ;

$expected_query = tep_db_query("
  SELECT p.products_id, p.products_image, pd.products_name, products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
  WHERE pd.products_id = p.products_id AND p.products_status = '1' AND to_days(products_date_available) >= to_days(now()) AND pd.language_id = '" . (int)$languages_id . "' order by rand() limit " . $max_display);

if (tep_db_num_rows($expected_query) > 0) {

?>

<!-- upcoming_products //-->
<table border="0" width="100%" cellspacing="0" cellpadding="0" class="templateinfoBox">
 <tr>
  <td class="main" style="padding-bottom:1px">
   <?php
   $info_box_contents = array();
   $info_box_contents[] = array('text' => '<a class="headerNavigationFeatured" href="' . tep_href_link(FILENAME_UPCOMING_PRODUCTS) . '">' .sprintf(TABLE_HEADING_UPCOMING_PRODUCTS).'</a>');
   new contentBoxHeading($info_box_contents);
   ?>
  </td>
 </tr>
<tr>
  <td align="center" style="padding-bottom:5px">
   <table border="0" width="100%" cellspacing="0" cellpadding="1">
   <tr>
   <?php
   include (bts_select('modules', $modules_template));
   ?>
   <?php
   $ile = tep_db_num_rows($expected_query)-($row*$ilosc_col);
   if ($ile < $ilosc_col && $ile != 0) {
      $roznica = $ilosc_col - $ile;
	  for($index=0;$index<$roznica;$index++)
	  {
	    if ($index == $roznica-1) {
	    echo '<td width="'.$szer_tab.'%">'.tep_draw_separator('pixel_trans.gif', '100%', '1').'</td>';
		} else {
		echo '<td width="'.$szer_tab.'%">'.tep_draw_separator('pixel_trans.gif', '100%', '1').'</td>';
		echo '<td>'.tep_draw_separator('pixel_trans.gif', '1', '1').'</td>';
		}
	  }
   }
   ?>
   </tr>
   </table>
  </td>
 </tr>
</table>
<?php
}
?>
<!-- upcoming_products_eof //-->