function createXmlHttpRequestObject() 

{ 

// will store the reference to the XMLHttpRequest object 



 //var xmlHttp; 

// if running Internet Explorer 

/*   if(window.ActiveXObject) 

   { 

     try 

     { 

       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); 

	   

     } 

     catch (e) 

     { 

       xmlHttp = false; 

     } 

   } 

   // if running Mozilla or other browsers 

   else 

   { 

     try 

     { 

       xmlHttp = new XMLHttpRequest(); 

       alert(xmlHttp);

     } 

     catch (e) 

     { 

       xmlHttp = false; 

     } 

 }  

 

   // return the created object or display an error message 

   if (!xmlHttp) 

     alert("Error creating the XMLHttpRequest object."); 

   else 

     return xmlHttp; */

	 

	if (window.XMLHttpRequest)

	{

		return new XMLHttpRequest();

	}

	else if (window.ActiveXObject)

	{

		return new ActiveXObject("Microsoft.XMLHTTP");

	}

	else

	{

		alert("Error creating the XMLHttpRequest object."); 

		return null;

	}

} 



var http=createXmlHttpRequestObject();



function voteItem(post,itemid)

{
	var strURL="http://www.provotes.com/wp-content/plugins/wp-vote/wp-vote-ajax.php?post="+post+"&itemid="+itemid;
  //var strURL="http://"+document.domain+"/wp-content/plugins/wp-vote/wp-vote-ajax.php?post="+post+"&itemid="+itemid;

// var strURL="http://"+document.domain+"/provotes/wp-content/plugins/wp-vote/wp-vote-ajax.php?post="+post+"&itemid="+itemid;

  //alert(strURL);

 
//alert(parent.window.location.href);
  if (http)

  {

	  

   http.open("POST", strURL, true);

   http.send(null);

   http.onreadystatechange = function()

   {

	   // alert(http.readyState);

    if (http.readyState == 4)

    {

     if (http.status == 200)

     {

      // alert(http.responseText);   

      var rslt = http.responseText;

      document.getElementById('maindv').innerHTML = rslt;
		window.location=parent.window.location.href;
     }

     else

     {

      var rslt = http.responseText;
		
      document.getElementById('maindv').innerHTML = rslt;
		window.location=parent.window.location.href;
      //alert("There was a problem while using XMLHTTP:\n" + http.statusText);

      //alert("There was a problem while using XMLHTTP:\n" + http.status);

      //return false;   

     }    

    }

   }

  }



}

