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

if (strstr(MODULE_PAYMENT_INSTALLED, "raty_zagiel.php") !== false) {
  function clean_prod($data) {
    $data = preg_replace ('/[^0-9,]/', '', $data);
    $data = preg_replace ('/ /', '', $data);
    $data = preg_replace ('/,/', '.', $data);
    return $data;
  }
}
if (strstr(MODULE_PAYMENT_INSTALLED, "raty_zagiel.php") !== false) {
  ?>
  <script>
  <!--
    function PoliczRate(koszyk)	{
      window.open('https://www.eraty.pl/symulator/oblicz.php?numerSklepu=<? echo MODULE_PAYMENT_RATY_ZAGIEL_NUMER_SKLEPU; ?>&wariantSklepu=<? echo MODULE_PAYMENT_RATY_ZAGIEL_WARIANT_SKLEPU; ?>&typProduktu=0&wartoscTowarow='+koszyk, 'Policz_rate', 'width=630,height=500,directories=no,location=no,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no');
    }
  //-->
  </script>
  <?php
}

function zakladka($tekst,$id_zakl,$status = 'off') {
    $klasa_css = '';
    if ($status == 'on') { $klasa_css = '_on'; }
	echo '<td valign="bottom">';
	echo '<div id="pane_l_'.$id_zakl.'" class="pane_left'.$klasa_css.'" onmouseover="zmien_css(\''.$id_zakl.'\',\'on\')" onmouseout="zmien_css(\''.$id_zakl.'\',\'off\')" onclick="wyswietl(\''.$id_zakl.'\');">'.$tekst.'</div><div id="pane_r_'.$id_zakl.'" class="pane_right'.$klasa_css.'"></div>';
	echo '</td>';
}
function separator() { echo '<td class="separator"></td>'; }

//DISPLAY PRODUCT WAS ADDED TO WISHLIST IF WISHLIST REDIRECT IS ENABLED
if(tep_session_is_registered('wishlist_id')) {
  $messageStack->add('wishlist', PRODUCT_ADDED_TO_WISHLIST);
  echo $messageStack->output('wishlist');
  tep_session_unregister('wishlist_id');
}

if (FOTO_OPCJE != 'true') {
?>
	<script type="text/javascript" src="includes/javascript/prototype/prototype.js"></script>
	<script type="text/javascript" src="includes/javascript/prototype/effects.js"></script>
	<script type="text/javascript" src="includes/javascript/prototype/window.js"></script>
	<script type="text/javascript" src="includes/javascript/prototype/window_effects.js"></script>
	<link rel="stylesheet" type="text/css" href="<?php echo (bts_select('stylesheet','themes/default.css')); // BTSv1.5 ?>">
	<link rel="stylesheet" type="text/css" href="<?php echo (bts_select('stylesheet','themes/spread.css')); // BTSv1.5 ?>">
    <script type="text/javascript" language="javascript">
    function ShowPictureOptions(pictures_name,name,szerokosc,wysokosc,sz_box,wy_box) {
        var imageObject = new Image();
        imageObject.src = pictures_name;
        win = new Window( { className: 'spread', destroyOnClose: true, recenterAuto:true, minimizable:false, maximizable:false } );
        win.setSize(sz_box, wy_box);

        win.getContent().innerHTML= unescape("<table cellpadding='0' cellspacing='6' border='0' align='center' width='100%' height='100%'><tr><td width='100%'>"+
                                    "<table cellpadding='0' cellspacing='0' border='0' align='center' width='100%'>"+
                                    "<tr><td height='30px' style='font-family:Tahoma,Arial;color:#000;font-size:15px;font-weight:bold;padding-left:5px;'>"+name.substr(0,70)+"<<?php echo '%2F'; ?>td><<?php echo '%2F'; ?>tr>"+
                                    "<<?php echo '%2F'; ?>table><<?php echo '%2F'; ?>td><<?php echo '%2F'; ?>tr>"+
                                    "<tr><td height='100%' align='center' valign='middle' colspan='3' style='background:#ffffff; border:1px solid #c0c0c0;'><img src='"+pictures_name+"' width='"+szerokosc+"' height='"+wysokosc+"' border='0'><<?php echo '%2F'; ?>td><<?php echo '%2F'; ?>tr><<?php echo '%2F'; ?>table><<?php echo '%2F'; ?>div>");
        win.showCenter();
      }
    </script>
<?php
}
?>

