

function ratingg(id, action, user_id)
{
 
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
  {

    document.getElementById("plus"+id).innerHTML = '';
	document.getElementById("minus"+id).innerHTML = '';

	document.getElementById("rate"+id).innerHTML = 'Загрузка...';

  
    xmlHttp.open("GET", "/xml/rating.php?id=" + id + "&action=" + action + "&user_id=" + user_id, true);  
	
    
    xmlHttp.onreadystatechange = handleServerResponseRating;
 
    xmlHttp.send(null);
  }
}
function handleServerResponseRating() 
{

  if (xmlHttp.readyState == 4) 
  {
    
    if (xmlHttp.status == 200) 
    {
 
  
    
    
	  
	     var xmlResponse = xmlHttp.responseXML;

  xmlRoot = xmlResponse.documentElement;  
    

value = xmlRoot.getElementsByTagName("value");
commentid = xmlRoot.getElementsByTagName("commentid");
    for (var i=0; i<commentid.length; i++) {

	
	      document.getElementById("rate" + commentid.item(i).firstChild.data).innerHTML = value.item(i).firstChild.data;
      }
      
    } 
    
    else 
    {
      alert("There was a problem accessing the server: " + xmlHttp.statusText);
    }
  }
}


