function getHTTPObject()
{
	// code for Mozilla, etc.
	if (window.XMLHttpRequest)
  	{
  		xmlhttp=new XMLHttpRequest()
  	}
// code for IE
	else if (window.ActiveXObject)
  	{
  		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  	}
	return xmlhttp;
}
var http = getHTTPObject();
var ResponseText = "";

function handleHttpResponse1()
{
	var temp,tmpurl;
	if (http.readyState == 4)
	{
		ResponseText = Trim(http.responseText);
		temp = ResponseText.split("-"); 
		if(temp[0] == "LOGINERROR")
		{
			tmpurl = "index.php?file=m-login&iProductId=" + temp[1];
			
			window.location = tmpurl;
		}
		if(temp[0] == "ERROR")
		{
			alert("Error in Entering Wishlist");
		}
		if(temp[0] == "ALREADY")
		{
			alert("Already Added in your wishlist");
		}
		if(temp[0] == "SUCCESS")
		{
			alert("Added In your wishlist");
		}
  }
}

function AddWishList(iProductId)
{
	var url = "AJAX_wishlist.php?iProductId=";
	catID = iProductId;
		if(catID != "")
		{
			http.open("GET", url + escape(catID), true);
			//alert(url + escape(catID));
		   	isWorking = true;
	   		http.onreadystatechange = handleHttpResponse1;
	    	http.send(null);
		}


}
