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

<script Language="JavaScript1.1"  type="text/javascript">

	//Tablice na obrazki srednie i duze
	pictures = new Array();
	pictures_big = new Array();

	<?php
	//Wyswietlenie sredniego obrazka na stronie produktu
	$img_mid = tep_obrazek(DIR_WS_IMAGES . $product_info['products_image'], DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT);
	echo "pictures[0]=\"$img_mid\"\n";

	//Nalozenie znaku wodnego na obrazek
	if (IMAGE_WATERMARK == 'true') {
		echo "pictures_big[0]=\"image.php?main=$img_path$product_info[products_image]&watermark=watermark.png\"\n";
	} else {
		echo "pictures_big[0]=\"$img_path$product_info[products_image]\"\n";
	}

	//Sprawdzenie czy sa dodatkowe obrazki produktu
	$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'] . "'");

	$i = 1;
	$j = 1;
	if (!tep_db_num_rows($images_product)) {
	} else {
		while ($new_products = tep_db_fetch_array($images_product)) {

			//Wyswietlenie sredniego obrazka na stronie produktu
			$img_mid = tep_obrazek(DIR_WS_IMAGES . $new_products['popup_images'], DISPLAY_IMAGE_WIDTH, DISPLAY_IMAGE_HEIGHT);
			echo "pictures[$j]=\"$img_mid\"\n";

			//Nalozenie znaku wodnego na obrazek
			if (IMAGE_WATERMARK == 'true') {
        echo "pictures_big[$i]=\"image.php?main=$img_path$new_products[popup_images]&watermark=watermark.png\"\n";
      } else {
        echo "pictures_big[$i]=\"$img_path$new_products[popup_images]\"\n";
      }

			$j++;
			$i++;
		}
	}
	?>

	var current_picture=0;

	function LoadMidPicture(picture_index) {
		current_picture=picture_index;
		document.getElementById('big_photo_link0').href=pictures_big[picture_index];
		document.getElementById('big_photo_link1').href=pictures_big[picture_index];
		document.big_photo.src = pictures[picture_index];

		t=1;
		for (var n = 0; n < pictures_big.length; ++n) {
			if (n != parseInt(picture_index)) {
	            document.getElementById('big_photo_links'+t).href=pictures_big[n];
				document.getElementById('big_photo_s'+t).href=pictures_big[n];
				t++;
			}
		}
		return;
	}

</script>