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;
}



function addFav(movieid)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="favorite_add.php";
	url=url+"?movieid="+movieid;

	xmlHttp.onreadystatechange=function()
	{
	  if (xmlHttp.readyState==4)
	  { 
		document.getElementById("favorite").innerHTML=xmlHttp.responseText;
		document.getElementById("favoriteb").style.display='block';
	  }
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	document.getElementById("favorite").innerHTML='<img src="http://www.amateurpipe.com/images/loading.gif" border="0" alt="Loading...">';
	document.getElementById("favoriteb").style.display='block';
}


function share()
{
	var srcElement = document.getElementById("addthis");
	if (srcElement != undefined)
	{
		if(srcElement.style.display=="block")
			srcElement.style.display = 'none';
		else
			srcElement.style.display = 'block';
	}
}

function rateMe(cid, rate)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="rating_add.php";
	url=url+"?cid="+cid+"&rate="+rate;

	xmlHttp.onreadystatechange=function()
	{
	  if (xmlHttp.readyState==4)
	  { 
		document.getElementById("kudos").innerHTML=xmlHttp.responseText;
	  }
	}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	document.getElementById("kudos").innerHTML='<img src="http://www.amateurpipe.com/images/loading.gif" border="0" alt="Loading...">';
}