//functions for the product page javascript





//java gallery functionality
//dev: OS
//date: 31-10-08
var mainImage = 1;
var thumb1 = 2;
var thumb2 = 3;
var thumb3 = 4;
function ImageSwap(intProduct,intImage){
main_ext = document.getElementById('main_image').src.substring(document.getElementById('main_image').src.length-3);
tmb_ext = document.getElementById('thumb_'+intImage).src.substring(document.getElementById('thumb_'+intImage).src.length-3);
//popup_ext = document.getElementById('main_image').src.substring(document.getElementById('main_image').src.length-3);
//lrg_ext = document.getElementById('large_image_link').src.substring(document.getElementById('large_image_link').src.length-3);
//alert(ext1);
//alert(intImage)
	if (this["thumb"+intImage]!=1){
		document.getElementById('main_image').src="images/products/product_"+eval("thumb"+intImage)+"_"+intProduct+"."+tmb_ext;
	}else{
		
		
		
		document.getElementById('main_image').src="images/products/product_"+intProduct+"."+tmb_ext;document.getElementById('large_image_link').href="javascript:popupWindow('popup.asp?images/products/product_"+intProduct+"_popup."+main_ext+"');"
	
	}

	
	if (mainImage!=1){
		document.getElementById('thumb_'+intImage).src="images/products/product_"+mainImage+"_"+intProduct+"_thumb."+main_ext
		
	}else{
		document.getElementById('thumb_'+intImage).src="images/products/product_"+intProduct+"_thumb."+main_ext
		
		
	}
	tmp = mainImage
	mainImage=eval("thumb"+intImage);
	
	
	
	//modify the 'view larger image' link
	if (mainImage!=1){
		if (eval("popext"+intImage) !=''){
			document.getElementById('large_image_link').href="images/products/product_"+mainImage+"_"+intProduct+"_popup."+eval("popext"+intImage)
			document.getElementById('view_larger').style.display='block'
		}else{
			document.getElementById('view_larger').style.display='none'	
			}
	
	}else{
		if (eval("popext"+intImage) !=''){
			document.getElementById('large_image_link').href="images/products/product_"+intProduct+"_popup."+eval("popext"+intImage)
			document.getElementById('view_larger').style.display='block'
		}else{
			document.getElementById('view_larger').style.display='none'	
		}
		
	}	
	
	this["thumb"+intImage] = tmp
}