$(document).ready(function(){
	$("#variant_select").change(function(){
    	var variant_value = $("#variant_select").val();
    	var eshop_product_page = $("input[name='eshop_product_page']").val();
    	
    	$("input[name='product_id']").val(variant_value);
    	
    	if (variant_value > 0)
		{ 
			$.getJSON(eshop_product_page, { variant: variant_value }, function(data){
				if (data.result == "ok")
				{
					$(".price_value").html(data.price_value);
					$(".eshop_detail_text").html(data.eshop_detail_text);
					$("div.image img.product_image").attr({src: data.eshop_product_image_thumbnail});
					$("div.image a").attr({href: data.eshop_product_image});
					$(".product_photos li.first a").attr({id: data.first_photo_page_id});
					$(".product_photos li.first a img").attr({src: data.photo_gallery_image_thumbnail});
				}
			});
		}
	});
	/*
	// jQZoom
	var options =
	{
		zoomWidth: 400,
		zoomHeight: 400,
		xOffset: 10,
		yOffset: 2,
		position: "right"
	}
	$(".jqzoom").jqzoom(options);
	*/
	$(".show-photo").click(function(){
		var eshop_product_page = $("input[name='eshop_product_page']").val();
		var image_id = $(this).attr('id');
		
		if (image_id > 0)
		{ 
			$.getJSON(eshop_product_page, { image: image_id }, function(data){
				if (data.result == "ok")
				{
					$("div.image img.product_image").attr({src: data.eshop_product_image_thumbnail});
					$("div.image a").attr({href: data.eshop_product_image});
				}
			});
		}
	});
	
});
