/*AJAX*/

var xmlHttp

// ADD TO WISHLIST
function addProductToWishlist(proid,userid,countryid)
{
	if(userid=='')
	{
		location.href='login.php';
	}
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	 	alert ("Browser does not support HTTP Request")
	 	return
	}
	var url="ajax-add-product-to-wishlist.php"
	url=url+"?proid="+proid
	url=url+"&userid="+userid
	url=url+"&countryid="+countryid
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedWishlist 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedWishlist() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("wishlistid").innerHTML=xmlHttp.responseText 
	} 
}

// DELETE FROM WISHLIST
function deleteFromWishlist(proid,userid,countryid,wishid)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	 	alert ("Browser does not support HTTP Request")
	 	return
	}
	var url="ajax-del-product-from-wishlist.php"
	url=url+"?proid="+proid
	url=url+"&userid="+userid
	url=url+"&countryid="+countryid
	url=url+"&wishid="+wishid
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedDel
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChangedDel() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("delid").innerHTML=xmlHttp.responseText
		document.getElementById("resposeId").style.display='block';
		document.getElementById("productId").style.display='none'; 
	} 
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
