// JavaScript Document

// function to show alt images
function switchImages(TheImageSource,obj) {		
	//Set the source image (Image clicked) information
	var SourceImage = TheImageSource;
	var SourceImageAlt = obj.alt;
	var SourceImageTitle = obj.title;
	
	//Set the destination detail image to be the clicked alt image
	document.getElementById("MainProdImage").src = SourceImage;		
	document.getElementById("MainProdImage").alt = SourceImageAlt;	
	document.getElementById("MainProdImage").title = SourceImageTitle;	
			
	document.getElementById("EnlargeLink").href = SourceImage.replace('dt','en');
	//document.getElementById("EnlargeLinkID2").href = 'images/ProductImages/en_'+SourceImage;
}


//function to check the product fields
function CheckProductFields() {
	var TotalAttributesNotSelected = 0;
	var TotalAttributes = document.ProductForm.TotalAttributes.value;
	var AttributeList = document.ProductForm.AttributeList.value;
	var AttributeListSplit = AttributeList.split(",");
	
	if(TotalAttributes > 0) {		
		for(i=0;i<=TotalAttributes-1;i++) {	
			var AttributeVal = AttributeListSplit[i];
			
			if(eval("document.ProductForm.ProductAttribute"+AttributeVal+".selectedIndex") == 0) {
				TotalAttributesNotSelected = 1;
				var OptionTitle = eval("document.ProductForm.ProductAttribute"+AttributeVal+".title");
				alert("A "+OptionTitle.toLowerCase()+" option must be selected.");
				return false;				
			}
		}
	}		
	
}