function makeObject(){
var x;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
x = new ActiveXObject("Microsoft.XMLHTTP");
}else{
x = new XMLHttpRequest();
}
return x;
}
var request = makeObject();
function getPage(page){
   
   //The function open() is used to open a connection.
   //Parameters are 'method' and 'url'. For this tutorial we use GET.
   //We send it to 'test.php?id=' and add the index from our SELECT form field
   
   
   request.open('post', 'getPage.php');
   
   request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
   //This tells the script to call parseInfo() when the ready state is changed.
   request.onreadystatechange = parseInfo;
   //This sends whatever we need to send. Unless you're using POST as method, the parameter is to remain empty.
   
   getstr='page='+page;
   request.send(getstr);
}
function parseInfo(){
   if(request.readyState == 1){
      
      //While we are still waiting for a response, we replace whatever's in the div # 'my_div' with
      //the text 'Loading...'.
      document.getElementById('my_div').innerHTML = '<img src="_includes/loading.gif" />';
   }
   if(request.readyState == 4){
      //request.responseText holds the response we got from the server.
      //We assign it to a variable and replace the content of 'my_div' when it's done loading
      var answer = request.responseText;
      document.getElementById('my_div').innerHTML = answer;
   }
}

