function getXMLHTTPRequest() {
try {
req = new XMLHttpRequest(); /* e.g. Firefox */
} catch(e) {
  try {
  req = new ActiveXObject("Msxml2.XMLHTTP");  /* some versions IE */
  } catch (e) {
    try {
    req = new ActiveXObject("Microsoft.XMLHTTP");  /* some versions IE */
    } catch (E) {
      req = false;
    }
  }
}
return req;
}

var http = getXMLHTTPRequest();

function useFollowResponse() {
     if (http.readyState == 4) {
          if (http.status == 200) {
               var result = http.responseText;
               alert(result);
          }
     }
}

function FollowUser(id,userid) {
     var myurl = "http://"+window.location.hostname+"/follow-user.php";
     myRand = parseInt(Math.random()*999999999999999, 1000000000000000);
     // add random number to URL to avoid cache problems
     var modurl = myurl+"?i="+id+"&j="+userid+"&rand="+myRand;
     http.open("GET", modurl, true);
     // set up the callback function
     http.onreadystatechange = useFollowResponse;
     http.send(null);
}

function FollowForum(id,catid) {
     var myurl = "http://"+window.location.hostname+"/follow-forum.php";
     myRand = parseInt(Math.random()*999999999999999, 1000000000000000);
     // add random number to URL to avoid cache problems
     var modurl = myurl+"?i="+id+"&j="+catid+"&rand="+myRand;
     http.open("GET", modurl, true);
     // set up the callback function
     http.onreadystatechange = useFollowResponse;
     http.send(null);
}
