var xmlHttpColor

var loadstatustext="<FONT style=BACKGROUND-COLOR: #990033 color=#ff0033><STRONG><FONT color=#123B69>&nbsp;Loading....</FONT></STRONG></FONT>";
var productImagePath
function showColorVariants(productId, productColourId, path)
{
	if (productColourId.length==0)
	{ 
		return
	}
	productImagePath = path;
	xmlHttpColor=getHTTPObject()
	if (xmlHttpColor==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
//	var productId = document.getElementById("productId").value;
	var url="products/showColorVariants.php"
	url=url+"?productId="+productId+"&productColourId="+productColourId
	url=url+"&stid="+Math.random()
	xmlHttpColor.onreadystatechange=getColorDetails 
	xmlHttpColor.open("GET",url,true)
	xmlHttpColor.send(null)

} 

function getColorDetails() 
{ 
	if (xmlHttpColor.readyState==4 || xmlHttpColor.readyState=="complete")
	{
		if(xmlHttpColor.responseText!="") {
			var result =  xmlHttpColor.responseText;
			result	= result.split("|");
			
			//Change the image
			document.getElementById("mainProductImage").src = productImagePath + result[0];
			
			//Updates the Image URL of <A>
			document.getElementById("mainProductImageLink1").setAttribute('href', productImagePath + result[0] );
			document.getElementById("mainProductImageLink2").setAttribute('href', productImagePath + result[0] );
			
			document.getElementById("colourId").value = result[1];
		}
	} 
} 
