// JavaScript Document
var xmlHttp;
var targetid;
function addtofavourit(portfolioimageid)
{ 
	//document.getElementById(outputid).innerHTML = "<div style='width:696px;height:154px;text-align:center;padding-top:20px;'><img src='images/loading.gif'></div>";
	var url= "portfolioimage_addtofavourit.php?portfolioimageid="+portfolioimageid;
	
	xmlHttp=GetXmlHttpObject(stateChanged); //Create XMLHTTPRequest object with Event Handler
	document.getElementById("divloading").style.display="";
	xmlHttp.open("GET", url , true) //Retrive data from specified url
	xmlHttp.send(null) //Trigger actual request with null because called with 'GET'
} 
function stateChanged() //Event Handler
{ 
	var opid = targetid;
	if (xmlHttp.readyState==4 || xmlHttp.readyState	=="complete")
	{ 
		//document.getElementById(opid).innerHTML=xmlHttp.responseText;
		document.getElementById("divloading").style.display="none";
		var result = new String(xmlHttp.responseText);
		var comp = new String("No image selected.");
		if (result != comp)
			document.getElementById("view_favourite").style.display="";
		//alert(xmlHttp.responseText);
	} 
} 
function addthisjumper(imageid)
{ 
	//document.getElementById(outputid).innerHTML = "<div style='width:696px;height:154px;text-align:center;padding-top:20px;'><img src='images/loading.gif'></div>";
	var url= "image_addtojumper.php?imageid="+imageid;
	xmlHttp=GetXmlHttpObject(stateChanged1); //Create XMLHTTPRequest object with Event Handler
	document.getElementById("divloading").style.display="";
	xmlHttp.open("GET", url , true) //Retrive data from specified url
	xmlHttp.send(null) //Trigger actual request with null because called with 'GET'
} 
function stateChanged1() //Event Handler
{ 
	var opid = targetid;
	if (xmlHttp.readyState==4 || xmlHttp.readyState	=="complete")
	{ 
		//document.getElementById(opid).innerHTML=xmlHttp.responseText;
		document.getElementById("divloading").style.display="none";
		var result = new String(xmlHttp.responseText);
		var comp = new String("No image selected.");
		if (result != comp)
			document.getElementById("view_shortlist").style.display="";
		//alert(xmlHttp.responseText);
	} 
} 
function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This feature is not compatible with Opera") 
		return 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 
		try
		{ 
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 
			return objXmlHttp
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled") 
			return 
		} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
}