var query = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  query = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    query = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    query = false;
  }
}
@end@*/

if (!query && typeof XMLHttpRequest != 'undefined') {
  query = new XMLHttpRequest();
}

function updatePageRating()
{
   if (query.readyState < 4) document.getElementById('load').style.display = "";
     if (query.readyState == 4) {
       if (query.status == 200) {
         //получение возвращенных данных
         document.getElementById('load').style.display = "none";
         response = query.responseText;
         document.getElementById("golosov").innerHTML = response;
        
       } else if (request.status == 404) {
         alert ("Requested URL is not found.");
       } else if (request.status == 403) {
         alert("Access denied.");
       }
        else
         alert("status is " + request.status);
       }
}
   
function callServerRating(val) {
  var id_com = document.getElementById("id_com").value;
  var rating = val;

  // Создать URL для подключения
  var url = "addrating.php?id_com=" + escape(id_com) + "&rating=" + escape(rating);
  
  // Открыть соединение с сервером
  query.open("GET", url, true);
  // Передать запрос
  query.send(null);
  // Установить функцию для сервера, которая выполнится после его ответа
  query.onreadystatechange = updatePageRating;
  document.getElementById("golosov").innerHTML = "Ща, ща, щащащаа...";
}

  
function selstar(val)
{
    for(var x=1;x<=val;x++)
    {
        document['i'+x].src="images/govno_yes.png";
    }

}
function remstar(val)
{
    for(var x=1;x<=val;x++)
    {
         document['i'+x].src="images/govno_no.png";
    }
}
