// AJAX Based Voting System
// Also checks, whether the user logged in or not through server side script

function ajaxVoting(url, resultTextDiv){	

	var xmlHttp;
	var sugUrlTitle;
	var sugTitleText;
	
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
		  // Internet Explorer
		  try
			{
				xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		  catch (e)
			{
			try
			  {
			  	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			  }
			catch (e)
			  {
				  alert("Please enable your browser Java Script !!!");
				  return false;
			  }
			}
		}
	
	//clears any previous message, when again requested...
	document.getElementById(resultTextDiv).innerHTML = "<img src='/images/loader.gif' /><br><span style='font-size:80%;'>voting...</span>";
	

	xmlHttp.onreadystatechange=function()
	{
		//echo "FALSE" in your script when you want this script to handle exception, when there is something wrong with server script		
		if(xmlHttp.readyState==4 ){
			document.getElementById(resultTextDiv).innerHTML = xmlHttp.responseText;				
	    }
	}

	  xmlHttp.open("GET",url,true);
	  xmlHttp.send(null);
}
//closing ajaxVoting
