// Ajax alternative for the mofosex.com rating system


function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest();
} catch(err1) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");
  } catch (err2) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (err3) {
      req = false;
    } 
  } 
}
return req;
}

var vidrankhttp = getXMLHTTPRequest();

function getRating() {
  myRand = parseInt(Math.random()*999999999999999);
  var modurl = myurl+"&rand="+myRand;  
  vidrankhttp.open("GET", modurl, true);
  vidrankhttp.onreadystatechange = useHttpResponse2;
  vidrankhttp.send(null);
}

function useHttpResponse2() {
   if (vidrankhttp.readyState == 4) {
    if(vidrankhttp.status == 200) { 
      var videorankresponse = vidrankhttp.responseText;
      document.getElementById('ratingarea').innerHTML = videorankresponse;
    }
  } else {
  document.getElementById('ratingarea').innerHTML = '';
  }
}