var xmlhttp;

function hit(uid) {
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
    alert ("Browser does not support HTTP Request");
    return;
  }
  var url="http://igirlportal.com/vote.php?hit&uid="+uid;
  xmlhttp.onreadystatechange=hitStateChanged;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
}

function hitStateChanged() {
}

function vote(uid, val) {
  xmlhttp=GetXmlHttpObject();
  if (xmlhttp==null) {
    alert ("Browser does not support HTTP Request");
    return;
  }
  var url="http://igirlportal.com/vote.php?vote&uid="+uid+"&value="+val;
  xmlhttp.onreadystatechange=voteStateChanged;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
}

function voteStateChanged() {
  if (xmlhttp.readyState==4) {
    pair = xmlhttp.responseText.split('|');
    uid  = pair[0];
    val  = pair[1];
    document.getElementById(uid+"rank").innerHTML = val;
    document.getElementById(uid+"vb").innerHTML = '<em>Thanks For Voting!</em>';
  }
}

function GetXmlHttpObject() {
  if (window.XMLHttpRequest) {
    // code for IE7+, Firefox, Chrome, Opera, Safari
    return new XMLHttpRequest();
  }
  if (window.ActiveXObject) {
    // code for IE6, IE5
    return new ActiveXObject("Microsoft.XMLHTTP");
  }
  return null;
}

