xmlhttp=null;
xmlhttp2=null;
// code for Mozilla, etc.
if (window.XMLHttpRequest)
{
	xmlhttp=new XMLHttpRequest();
	xmlhttp2=new XMLHttpRequest();
}
// code for IE
else if (window.ActiveXObject)
{
	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
}

function negrep(pid)
{
	var ajaxDisplay = "postrep_"+(pid.toString());
	if(xmlhttp)
	{ 
		var queryString = "&pid="+(pid.toString());
		xmlhttp.open("GET", "xmlhttp.php?action=negrep"+queryString, true);
  	xmlhttp.onreadystatechange= function()
 		{
			if(xmlhttp.readyState==4)
 			{	
				document.getElementById(ajaxDisplay).innerHTML = xmlhttp.responseText;
				showrep(pid);
			}
			else
			{
				document.getElementById(ajaxDisplay).innerHTML = '<img src="./images/spinner.gif" />';
			}
 		}
		xmlhttp.send(null)
 	}
}

function posrep(pid)
{
	var ajaxDisplay = "postrep_"+(pid.toString());
	if(xmlhttp)
	{ 
		var queryString = "&pid="+(pid.toString());
		xmlhttp.open("GET", "xmlhttp.php?action=posrep"+queryString, true);
  	xmlhttp.onreadystatechange= function()
 		{
 			if(xmlhttp.readyState==4)
 			{	
				document.getElementById(ajaxDisplay).innerHTML = xmlhttp.responseText;
				showrep(pid);
			}
			else
			{
				document.getElementById(ajaxDisplay).innerHTML = '<img src="./images/spinner.gif" />';
			}
 		}
		xmlhttp.send(null)
 	}
}

function showrep(pid)
{
  var ajaxDisplay2 = "fr_votes_"+(pid.toString());
  var ajaxDisplay3 = "fr_votes_"+(pid.toString())+"_r";
  if(xmlhttp2)
	{ 
		var queryString2 = "&pid="+(pid.toString());
		xmlhttp2.open("GET", "xmlhttp.php?action=showrep"+queryString2, true);
  	xmlhttp2.onreadystatechange= function()
 		{
			if(xmlhttp2.readyState==4)
 			{	
				document.getElementById(ajaxDisplay2).innerHTML = xmlhttp2.responseText;
			}
			else
			{
        document.getElementById(ajaxDisplay3).style.display = "";
				document.getElementById(ajaxDisplay2).innerHTML = '<img src="./images/spinner.gif" />';
			}
 		}
		xmlhttp2.send(null)
 	}
}

function getAllVotes(id)
{
	document.getElementById(id).style.display = "block";
	document.getElementById(id).style.visibility = "visible";
}

function hideAllVotes(id)
{
	document.getElementById(id).style.display = "none";
	document.getElementById(id).style.visibility = "hidden";
}
