function voteit(vot,pid,mid)  
{
	
    if(!mid)
	{
		alert("Please Login Before rate a protest");
		document.location="http://www.iprotest.us/login.php";
		return false;	
	}
	
	info_x = document.getElementById('the_info_'+pid);
   	info_x.innerHTML = "Saving Your Vote..";
	
    getAJAX = getHTTPObject();
  
  if (getAJAX.readyState == 4 || getAJAX.readyState == 0) 
	{
	    
		getAJAX.open("GET","http://www.iprotest.us/rateprocess.php?vot=" + vot +"&pid=" + pid + "&mid=" + mid, true);
        getAJAX.onreadystatechange = function () 
		{
			if (getAJAX.readyState == 4)
			{
    	   		var str = String(getAJAX.responseText);
				var arr = str.split("|");
				info_x.innerHTML = arr[0];
			
				if(vot==0)
				{
					document.getElementById('nvt_'+pid).innerHTML=arr[1];
				}
				if(vot==1 )
				{
					document.getElementById('pvt_'+pid).innerHTML=arr[1];
				}
				if(document.getElementById('tvt_'+pid)){
				document.getElementById('tvt_'+pid).innerHTML=arr[2];
				}
			}
     	}
  		getAJAX.send(null);
	}
    
}



//initiates the XMLHttpRequest object


function getHTTPObject() 
{
  var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
  {
    try 
	{
      xmlhttp = new XMLHttpRequest();
    } 
	catch (e) 
	{
     
	  xmlhttp = false;
    }
  }	
  return xmlhttp;
}
