
function getXmlHttp() {
  var xmlHttp;
  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("Your browser does not support AJAX!");
        return false;
      }
    }
  }
  return xmlHttp;
}

function savfav(id) {
  xmlHttp = getXmlHttp();

//  if(xmlHttp == false) return false;

  xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
       location.reload();
//        document.getElementById('save'+id).innerHTML = xmlHttp.responseText;
      }
  }
  xmlHttp.open("GET","/ajax.php?savfav="+id,true);
  xmlHttp.send(null);

  return false;
}


function delfav(id) {
  xmlHttp = getXmlHttp();

//  if(xmlHttp == false) return false;

  xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
       location.reload();
//        document.getElementById('save'+id).innerHTML = xmlHttp.responseText;
      }
  }
  xmlHttp.open("GET","/ajax.php?delfav="+id,true);
  xmlHttp.send(null);

  return false;
}

function rategame(id, rating) {
  xmlHttp = getXmlHttp();

//  if(xmlHttp == false) return false;

  xmlHttp.onreadystatechange=function() {
      if(xmlHttp.readyState==4) {
         for(i = 0; i < 6; i++) {
           var divid="derating" + i + "" + id;
           var div=document.getElementById(divid);
           var width = 65 - (rating * 65) / 5;
           if(div) {  
             div.style.width = width + "px"; 
             for(j = 1; j < 6; j++) {
               var div2 = document.getElementById(divid+"link"+j);
               with ({ "div"  :  div, "width" : width }) {
                 div2.onmouseout = function() { div.style.width=width+"px" };  
               }
             }
           }
         }
      }
  }
  xmlHttp.open("GET","/ajax.php?ajax=1&rate="+id+"&rating="+rating, true);
  xmlHttp.send(null);

  return false;
}

