var xmlHttp
var updateToID; // var to element on page
function addToTheWishList(bookID){
	xmlHttp=GetXmlHttpObject()
	if(xmlHttp==null){
		alert("Browser does not support HTTP Request");
		return;
	}; 
	
	var url="ajax/addToWishList.php";
	var qstr;
	qstr = "bookID="+bookID;
	updateToID = bookID;
	xmlHttp.onreadystatechange=SCaddToWishList;
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.send(qstr);
	if (xmlHttp.status == 200) { 
  		SCaddToWishList();
	}	
};

function SCaddToWishList(){ 
	if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 
		document.getElementById("spnWishList"+updateToID).innerHTML=xmlHttp.responseText;
	};
};
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;
};

