function showRating(section,id,rating)
{

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	  {
	  document.getElementById("currRating1").innerHTML="Your browser does not support AJAX!";
	  return;
	  } 

    document.getElementById("currRating2").innerHTML="";
	var url="/services/rate_new.php?section="+section+"&id="+id+"&rating="+rating;
	getHTTPData(url);

} 
function getHTTPData(url){
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("GET",url,true);
	xmlHttp.setRequestHeader ("Pragma","no-cache");
	xmlHttp.setRequestHeader( "Cache-control","no-cache");
	xmlHttp.send(null);

}



function stateChanged() 
{ 
	
	  var pData='<br><br><center><table border="1" width="200" height="16" bordercolor="#000000" style="border-collapse: collapse" cellpadding="0" cellspacing="0"><tr><td> <div style= "background-color:#00FF00; width:';
	  var pData1= 'px; height:16">&nbsp;</div></td></tr></table><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Loading Rating...</p></center>';	
  
	  if (xmlHttp.readyState == 0)
	  {
		document.getElementById("currRating1").innerHTML = pData + '50' + pData1 ;

	  }
	  else if(xmlHttp.readyState == 1)
	  {
		document.getElementById("currRating1").innerHTML = pData + '100' + pData1;
	  }
	  else if(xmlHttp.readyState == 2)
	  {
		document.getElementById("currRating1").innerHTML = pData + '150' + pData1;
	  }
	  else if(xmlHttp.readyState == 3)
	  {
		document.getElementById("currRating1").innerHTML = pData + '200' + pData1;
	  }
	  else if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	  { 
		  document.getElementById("ratingArea").innerHTML="<br>" + xmlHttp.responseText +  " Your rating has been recorded. Thank you for your contribution." ;
		  document.getElementById("currRating0").innerHTML= xmlHttp.responseText;
	  } 
	
	
	
	

}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

