// JavaScript Document

var xmlhttp;
var action;
//Get default image.
function GetProductDetails(prdId,actType)
{
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Browser does not support HTTP Request");
  return;
  }
	var url="GetAJAXData.php";
	url=url+"?q="+prdId;
	url=url+"&t="+actType;
	url=url+"&sid="+Math.random();
	action=actType;
	xmlhttp.onreadystatechange=stateChanged;
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}

function stateChanged()
{
	if (xmlhttp.readyState==4)
	{
		if(action=="img" || action=="abt" || action=="tech" || action=="loadimg")
			document.getElementById("divDetails").innerHTML=xmlhttp.responseText;
		if(action=="otherimg")
		{
			document.getElementById("divOtherPics").innerHTML=xmlhttp.responseText;
			// this initialises the scollpanes on the thumbnails of the items. 
				$('#divOtherPics').jScrollPane({showArrows:true});
		}
	}
	//xmlhttp=null;
} 

function GetXmlHttpObject()
{
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		return new XMLHttpRequest();
	}
	if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}