var product_show_case = {
	init: function() {
		$("#btnAddToCart, #btnTellFriend").corner();
		window.images = images.filter(function(img) {
			return img.length > 0;
		});
		var selected_image_index = 0;
		for (var i=0, n = images.length; i < n; i++) {
			$("#thumbnail_images").append("<img index='" + i + "' class='thumbnail_image' src='" + directory + images[i] + "' />")
		}
		// thumbnail
		$("#thumbnail_images img").click(function() {
			var el_index = parseInt($(this).attr("index"), 10);
			if (selected_image_index === el_index) { return ; }
			selected_image_index = el_index;
			changeShowCaseImage($(this).attr("src"));
			return false;
		}).hover(function() { $(this).addClass("hover"); }, 
				 function() { $(this).removeClass("hover"); }
		);
	
		// close button
		$("div.close_button").click(function() {
			closeShowCase();
		});

		// big image
		$("img#showCaseBigImage").click(function() {
			if (images.length === 1) { return ; }
			selected_image_index++;
			if (selected_image_index >= images.length) {
				selected_image_index = 0;
			}
			changeShowCaseImage(directory + images[selected_image_index]);
		});
	}
};