var xmlHttp;


/* Ajax query file details */

function addToFavorites(contentId, cType)
{
	xmlHttp=GetXmlHttpObject();

	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	}

	var url = pagePathPrefix + "inc/local/ajax/addToFavorites.php";

	if (contentId && cType)
	{
		url=url+"?contentId=" + contentId + "&contentType=" + cType;
	
		xmlHttp.onreadystatechange=getOk;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
		//alert(url);
	}
}


/* Display resulting file details */

function getOk() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("addToFavorites").innerHTML= 'Added to Favorites';
	} 
}


/*****************
GENERAL PURPOSE
*****************/


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;
}