<?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">

	<?php
	// Brak produktow BOF
	///////////////////////////////////////////////////////////////////////////////
	if ($product_check['total'] < 1) {
	?>

	<tr>
		<td class="main" style="padding-bottom:5px"><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
	</tr>

	<tr>
		<td>
			<table border="0" width="100%" cellspacing="0" cellpadding="2" class="TableFrame">
				<tr>
					<td align="right" style="padding-right:10px"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
				</tr>
			</table>
		</td>
	</tr>

	<?php
	///////////////////////////////////////////////////////////////////////////////
	// Brak produktow EOF

	} else {

	$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_image_pop, pd.products_url, p.products_price, p.products_retail_price, " . ($czy_znizki_od_ilosci ? ' p.products_discount, ' : '' ) . " " . ($czy_negocjacja ? ' p.products_make_an_offer, ' : '' ) . " p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id,  p.products_availability_id, p.products_maxorder, products_jm_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
    $product_info = tep_db_fetch_array($product_info_query);

	tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

	//TotalB2B start
	$product_info['products_price'] = tep_xppp_getproductprice($product_info['products_id']);
	//TotalB2B end

    if (DISPLAY_PRICE_BRUTTO_NETTO == 'true') {
	    $display_nb = 1;
	  } else {
	    $display_nb = 0;
    }

	if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
		//TotalB2B start
		$query_special_prices_hide_result = SPECIAL_PRICES_HIDE;
		if ($query_special_prices_hide_result== 'true') {
			$products_price = '<span class="Cena" id="nowaCena">' .$currencies->display_price($product_info['products_id'],$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']),1,$display_nb) . '';
			$nuPrice = $currencies->display_price($product_info['products_id'],$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])). '</span>';
			$vat_stawka = tep_get_tax_rate($product_info['products_tax_class_id']);
			$cena_raty = $currencies->display_price($product_info['products_id'],$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
		} else {
		    $products_price = '<span style="display:none" id="staraCena_bz">'.$currencies->display_price($product_info['products_id'], $product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
			$products_price .= '<span class="SmallPriceProduct" id="staraCena" style="text-decoration: line-through">'.$currencies->display_price($product_info['products_id'], $product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span><br><span class="productSpecialPrice" id="nowaCena">' . $currencies->display_price_nodiscount($product_info['products_id'], $new_price, tep_get_tax_rate($product_info['products_tax_class_id']),1,$display_nb) . '</span>';
			$nuPrice = $currencies->display_price_nodiscount($product_info['products_id'], $new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
			$vat_stawka = tep_get_tax_rate($product_info['products_tax_class_id']);
			$cena_raty = $currencies->display_price_nodiscount($product_info['products_id'], $new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
		}
		//TotalB2B end
	} else {
		$products_price = '<span class="Cena" id="nowaCena">' .$currencies->display_price($product_info['products_id'], $product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']),1,$display_nb). '</span>';
		$nuPrice = $currencies->display_price($product_info['products_id'], $product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
		$vat_stawka = tep_get_tax_rate($product_info['products_tax_class_id']);
    $cena_raty = $currencies->display_price($product_info['products_id'],$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
	}

	$tysiac = trim($currencies->currencies[$currency]['thousands_point']);
	if ($tysiac !='') {
		$nuPrice = str_replace($tysiac, "", $nuPrice);
	}
	$decimal = trim($currencies->currencies[$currency]['decimal_point']);
	if ($decimal !='.') {
		$nuPrice = str_replace($decimal, ".", $nuPrice);
	}
	if (tep_not_null($product_info['products_model'])) {
		//$products_name = '' . $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
		$products_name = '' . $product_info['products_name'] . '';
	} else {
		$products_name = '' . $product_info['products_name'] . '';
	}

	$products_availability = $product_info['products_availability_id'];
    $products_availability_info_query = tep_db_query("select e.products_availability_name from " . TABLE_PRODUCTS_AVAILABILITY . " e where e.products_availability_id = '" . (int)$products_availability . "' and e.language_id = '" . (int)$languages_id . "'");
    $products_availability_info = tep_db_fetch_array($products_availability_info_query);
	$products_availability_name = $products_availability_info['products_availability_name'];

	$the_manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int)$languages_id . "'), " . TABLE_PRODUCTS . " p  where p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
	$the_manufacturers = tep_db_fetch_array($the_manufacturer_query);

	?>

	<tr>
		<td>
			<div style="padding-bottom:1px">
				<?php
				$info_box_contents = array();
				$info_box_contents[] = array('text' => sprintf(HEADING_PRODUCT_INFO));
				new contentBoxHeading($info_box_contents);
				?>
			</div>
		</td>
	</tr>
	<tr>
		<td class="TableFrame" align="center">
          <div style="overflow:hidden;">
			<?php
			if (!tep_session_is_registered('recently_viewed')) {
				tep_session_register('recently_viewed');
				$recently_viewed = $HTTP_GET_VARS['products_id'] . ';';
			}
			$dup_recent_viewed = 'n';
			$recent_products = split(';',$recently_viewed);
			foreach ($recent_products as $recent) {
				if ($recent == $HTTP_GET_VARS['products_id']) $dup_recent_viewed = 'y';
			}
			if ($dup_recent_viewed == 'n') $recently_viewed = $HTTP_GET_VARS['products_id'] . ';' . $recently_viewed ;
			?>
			<div class="ProductInfoTile" style="padding:4px;width:98%;text-align:left"><?php echo $products_name; ?></div>
			<div align="right" class="main" style="padding:4px;width:98%">
				<!-- cena BOF -->
				<?php
				$query_price_to_guest_result = ALLOW_GUEST_TO_SEE_PRICES;
				if ((($query_price_to_guest_result=='true') && !(tep_session_is_registered('customer_id'))) || ((tep_session_is_registered('customer_id')))) {
					if ($product_info['products_price'] > 0) {
						include($modules_folder . 'ezier_new_fields.php');
					} else {
						echo '<b>'.TEMPORARY_NO_PRICE.'</b>' ;
					}
				} else {
					echo '<span class="smallText"><b>' . PRICES_LOGGED_IN_TEXT . '</b></span>';
				}
				?>
				<!-- cena EOF -->
			</div>
			<div align="center">
				<!-- Przycisk "do koszyka" BOF -->
				<?php if (USE_SHOP_AS_CATALOG == 'false') { ?>
				<table width="100%" class="smallText">
					<tr><td height="10px" valign="middle"><?php echo tep_draw_separator('pixel_silver.gif', '100%', '1'); ?></td></tr>
          <tr>
            <td>
              <table cellpadding="0" cellspacing="0" border="0" width="100%">
                <tr>
                  <?php if ( $czy_negocjacja ) {
									if ($product_info['products_make_an_offer'] == true) {
										?>
										<td class="main" align="left"><div class="lf" style="padding:4px">
											<?php echo '<a href="' . tep_href_link(FILENAME_MAKE_AN_OFFER, tep_get_all_get_params()) . '">' . tep_image_button('button_make_an_offer.gif', IMAGE_BUTTON_MAKE_AN_OFFER) . '</a>'; ?>
										</div></td>
										<?php
									}
                  } ?>
                  <?php
                  if (strstr(MODULE_PAYMENT_INSTALLED, "raty_zagiel.php") !== false) {
                    ?>
                    <td class="smallText" align="right"><div style="float:right;padding:4px" class="main">
                      <?php
                      if (clean_prod($cena_raty) >= 100 && $language == 'polish') {
                        echo '<a OnClick="PoliczRate(' . clean_prod($cena_raty) . ');" style="cursor: pointer;" title="'.ZAGIEL_KUPUJ_NA_RATY.'">' . tep_image_button('zagiel_oblicz_rate.gif', ZAGIEL_OBLICZ_RATE) . '</a>';
                      } else {
                        echo '<span style="font-size: 12px;">'.ZAGIEL_MIN_ZAKUP.'</span>';
                      }
                      ?>
                    </div></td>
                    <?php
                  }
                  ?>
                </tr>
              </table>
            </td>
          </tr>
					<tr><td>
					<div class="lf" style="padding:4px">
					<?php echo tep_image_submit('button_wishlist.gif', ADD_TO_WISHLIST, 'name="wishlist" value="wishlist"'); ?>
					</div>
					<div style="float:right;padding:4px" class="main">
					<?php
					echo tep_draw_hidden_field('products_id', $product_info['products_id']);
					if ( $product_info['products_quantity'] > 0 ) {
							if ($product_info['products_price'] > 0) {
								echo '<span id="kupuje">'.tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART).'</span>';
							} else {
								echo ''.TEMPORARY_NO_PRICE.'';
							}
						} else {
							if ( (STOCK_CHECK == 'true') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
								echo '<span id="kupuje">'.tep_image_button('button_sold.gif').'</span>';
							} else if ( (STOCK_CHECK == 'false') && (STOCK_ALLOW_CHECKOUT != 'true') ) {
								echo '<span id="kupuje">'.tep_image_button('button_sold.gif').'</span>';
							} else {
								echo '<span id="kupuje">'.tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART).'</span>';
							}
						}
					?>
					</div>
					<!-- Ilosc zamawianych produktow BOF -->
					<?php
						if ( isset($_GET['quant']) && $_GET['quant'] != '') {
							echo '<div style="float:right;padding:4px;padding-top:6px" class="main">'.ENTRY_CANTIDAD.'&nbsp;&nbsp;<input type="text" name="quantity" value="'.$_GET['quant'].'" maxlength="6" size="6"></div>';
					} else {
							echo '<div style="float:right;padding:4px;padding-top:6px" class="main">'.ENTRY_CANTIDAD.'&nbsp;&nbsp;<input type="text" name="quantity" value="1" maxlength="6" size="6"></div>';
					}
					?>
					<!-- Przycisk "do koszyka" BOF -->
					<div style="clear:both"></div>
					<!-- Przycisk "do koszyka" EOF -->
					</td></tr></table>
				<?php } ?>
			</div>
			<div style="width:99%">
				<?php
				// Pobranie dodatkowych obrazkow
				$szerokosc = DISPLAY_IMAGE_WIDTH + 10;
				$wysokosc = DISPLAY_IMAGE_HEIGHT + 10;
				$img_path = DIR_WS_IMAGES;
				?>
				<table border="0" width="100%"><tr><td align="center" valign="top" class="smallText">
					<!-- Zdjecie BOF -->
					<?php
					// BOF Wyswietlanie obrazka glownego /////////
					if (tep_not_null($product_info['products_image'])) {
						if (FOTO_OPCJE == 'true') {
							require('fotoimage.php');
						  } else {
							require('fotoimage.theme.php');
						}
						if ($product_info['products_image'] != '') {
						$dod_foto = tep_db_query("SELECT additional_images_id, products_id, images_description, medium_images, popup_images FROM " . TABLE_ADDITIONAL_IMAGES . " WHERE products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
						?>
						<div align="center">
                            <?php
                            if (FOTO_OPCJE == 'true') {
                                if (IMAGE_WATERMARK == 'true') { ?>
                                    <?php
                                    echo tep_image(DIR_WS_IMAGES . $product_info['products_image'],$product_info['products_name'], DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT,' name="big_photo"','','','',"image.php?main=" . DIR_WS_IMAGES . $product_info['products_image'] . "&watermark=watermark.png",true,' id="big_photo_link0" rel="lytebox[obrazek]" title="'.htmlspecialchars($products_name).'"');
                                    ?>
                                    <?php
                                    if (CZY_LYTEBOX == '0') {
                                        $j=1;
                                        echo '<div id="dod_foto" style="display:none;">';
                                        $ciag_z_obraz = '';
                                        $ciag_z_tekstem = '';
                                        while ($fotos = tep_db_fetch_array($dod_foto)) {
                                            $ciag_z_obraz .= '<a href="image.php?main='.DIR_WS_IMAGES . $fotos['popup_images'].'&watermark=watermark.png" id="big_photo_links'.$j.'" rel="lytebox[obrazek]" title="'.htmlspecialchars($products_name).'">'.$j.'</a>';
                                            $ciag_z_tekstem .= '<a href="image.php?main='.DIR_WS_IMAGES . $fotos['popup_images'].'&watermark=watermark.png" id="big_photo_s'.$j.'" rel="lytebox[tekst]" title="'.htmlspecialchars($products_name).'">'.$j.'</a>';
                                            $j++;
                                        }
                                        echo $ciag_z_obraz;
                                        echo '</div>';
                                    }
                                    ?>
                                <?php } else { ?>
                                    <?php
                                    echo tep_image(DIR_WS_IMAGES . $product_info['products_image'],$product_info['products_name'], DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT,' name="big_photo"','','','',DIR_WS_IMAGES . $product_info['products_image'],true,' id="big_photo_link0" rel="lytebox[obrazek]" title="'.htmlspecialchars($products_name).'"');
                                    ?>
                                    <?php
                                    if (CZY_LYTEBOX == '0') {
                                        $j=1;
                                        echo '<div id="dod_foto" style="display:none;">';
                                        $ciag_z_obraz = '';
                                        $ciag_z_tekstem = '';
                                        while ($fotos = tep_db_fetch_array($dod_foto)) {
                                            $ciag_z_obraz .= '<a href="'.DIR_WS_IMAGES . $fotos['popup_images'].'" id="big_photo_links'.$j.'" rel="lytebox[obrazek]" title="'.htmlspecialchars($products_name).'">'.$j.'</a>';
                                            $ciag_z_tekstem .= '<a href="'.DIR_WS_IMAGES . $fotos['popup_images'].'" id="big_photo_s'.$j.'" rel="lytebox[tekst]" title="'.htmlspecialchars($products_name).'">'.$j.'</a>';
                                            $j++;
                                        }
                                        echo $ciag_z_obraz;
                                        echo '</div>';
                                    }
                                    ?>
                                <?php } ?>
                            <?php } else { ?>
                                <?php
                                echo tep_image(DIR_WS_IMAGES . $product_info['products_image'],$product_info['products_name'], DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT,' name="big_photo"','','','','javascript:ShowBigPicture(current_picture)',true,' name="big_photo_link"');
                                ?>
                            <?php } ?>
						</div>
						<div align="center" class="main" style="padding:3px">
							<?php
							if (FOTO_OPCJE == 'true') {
								if (IMAGE_WATERMARK == 'true') { ?>
									<a href="<?php echo "image.php?main=" . DIR_WS_IMAGES . $product_info['products_image'] . "&watermark=watermark.png"; ?>" id="big_photo_link1" rel="lytebox[tekst]" title="<?php echo htmlspecialchars($products_name); ?>"><small><?php echo TEXT_CLICK_TO_ENLARGE; ?></small></a>
									<?php
									if (CZY_LYTEBOX == '0') {
										$j=1;
										echo '<div id="dod_foto2" style="display:none;">';
										echo $ciag_z_tekstem;
										echo '</div>';
									}
									?>
								<?php } else { ?>
									<a href="<?php echo DIR_WS_IMAGES . $product_info['products_image']; ?>" id="big_photo_link1" rel="lytebox[tekst]" title="<?php echo htmlspecialchars($products_name); ?>"><small><?php echo TEXT_CLICK_TO_ENLARGE; ?></small></a>
									<?php
									if (CZY_LYTEBOX == '0') {
										$j=1;
										echo '<div id="dod_foto2" style="display:none;">';
										echo $ciag_z_tekstem;
										echo '</div>';
									}
									?>
								<?php } ?>
							<?php
							} else {
							?>
							<a href="javascript:ShowBigPicture(current_picture)" name="big_photo_link"><small><?php echo TEXT_CLICK_TO_ENLARGE; ?></small></a>
							<?php
							}
							?>
						</div>
						<?php } ?>
					<?php
					} // EOF Wyswietlanie obrazka glownego /////////
					?>
					<!-- Zdjecie EOF -->
				</td>
				<?php
				$images_product = tep_db_query("SELECT additional_images_id, products_id, images_description, medium_images, popup_images FROM " . TABLE_ADDITIONAL_IMAGES . " WHERE products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
				$ile_dod_foto=mysql_num_rows($images_product);
				//
				if (CZY_NR_KATALOGOWY != '0' || CZY_PRODUCENT != '0' || CZY_DOSTEPNOSC != '0' || CZY_MAX_ILOSC != '0' || CZY_STAN_MAGAZYNOWY != '0' || CZY_SREDNIA_OCENA != '0' || CZY_RECENZJE != '0' || (int)$ile_dod_foto > 0) {
				?>
				<!-- Data dodania, producent, cena, przycisk kup teraz BOF -->
				<td valign="top" width="100%" class="main">
					<?php
					if (CZY_NR_KATALOGOWY != '0' || CZY_PRODUCENT != '0' || CZY_DOSTEPNOSC != '0' || CZY_MAX_ILOSC != '0' || CZY_STAN_MAGAZYNOWY != '0' || CZY_SREDNIA_OCENA != '0' || CZY_RECENZJE != '0') {
					?>
					<table border="0" cellspacing="2" cellpadding="5" width="100%" class="TableFrame">
						<?php
						// Numer katalogowy BOF ////////////////////
						if (CZY_NR_KATALOGOWY != '0' || !defined('CZY_NR_KATALOGOWY')) {
							if (tep_not_null($product_info['products_model'])) {
							?>
								<tr>
									<td class="ProductHead" width="50%"><b><?php echo CATALOG_NUMBER; ?></b></td>
									<td class="ProductHead" width="50%"><?php echo $product_info['products_model']; ?></td>
								</tr>
							<?php
							}
						}
						// Numer katalogowy EOF ////////////////////

						// Producent BOF ///////////////////////////
						if (CZY_PRODUCENT != '0' || !defined('CZY_PRODUCENT')) {
							if (tep_not_null($the_manufacturers['manufacturers_name'])) {
							?>
								<tr>
									<td class="ProductHead" width="50%"><?php echo '<b>' .BOX_HEADING_MANUFACTURER_INFO. '</b>' ?></TD>
									<td class="ProductHead" width="50%"><?php echo '<a class="boxLink" href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $the_manufacturers['manufacturers_id']) . '">' .$the_manufacturers['manufacturers_name'] . '</a>'; ?></TD>
								</tr>
							<?php
							}
						}
						// Producent EOF ///////////////////////////

						// Dostepnosc produktu BOF /////////////////
						if (CZY_DOSTEPNOSC != '0' || !defined('CZY_DOSTEPNOSC')) {
							if (tep_not_null($products_availability_info['products_availability_name']) && USE_SHOP_AS_CATALOG == 'false') {
							?>
								<tr>
									<td class="ProductHead" width="50%"><b><?php echo TEXT_AVAILABILITY; ?></b></td>
									<td class="ProductHead" width="50%"><?php echo $products_availability_name; ?></td>
								</tr>
							<?php
							}
						}
						// Dostepnosc produktu EOF /////////////////

						// Maksymalna ilosc zamawianych przedmiotow BOF
						if (CZY_MAX_ILOSC != '0' || !defined('CZY_MAX_ILOSC')) {
							if (tep_not_null($product_info['products_maxorder']) && MAXIMUM_ORDERS == 'true' && USE_SHOP_AS_CATALOG == 'false') {
								if ($product_info['products_maxorder'] > 0) {;
								?>
									<tr>
										<td class="ProductHead" width="50%"><b><?php echo MAXIMUM_ORDER_TEXT; ?></b></TD>
										<td class="ProductHead" width="50%"><?php echo ''.$product_info['products_maxorder'].''; ?></TD>
									</tr>
								<?php
								}
							}
						}
						// Maksymalna ilosc zamawianych przedmiotow BOF

						// Stan magazynowy BOF /////////////////
						if (CZY_STAN_MAGAZYNOWY != '0' || !defined('CZY_STAN_MAGAZYNOWY')) {
							if (USE_SHOP_AS_CATALOG == 'false' && STOCK_REORDER_LEVEL > 0) {
							?>
								<tr>
									<td class="ProductHead" width="50%"><?php echo '<b>' . TEXT_MAGAZYN .'</b>' ?></td>
                                    <?php if (JAKI_STAN_MAGAZYNOWY == '1') { ?>
									<td class="ProductHead" width="50%" align="left" valign="middle">
										<table width="45%" cellspacing="0" cellpadding="0" border="0">
											<tr>
												<td height="2px" width="10%" style="border-left:1px solid #000000; border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
												<td height="2px" width="10%" style="border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '2'); ?></td>
											</tr>
											<tr>
												<?php
												// jezeli liczba produktow = 0
												if ($product_info['products_quantity'] == 0) {
													$color_1 = 'ffffff';
													$color_2 = 'ffffff';
													$color_3 = 'ffffff';
													$color_4 = 'ffffff';
													$color_5 = 'ffffff';
												}
												// jezeli liczba produktow jest wieksza o 0 ale mniejsza o 1/2 liczby minimalnej
												if ($product_info['products_quantity'] > 0 && ($product_info['products_quantity'] <= (STOCK_REORDER_LEVEL/2))) {
													$color_1 = 'fe8f00';
													$color_2 = 'ffffff';
													$color_3 = 'ffffff';
													$color_4 = 'ffffff';
													$color_5 = 'ffffff';
												}
												// jezeli liczba produktow jest wieksza od 1/2 liczby minimalnej ale mniejsza od liczby minimalnej
												if ($product_info['products_quantity'] > 0 && (($product_info['products_quantity'] > (STOCK_REORDER_LEVEL/2)) && ($product_info['products_quantity'] <= (STOCK_REORDER_LEVEL)))) {
													$color_1 = 'fe8f00';
													$color_2 = 'fe8f00';
													$color_3 = 'ffffff';
													$color_4 = 'ffffff';
													$color_5 = 'ffffff';
												}
												// jezeli liczba produktow jest wieksza od liczby minimalnej ale mniejsza od 1,5 liczby minimalnej
												if ($product_info['products_quantity'] > 0 && (($product_info['products_quantity'] > (STOCK_REORDER_LEVEL)) && ($product_info['products_quantity'] <= (STOCK_REORDER_LEVEL*1.5)))) {
													$color_1 = 'fe8f00';
													$color_2 = 'fe8f00';
													$color_3 = 'fe8f00';
													$color_4 = 'ffffff';
													$color_5 = 'ffffff';
												}
												// jezeli liczba produktow jest wieksza od 1,5 liczby minimanlej ale mniejsza od 2-krotnosci liczby mininalnej
												if ($product_info['products_quantity'] > 0 && (($product_info['products_quantity'] > (STOCK_REORDER_LEVEL*1.5)) && ($product_info['products_quantity'] <= (STOCK_REORDER_LEVEL*2)))) {
													$color_1 = 'fe8f00';
													$color_2 = 'fe8f00';
													$color_3 = 'fe8f00';
													$color_4 = 'fe8f00';
													$color_5 = 'ffffff';
												}
												// jezeli liczba produktow jest wieksza od 2-krotnosci liczby minimalnej
												if ($product_info['products_quantity'] > 0 && ($product_info['products_quantity'] > (STOCK_REORDER_LEVEL*2))) {
													$color_1 = 'fe8f00';
													$color_2 = 'fe8f00';
													$color_3 = 'fe8f00';
													$color_4 = 'fe8f00';
													$color_5 = 'fe8f00';
												}
												?>
												<td height="4px" colspan="2" width="20%" style="background-color:#<?php echo $color_1; ?>; border-left:1px solid #000000; border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '4'); ?></td>
												<td height="4px" colspan="2" width="20%" style="background-color:#<?php echo $color_2; ?>; border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '4'); ?></td>
												<td height="4px" colspan="2" width="20%" style="background-color:#<?php echo $color_3; ?>; border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '4'); ?></td>
												<td height="4px" colspan="2" width="20%" style="background-color:#<?php echo $color_4; ?>; border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '4'); ?></td>
												<td height="4px" colspan="2" width="20%" style="background-color:#<?php echo $color_5; ?>; border-bottom:1px solid #000000; border-right:1px solid #000000"><?php echo tep_draw_separator('pixel_trans.gif', '1', '4'); ?></td>
											</tr>
										</table>
									</td>
                                    <?php } else { ?>
                                        <td class="ProductHead" width="50%" align="left" valign="middle">
                                        <?php echo $product_info['products_quantity'].' '.tep_get_products_jm_name($product_info['products_jm_id'], $languages_id); ?>
                                        </td>
                                    <?php } ?>
								</tr>
							<?php
							}
						}
						// Stan magazynowy EOF /////////////////

						// Jednostki miary BOF
						if (JEDNOSTKA_MIARY != '0' || !defined('JEDNOSTKA_MIARY')) {
                        if ( $product_info['products_jm_id'] ) {
							?>
							<tr>
								<td class="ProductHead" width="50%"><b><?php echo JEDNOSTKI_MIARY; ?></b></td>
								<td class="ProductHead" width="50%"><?php echo tep_get_products_jm_name($product_info['products_jm_id'], $languages_id); ?></TD>
							</tr>
							<?php
						}
                        }
						// Jednostki miary BOF

						// Ocena towaru BOF /////////////////
						if (CZY_SREDNIA_OCENA != '0' || !defined('CZY_SREDNIA_OCENA')) {
							if (USE_SHOP_AS_CATALOG == 'false') {
								$reviews_tablica = tep_db_query("select r.reviews_id, r.reviews_rating from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where approved = 1 and r.products_id = '" . (int)$product_info['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "'");
								$licznik = 0;
								$suma = 0;
								while ($reviews_info = tep_db_fetch_array($reviews_tablica)) {
									   $licznik++;
									   $suma = $suma + $reviews_info['reviews_rating'];
								}
								if ($licznik > 0) {
										$srednia = $suma / $licznik;
										if ($srednia > 0 && $srednia <= 1) {
											$srednia = tep_image(DIR_WS_TEMPLATES . 'images/misc/stars_1.gif');
										}
										if ($srednia > 1 && $srednia <= 2) {
											$srednia = tep_image(DIR_WS_TEMPLATES . 'images/misc/stars_2.gif');
										}
										if ($srednia > 2 && $srednia <= 3) {
											$srednia = tep_image(DIR_WS_TEMPLATES . 'images/misc/stars_3.gif');
										}
										if ($srednia > 3 && $srednia <= 4) {
											$srednia = tep_image(DIR_WS_TEMPLATES . 'images/misc/stars_4.gif');
										}
										if ($srednia > 4) {
											$srednia = tep_image(DIR_WS_TEMPLATES . 'images/misc/stars_5.gif');
										}
									}
								   else {
									$srednia = NONE_REVIEWS;
								}
								?>
								<tr>
									<td class="ProductHead" width="50%"><b><?php echo TEXT_PRODUCT_INFO_REVIEWS; ?></b></TD>
									<td class="ProductHead" width="50%">
										<table border="0" cellspacing="0" cellpadding="0" width="100%">
												<tr>
													<td class="ProductHead"><?php echo $srednia; ?></td>
												</tr>
												<?php
												if ($licznik > 0) {
												?>
												<tr>
													<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '2'); ?></td>
												</tr>
												<?php if (CZY_RECENZJE != '0' || !defined('CZY_RECENZJE')) { ?>
												<tr>
													<td><a class="boxLink" href="javascript:wyswietl('3');">&nbsp;<?php echo TEXT_CURRENT_REVIEWS . ' ' . $licznik; ?></a></td>
												</tr>
												<?php
												}
												}
												?>
										</table>
									</td>
								</tr>
							<?php
							}
						}

                        // Dodatkowe pola opisowe
                        if (JAK_DODATKOWE_POLA == '0') {
                            $extra_fields_query = tep_db_query("
                            SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value
                                FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef
                                LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf
                                ON ptf.products_extra_fields_id=pef.products_extra_fields_id
                                WHERE ptf.products_id=" . (int)$HTTP_GET_VARS['products_id']." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
                                ORDER BY products_extra_fields_order");

                            while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
                                if (! $extra_fields['status'])
                                continue;
                                echo '<tr>';
                                echo '<td class="ProductHead" width="50%" valign="middle"><b>'.$extra_fields['name'].'</b></td>';
                                echo '<td class="ProductHead" width="50%" valign="middle">'.$extra_fields['value'].'</td>';
                                echo '</tr>';
                            }
                        }
                        // Dodatkowe pola opisowe

						?>
					</table>
					<?php } ?>
					<div align="center" class="main" style="padding-top:10px">
					<input type="hidden" name="current_photo_path" value="">
                    <?php if ($ile_dod_foto > 0) { ?>
					<table border="0" cellspacing="0" cellpadding="2">
						<?php
						require($modules_folder . FILENAME_ADDITIONAL_IMAGES); ?>
					</table>
                    <?php } ?>
					</div>
				</td>
				<?php } ?>
				</tr>
				<!-- Dodatkowe opcje produktu BOF /////////////-->
				<?php
				$query_price_to_guest_result = ALLOW_GUEST_TO_SEE_PRICES;
				if ((($query_price_to_guest_result=='true') && !(tep_session_is_registered('customer_id'))) || ((tep_session_is_registered('customer_id')))) {

					$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
					$products_attributes = tep_db_fetch_array($products_attributes_query);
					if ($products_attributes['total'] > 0) {
						if ($currencies->currencies[$currency]['symbol_right'] != '') {
							$symbol = trim($currencies->currencies[$currency]['symbol_right']);
							$nuPrice = eregi_replace($symbol,"",$nuPrice);
						} elseif ($currencies->currencies[$currency]['symbol_left'] != '') {
							$symbol = trim($currencies->currencies[$currency]['symbol_left']);
							$nuPrice = eregi_replace($symbol,"",$nuPrice);
						} elseif ($currencies->currencies[$currency]['symbol_left'] == '' && $currencies->currencies[$currency]['symbol_right'] == '' ) {
							$symbol = '';
							$nuPrice = $nuPrice;
						}
						?>
						<tr>
							<td align="center" class="main" valign="top" colspan="2" style="padding-top:8px">
								<table cellspacing="0" cellpadding="0" border="0" width="100%">
									<tr>
										<td valign="top" align="left" class="TableFrame">
											<input type="hidden" name="nuPrice" value="<?php echo eregi_replace($symbol,"",$nuPrice); ?>">
											<input type="hidden" name="vat_stawka" value="<?php echo $vat_stawka; ?>">
											<div id="dod_ceny" style="display:none">
											<?php
											$products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']);
												//++++ QT Pro: Begin Changed code //////////
												require(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
												$class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
												$pad = new $class($products_id);
												echo $pad->draw();
												//++++ QT Pro: End Changed Code ////////////
											?>
											</div>
											<script type="text/javascript" language="javascript">
											document.getElementById('dod_ceny').style.display = 'block';
											</script>
											<noscript><br>
											<span class="smallText">Brak obslugi JavaScript<br>Nie mozna wyswietlic dodatkowych opcji produktu !!</span>
											<br>&nbsp;</noscript>
										</td>
										<td>
											<!-- Cena z wyposazeniem dodatkowym BOF -->
											<?php
											require(DIR_WS_INCLUDES . 'javascript/price_with_attributes.js.php');
											?>
											<script type="text/javascript" language="javascript">
                                            showPrice(document.cart_quantity);
											</script>
											<!-- Cena z wyposazeniem dodatkowym EOF -->
										</td>
									</tr>
								</table>
							</td>
						</tr>
					<?php
					}
				}
				?>
				<!-- Dodatkowe opcje produktu EOF -->
				<!-- denuz products text attributes /////////////////////////////////// DODATKOWE POLA - CECHY TEKSTOWE -->
				<?php
				$sql = mysql_query("select pta.* from products_text_attributes as pta, products_text_attributes_enabled as ptae where ptae.products_text_attributes_id = pta.products_text_attributes_id and ptae.products_id = " . tep_get_prid($HTTP_GET_VARS['products_id']));
				$liczba_rek = mysql_num_rows($sql);
				if ($liczba_rek > 0) {
				?>
				<tr>
					<td align="left" valign="top" colspan="2" class="main">
						<table border="0" cellspacing="2" cellpadding="5" width="100%" class="TableFrame">
							<tr><td class="ProductHead"><strong><?php echo TEXT_POLA_TEKSTOWE; ?></strong></td></tr>
							<tr><td align="left">
								<table border="0" cellspacing="0" cellpadding="3">
									<?php
									  $text_attributes_query = tep_db_query("select pta.* from products_text_attributes as pta, products_text_attributes_enabled as ptae where ptae.products_text_attributes_id = pta.products_text_attributes_id and ptae.products_id = " . tep_get_prid($HTTP_GET_VARS['products_id']));
									  while ($text_attributes = tep_db_fetch_array($text_attributes_query)) {
										?>
										<tr>
											<td class="main"><b><?php echo $text_attributes['products_text_attributes_name'] . ': </b></td><td>' . tep_draw_input_field('products_text_attributes_' . $text_attributes['products_text_attributes_id'], '',' style="width:300px"'); ?></td>
										</tr>
										<?php
									  }
									?>
								</table>
							</td></tr>
						</table>
					</td>
				</tr>
				<?php } ?>
				<!-- eof denuz products text attributes /////////////////////////////////// DODATKOWE POLA - CECHY TEKSTOWE -->
				</table>
			</div>
          </div>
		</td>
	</tr>

  <?php
  if ( $czy_znizki_od_ilosci ) {
    if (tep_not_null($product_info['products_discount'])) {
      if( isset($product_info['products_discount']) && strlen($product_info['products_discount'])>2 ) {
        $first = true;
        $last = false;
        $tab_aff = array();
        $tab_percent = array();
        echo '<tr><td>' . tep_draw_separator('pixel_trans.gif', '100%', '5') . '</td></tr>';
        echo '<tr><td><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr><td>';
        $info_box_contents = array();
        $info_box_contents[] = array('text' => '<span class="productSpecialPrice">' . TEXT_HEAD_REDUC_QTY . '</span>' );
        if( $tranche = explode( ',', $product_info['products_discount'] ) ) {
          $index = 0;
          foreach( $tranche as $cle => $trn )
          if( $qty_px = explode( ':', $trn ) ) {
            $tab_aff[$index][0] = $qty_px[0];
            $tab_aff[$index][1] = $qty_px[1];
            $tab_percent[$index]['discount'] = 1;
            $tab_percent[$index]['percent'] = '';
            if( strstr($qty_px[1],'%') ) {
              $tab_percent[$index]['discount'] = (1-($qty_px[1]/100));
              $tab_percent[$index]['percent'] = '%';
            }
            $index++;
          }
          $new_price = tep_get_products_special_price($product_info['products_id']);
          for( $i=0; $i<$index; $i++) {
            if( $tab_percent[$i]['percent'] != '%' ) {
              if( $new_price > $tab_aff[$i][1] || $new_price==0 ) {
                $products_discount = $currencies->display_price($product_info['products_id'],$tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id']));
              } else {
                $products_discount = '<s>' . $currencies->display_price($product_info['products_id'],$tab_aff[$i][1], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($product_info['products_id'],$new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
              }
            } else {
              $products_discount = '-' . $tab_aff[$i][1];
            }
            if( $i==0 ) {
              if ( $new_price ) {
                $products_price_1 = '<s>' . $currencies->display_price($product_info['products_id'],$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($product_info['products_id'],$new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
              } else {
                $products_price_1 = $currencies->display_price($product_info['products_id'],$product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
              }
              $info_box_contents[] = array('align' => 'left', 'text' => sprintf( TEXT_QTY_PRIX_FIRST, $tab_aff[$i][0]-1 ) . '</td><td class="boxText">' . $products_price_1  );
              if( isset($tab_aff[$i+1][0]) ) {
                $info_box_contents[] = array('align' => 'left', 'text' => sprintf( ($tab_percent[$i]['percent'] != '%' ? TEXT_QTY_PRIX : TEXT_QTY_PRIX_PROCENT), $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_discount );
              } else {
                $info_box_contents[] = array('align' => 'left', 'text' => sprintf( ($tab_percent[$i]['percent'] != '%' ? TEXT_QTY_PRIX_LAST : TEXT_QTY_PRIX_LAST_PROCENT), $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_discount );
              }
            } elseif ( $i == ($index-1) ) {
              $info_box_contents[] = array('align' => 'left', 'text' => sprintf( ($tab_percent[$i]['percent'] != '%' ? TEXT_QTY_PRIX_LAST : TEXT_QTY_PRIX_LAST_PROCENT), $tab_aff[$i][0] ) . '</td><td class="boxText">' . $products_discount );
            } else {
              $info_box_contents[] = array('align' => 'left', 'text' => sprintf( ($tab_percent[$i]['percent'] != '%' ? TEXT_QTY_PRIX : TEXT_QTY_PRIX_PROCENT), $tab_aff[$i][0], $tab_aff[$i+1][0]-1 ) . '</td><td class="boxText">' . $products_discount  );
            }
          }
        }
        new infoBox($info_box_contents);
        echo '</td></tr></table></td></tr>';
      }
      ?>
      <tr>
        <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td>
      </tr>
      <?php
    }
  }
	?>

	<?php
	if ((USE_POINTS_SYSTEM == 'true') && (DISPLAY_POINTS_INFO == 'true')) {  // Points/Rewards system V2.1rc2a BOF
	?>
		<?php
		// Points/Rewards system V2.1rc2a BOF
		if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
			if (CZY_OBLICZAC_UPUST_DLA_PROMOCJI == true) {
				$products_price_points = tep_display_points(pokaz_upust($new_price,$product_info['products_id']), tep_get_tax_rate($product_info['products_tax_class_id']));
				} else {
				$products_price_points = tep_display_points($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
			}
		} else {
			$products_price_points = tep_display_points(pokaz_upust($product_info['products_price'],$product_info['products_id']), tep_get_tax_rate($product_info['products_tax_class_id']));
		}
		$products_points = tep_calc_products_price_points($products_price_points);
		$products_points_value = tep_calc_price_pvalue($products_points);
		if ((USE_POINTS_FOR_SPECIALS == 'true') || $new_price == false) {
			?>
			<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '5'); ?></td></tr>
			<tr>
				<td align="center" class="TableFrame" style="padding:8px">
					<?php
					echo '<span class="smallText" style="color:#ff0000">';
					echo sprintf(TEXT_PRODUCT_POINTS , number_format($products_points,POINTS_DECIMAL_PLACES), $currencies->format($products_points_value));
          if ( NEW_SIGNUP_POINT_AMOUNT != '0' ) {
					  echo '<br>'.sprintf(TEXT_PRODUCT_POINTS_NEW_CUSTOMER , NEW_SIGNUP_POINT_AMOUNT);
          }
					echo '</span>';
					?>
				</td>
			</tr>
			<?php
		}
		// Points/Rewards system V2.1rc2a EOF
		?>
	<?php
	}
	?>

    <?php
    if ($module_download == true) {
        module_download($product_info['products_id']);
    }
    ?>

	<tr>
		<td style="padding-top:8px">
			<table border="0" cellspacing="0" cellpadding="0" width="100%">
				<?php if (ZAKLADKI_OPCJE == 'true') { ?>
				<tr><td align="left" style="padding-left:5px">
					<table border="0" cellspacing="0" cellpadding="0"><tr>
						<?php echo separator().zakladka(ZAKLADKA_OPIS,'1','on'); ?>
						<?php echo separator().zakladka(ZAKLADKA_LINKI,'2'); ?>
						<?php if (CZY_RECENZJE != '0' || !defined('CZY_RECENZJE')) { ?>
                            <?php echo separator().zakladka(ZAKLADKA_RECENZJE,'3'); ?>
						<?php } ?>
					</tr></table>
				</td></tr>
				<?php } ?>
				<?php if (ZAKLADKI_OPCJE == 'true') { ?>
					<tr><td class="TableFrame">
				  <?php } else { ?>
				     <tr><td>
				<?php } ?>
				   <div id="tresc">
					<div id="content_1">
						<!-- Opis produktu BOF ////////////////////////////////////////////////////-->
						<?php
						if (ZAKLADKI_OPCJE != 'true') {
						?>
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td align="right" class="subTileModule" style="padding:6px"><b><?php echo PRODUCT_INFO_DESCRIPTION; ?></b></td>
							</tr>
						</table>
						<?php
						}
						?>
						<table width="100%" cellspacing="5" cellpadding="0" border="0" <?php echo ((ZAKLADKI_OPCJE != 'true') ? 'class="TableFrame"' : '') ?>>
							<tr>
								<td class="main">
									<?php echo stripslashes($product_info['products_description']); ?>
								</td>
							</tr>
							<!-- Dodatkowe pola w opisie produktu BOF -->
                            <?php if (JAK_DODATKOWE_POLA == '1') { ?>
							<tr>
								<td class="main">
									<?php
									$extra_fields_query = tep_db_query("
									SELECT pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value
										FROM ". TABLE_PRODUCTS_EXTRA_FIELDS ." pef
										LEFT JOIN  ". TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS ." ptf
										ON ptf.products_extra_fields_id=pef.products_extra_fields_id
										WHERE ptf.products_id=" . (int)$HTTP_GET_VARS['products_id']." and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='".$languages_id."')
										ORDER BY products_extra_fields_order");

									while ($extra_fields = tep_db_fetch_array($extra_fields_query)) {
										if (! $extra_fields['status'])  // show only enabled extra field
										continue;
										echo '<b>'.$extra_fields['name'].': </b>';
										echo $extra_fields['value'].'<BR>';
									}
									?>
								</td>
							</tr>
                            <?php } ?>
							<!-- Dodatkowe pola w opisie produktu EOF -->
							<!-- Opis EOF -->
						</table>
						<!-- Opis produktu EOF ////////////////////////////////////////////////////-->
					</div>
					<div id="content_2">
						<!-- Dodatkowe linki BOF //////////////////////////////////////////////////-->
						<?php
						if (ZAKLADKI_OPCJE != 'true') {
						?>
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td align="right" class="subTileModule" style="padding:6px"><b><?php echo ZAKLADKA_LINKI; ?></b></td>
							</tr>
						</table>
						<?php
						}
						?>
						<table cellspacing="3" cellpadding="2" border="0" <?php echo ((ZAKLADKI_OPCJE != 'true') ? 'class="TableFrame"' : '') ?>>
							<?php if (tep_not_null($product_info['products_image_pop'])) { ?>
							<tr>
								<td class="main">&raquo;</td><td class="main"><?php echo '<a href="' . DIR_WS_IMAGES . $product_info['products_image_pop'] .'" target="_blank">' . TEXT_PDF_FILE . ' ' .tep_image(DIR_WS_TEMPLATES.'images/misc/icons/pdf.png',TEXT_PDF_DOWNLOAD) .'</a>'; ?>
								</td>
							</tr>
							<?php } ?>
							
							<?php if (CZY_PDF != '0' || !defined('CZY_PDF')) { ?>
							<tr>
								<td class="main">&raquo;</td><td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PDF_DATASHEET, 'products_id=' . $product_info['products_id']) .'" target="_blank">' . TEXT_PDF_DOWNLOAD . ' ' .tep_image(DIR_WS_TEMPLATES.'images/misc/icons/pdf.png',TEXT_PDF_DOWNLOAD) .'</a>'; ?>
								</td>
							</tr>
							<?php } ?>

							<?php
							if (CZY_WIECEJ_INFORMACJI != '0' || !defined('CZY_WIECEJ_INFORMACJI')) {
								if (tep_not_null($product_info['products_url'])) {
									?>
									<tr>
										<td class="main">&raquo;</td><td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?>
										</td>
									</tr>
									<?php
								}
							}
							?>

							<?php if (CZY_INFORMUJ != '0' || !defined('CZY_INFORMUJ')) { ?>
							<tr>
								<td class="main">&raquo;</td><td class="main">
									<?php
									if (tep_session_is_registered('customer_id')) {
										$check_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and customers_id = '" . $customer_id . "'");
										$check = tep_db_fetch_array($check_query);
										$notification_exists = (($check['count'] > 0) ? true : false);
									} else {
										$notification_exists = false;
									}
									if ($notification_exists == true) {
										echo '<a class="boxLink" href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify_remove', $request_type) . '">' . sprintf(BOX_NOTIFICATIONS_NOTIFY_REMOVE, tep_get_products_name($HTTP_GET_VARS['products_id'])) .'</a>';
									} else {
										echo '<a class="boxLink" href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=notify', $request_type) . '">' . sprintf(BOX_NOTIFICATIONS_NOTIFY, tep_get_products_name($HTTP_GET_VARS['products_id'])) .'</a>';
									}
									?>
								</td>
							</tr>
							<?php } ?>

							<tr>
								<td class="main">&raquo;</td><td class="main">
									<a class="boxLink" href="ask_a_question.php?products_id=<?php echo $product_info['products_id']; ?>"><?php echo '' . TEXT_ASK_QUESTION . ''; ?></a>
								</td>
							</tr>
						</table>
						<!-- Dodatkowe linki EOF -->
					</div>
					<?php if (CZY_RECENZJE != '0' || !defined('CZY_RECENZJE')) { ?>
					<div id="content_3">
						<!-- Komentarze BOF -->
						<?php
						$reviews_query = tep_db_query("select r.reviews_id, left(rd.reviews_text, 100) as reviews_text, r.reviews_rating, r.date_added, r.customers_name from " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd where r.approved = '1' and r.products_id = '" . (int)$product_info['products_id'] . "' and r.reviews_id = rd.reviews_id and rd.languages_id = '" . (int)$languages_id . "' order by r.reviews_id desc");
						$reviews_ilosc_pozycji = mysql_num_rows($reviews_query);
						?>
						<?php
						if ($reviews_ilosc_pozycji > 0) {
						require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_REVIEWS);
						if (ZAKLADKI_OPCJE != 'true') {
						?>
						<table width="100%" cellspacing="0" cellpadding="0" border="0">
							<tr>
								<td align="right" class="subTileModule" style="padding:6px"><b><?php echo ZAKLADKA_RECENZJE; ?></b></td>
							</tr>
						</table>
						<?php
						}
						?>
						<table width="100%" cellspacing="5" cellpadding="0" border="0" <?php echo ((ZAKLADKI_OPCJE != 'true') ? 'class="TableFrame"' : '') ?>>
							<tr>
								<td>
									<table border="0" width="100%" cellspacing="0" cellpadding="4">
										<tr>
											<td class="main" align="left"><?php echo TEXT_CURRENT_REVIEWS . ' <b>' . $reviews_ilosc_pozycji . '</b>'; ?></td>
											<td class="main" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, tep_get_all_get_params()) . '">' . tep_image_button('button_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a>'; ?></td>
										</tr>
										<tr>
											<td width="100%" colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '100%', '8'); ?></td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td>
								   <table border="0" width="100%" cellspacing="0" cellpadding="2">
									<?php
									 while ($reviews = tep_db_fetch_array($reviews_query)) {
									  ?>
									  <tr>
										   <td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $product_info['products_id'] . '&reviews_id=' . $reviews['reviews_id']) . '"><u><b>' . sprintf(TEXT_REVIEW_BY, tep_output_string_protected($reviews['customers_name'])) . '</b></u></a>'; ?></td>
										   <td class="smallText" align="right"><?php echo sprintf(TEXT_REVIEW_DATE_ADDED, tep_date_long($reviews['date_added'])); ?></td>
									  </tr>
									  <tr>
									       <td style="padding-bottom:10px;padding-left:10px;padding-right:10px" colspan="2" class="main">
												<?php echo tep_break_string(tep_output_string_protected($reviews['reviews_text']), 60, '-<br>') . ((strlen($reviews['reviews_text']) >= 100) ? '..' : '') . '<br><br><i>' . sprintf(TEXT_REVIEW_RATING, tep_image(DIR_WS_TEMPLATES . 'images/misc/stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])), sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])) . '</i>'; ?>
										   </td>
									  </tr>
									  <?php
									 }
									?>
								   </table>
								</td>
							</tr>
						</table>
						<?php
						} else {
						?>
							<?php
							if (ZAKLADKI_OPCJE != 'true') {
							?>
							<table width="100%" cellspacing="0" cellpadding="0" border="0">
								<tr>
									<td align="right" class="subTileModule" style="padding:6px"><b><?php echo ZAKLADKA_RECENZJE; ?></b></td>
							</table>
							<?php
							}
							?>
							<table width="100%" cellspacing="5" cellpadding="0" border="0" <?php echo ((ZAKLADKI_OPCJE != 'true') ? 'class="TableFrame"' : '') ?>>
								<tr>
									<td class="main">
										&nbsp;<b><?php echo TEXT_NONE_REVIEWS; ?></b>
									</td>
								</tr>
								<tr>
									<td class="main">
										<?php
										if (isset($HTTP_GET_VARS['products_id'])) {
										?>
										<table width="100%" cellspacing="0" cellpadding="2" border="0">
										  <tr>
											   <td class="main" align="left" style="padding:3px"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, tep_get_all_get_params()) . '">' . tep_image_button('button_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a>'; ?></td>
										  </tr>
										</table>
										<?php
										}
										?>
									</td>
								</tr>
						</table>
						<?php
						}
						// Komentarze EOF
						?>
					</div>
					<?php } ?>
				   </div>
				</td></tr>
			</table>
			<?php if (ZAKLADKI_OPCJE == 'true') { ?>
			<script type="text/javascript" language="Javascript">
			function zmien_css(pole,status) {
			var elem_left = document.getElementById('pane_l_'+pole); var elem_right = document.getElementById('pane_r_'+pole);
			if (elem_left.className != 'pane_left_on') { if (status == 'on') { elem_left.className = 'pane_left_hover'; elem_right.className = 'pane_right_hover'; } else { elem_left.className = 'pane_left'; elem_right.className = 'pane_right'; }} }
			//
			var licz_div=document.getElementById("tresc").getElementsByTagName('div').length;
			for (i=1;i<=licz_div;i++) {
                if (document.getElementById('pane_l_'+i)) { if (document.getElementById('pane_l_'+i).className != 'pane_left_on') { document.getElementById("content_"+i).style.display = 'none'; } }
            }
			//
			function wyswietl(nr) {
			var licz_div=document.getElementById("tresc").getElementsByTagName('div').length;
			for (i=1;i<=licz_div;i++) { if (document.getElementById('pane_l_'+i)) { document.getElementById("content_"+i).style.display = 'none'; document.getElementById("pane_l_"+i).className = 'pane_left'; document.getElementById("pane_r_"+i).className = 'pane_right';}}
			document.getElementById("content_"+nr).style.display = 'block'; document.getElementById("pane_l_"+nr).className = 'pane_left_on'; document.getElementById("pane_r_"+nr).className = 'pane_right_on'; }
			</script>
			<?php } ?>
		</td>
	</tr>

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

	<?php if (CZY_DATA_DODANIA != '0' || !defined('CZY_DATA_DODANIA')) { ?>
	<tr>
		<td class="smallText" align="center">
			<?php
			if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
				echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available']));
			} else {
				echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added']));
			}
			?>
		</td>
	</tr>
	<?php } ?>

    <?php
    if ($module_videos == true) {
        module_videos($product_info['products_id']);
    }
    ?>

	<?php
	// Previous/Next Product Buttons v3.2 ////////////////////////////////////////
	if (CZY_PRZYCISKI != '0' || !defined('CZY_PRZYCISKI')) {
		if ($product_check['total'] >= 1) {
			?>
			<tr>
				<td style="padding-top:25px;padding-bottom:5px">
					<table border="0" width="100%" cellspacing="0" cellpadding="2" class="TableFrame">
						<?php include (DIR_WS_INCLUDES . 'products_next_previous.php'); ?>
					</table>
				</td>
			</tr>
			<?php
		}
	}
	?>

	<?php if (CZY_PODOBNE != '0' || !defined('CZY_PODOBNE')) { ?>
	<tr>
		<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '3'); ?></td>
	</tr>
	<tr>
		<td>
			<?php
			include($modules_folder . FILENAME_RELATED_PRODUCTS);
			?>
		</td>
	</tr>
	<?php
	}
	}
	?>
</table>
</form>

<?php if (CZY_INNE_ZAKUPY != '0' || !defined('CZY_INNE_ZAKUPY')) {
    if ((USE_CACHE == 'true') && empty($SID)) {
        echo '<table width="100%" cellspacing="0" cellpadding="2"><tr><td>';
        echo tep_cache_also_purchased(3600);
        echo '</td></tr></table>';
    } else {
        echo '<table width="100%" cellspacing="0" cellpadding="2"><tr><td>';
        include($modules_folder . FILENAME_ALSO_PURCHASED_PRODUCTS);
        echo '</td></tr></table>';
    }
}

if (CZY_INNE_PRODUKTY != '0' || !defined('CZY_INNE_PRODUKTY')) {
    echo '<table width="100%" cellspacing="0" cellpadding="2"><tr><td>';
    include($modules_folder . FILENAME_OTHER_PRODUCTS);
    echo '</td></tr></table>';
}
?>