/*
	Javascript to open show a last inserted product image in the cart box.
	The image is shown, if the pointer is over the product name in the cart box
	Dummy with no effect!!!
	author: ppu
	date:		08.05.09
	edit: 	21.07.09
*/

	/* cart box */
	function showProductImageCartBox (count,path) 
	{
			var counter = count - 1;
			var id = "cartBoxForm:lastInsertedTable:" + counter + ":lastInsertedCartBox";
			document.getElementById(id).src = path;		
	}
				
	function hideProductImageCartBox (count) 
	{
			var counter = count - 1;
			var id = "cartBoxForm:lastInsertedTable:" + counter + ":lastInsertedCartBox";
			document.getElementById(id).src = "./images/layout/spacer.gif";		
	}
	
	/* lastInsertProductsInCartBox */
	function showProductImage (count,path) 
	{
			var counter = count - 1;
			var id = "lastInsertedCartBoxForm:lastInsertedTable:" + counter + ":lastInsertedCartBox";
			document.getElementById(id).style.visibility = "visible";
			document.getElementById(id).src = path;		
	}			
	function hideProductImage (count) 
	{
			var counter = count - 1;
			var id = "lastInsertedCartBoxForm:lastInsertedTable:" + counter + ":lastInsertedCartBox";
			document.getElementById(id).style.visibility = "hidden";
			document.getElementById(id).src = "./images/layout/spacer.gif";		
	}
	
	/* Third view preview function for last inserted products in cart */
	function lastInsertedPreview(elem,number,name,price,imagePath)  
	{
			/* Text MouseOverEffect */
			if (elem.id.indexOf('cart:order:') != -1)
				elem.className="cartActiveTextElemMouseOver";
			else
				elem.className="lastInsertedProductMouseOver";		
			
			/* Preview div */
			document.getElementById('productIconPreviewDiv').className="lastInsertedProductIconPreviewDivMouseOver";
			
			/* Product infos */
			document.getElementById('productInfoPreview').innerHTML= number + "<br/>" + name + "<br/>" + price;
			
			/* Show preview icon */
			var previewId = "cartBoxForm:productIconPreview";
			document.getElementById(previewId).style.visibility = "visible";
			document.getElementById(previewId).src = imagePath;
	}
	
	/* Third view hide preview function for last inserted products in cart */
	function hideLastInsertedPreview(elem)  
	{ 
			/* Text MouseOutEffect */
			if (elem.id.indexOf('cart:order:') != -1)
				elem.className="cartActiveTextElemMouseOut";
			else
				elem.className="lastInsertedProductMouseOut";
		
			/* Preview div */
			document.getElementById('productIconPreviewDiv').className="lastInsertedProductIconPreviewDivMouseOut";
		
			/* Product infos */
			document.getElementById('productInfoPreview').innerHTML="";
		
			/* Hide preview icon */
			var previewId = "cartBoxForm:productIconPreview";
			document.getElementById(previewId).src = "./images/layout/spacer.gif";
			document.getElementById(previewId).style.visibility = "hidden";
	}
	
	/* show and hide a article preview below the cart box, if the mouse pointer is over the name/number of a cart product */
	function productPreviewInCartBox(active,elem,number,name,price,imagePath)  
	{
		if (active == 'true') {
			lastInsertedPreview(elem,number,name,price,imagePath)
		}
	}	
	function hideProductPreviewInCartBox(active,elem)  
	{
		if (active == 'true') {
			hideLastInsertedPreview(elem);
		}
	}
