function GetXmlHttpObject()
{
	if (window.XMLHttpRequest) {
	  return new XMLHttpRequest();
	}
	if (window.ActiveXObject) {
	  return new ActiveXObject("Microsoft.XMLHTTP");
	}
	return null;
}

function InverseFav(id, type, baseURL, removetext, addtext)
{
http=GetXmlHttpObject();
if (http==null)
  {
  alert ("Your browser does not support favoriting (Either your living in 1988 or your browser settings are messed up)");
  return;
  }
  
var url = baseURL+"/profiles/fav.php5";
var params = "favid="+id+"&type="+type;
http.open("POST", url, true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");

http.onreadystatechange = function() {//Call a function when the state changes.
	if(http.readyState == 4) {
		if(http.responseText == "fav") //This means we successfully fav\'d the submission
		{
			document.getElementById("favtext").innerHTML = removetext;
		}
		else //Anything else means we either unfav\'d the submission or it somehow failed, so reset it
		{
			document.getElementById("favtext").innerHTML = addtext;
		}
	}
}
http.send(params);
}

function IncDL(id, baseURL)
{
http=GetXmlHttpObject();
if (http==null)
  {
  alert ("Your browser does not support favoriting (Either your living in 1988 or your browser settings are messed up)");
  return;
  }
  
var url = baseURL+"/download.php5";
var params = "dl="+id+"&increment="+id;
http.open("POST", url, true);

//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", params.length);
http.setRequestHeader("Connection", "close");
//We don't actually care what we get back from this. The only purpose is to notify the server of the download.
http.send(params);
}