function createRequestObject(){
  if(window.XMLHttpRequest){
    return new XMLHttpRequest();
  }else if(window.ActiveXObject){
    // Based on http://jibbering.com/2002/4/httprequest.html
    /*@cc_on @*/
    /*@if (@_jscript_version >= 5)
    try{
      return new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){
      try{
        return new ActiveXObject("Microsoft.XMLHTTP");
      }catch (E){
        return null;
      }
    }
    @end @*/
  }else{
    return null;
  }
}

var http = createRequestObject();


function increaseClicks(passedID){
  var ID = passedID;
  var data = "id=" + ID;

  http.open("POST", "upclick.php");
  http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  http.send(data);

  ID = ''; data = '';

  http.onreadystatechange = forLater;
}


function forLater(){
  if(http.readyState == 4){
    // Save for testing and use later on.
  }
}

function openWindow(){
  var page = "clicks.php";
  var winOptions = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=500,top=100,left=150";
  var winName = "clicks";
  window.open(page, winName, winOptions);
}

