// JavaScript Document

var xmlHttp;

function showPreview(itemID) { 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request");
		return;
	} 
	document.getElementById("imgPrev").innerHTML="<p align=\"center\"><em>Please Wait&hellip; Loading Data&hellip;<\/em><br>&nbsp;<\/p><p>&nbsp;<br>&nbsp;<br>&nbsp;<\/p>";
	var url="prodImgView.cfm";
	url=url+"?q="+itemID;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=detailChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function detailChanged() { 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { 
		document.getElementById("imgPrev").innerHTML=xmlHttp.responseText;
		document.getElementById("imgPrev").style.display="block"; 
		document.getElementById("imgPrevBox").style.left="30%";
	} 
} 

function hidePreview() {
		document.getElementById("imgPrevBox").style.left="-9999px";		
}

function GetXmlHttpObject() { 
var objXMLHttp=null;
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}
