
/*  AHAH: Asynchronous HTML And HTTP, 
    AJAH: Asynchronous Javascript And HTML 
    JAH: Just Asynchronous HTML
    HAJ: HTML And Javascript
    */
function callAHAH(url, pageElement) {
     document.getElementById(pageElement).innerHTML = "<img height='18' width='30' src='../images/pixel.gif'><img src='../images/loading.gif'>";        
     var req;
     try {
     req = new XMLHttpRequest(); /* Firefox, Opera 8.0+, Safari */
     } catch(e) {
       try {
       req = new ActiveXObject("Msxml2.XMLHTTP");  /* IE 6+ */
       } catch (e) {
         try {
         req = new ActiveXObject("Microsoft.XMLHTTP");  /* IE 5,5+*/
         } catch (e) {
         // Browser does not support ajax
          req = false;
         } 
       } 
     }
     req.onreadystatechange = function() {responseAHAH(pageElement, req);};
     req.open("GET",url,true); //
     req.send(null);
     /* http://www.w3schools.com/ajax/ajax_server.asp
        The open() method takes three arguments. 
        The first argument defines which method to use when sending the request (GET or POST). 
        The second argument specifies the URL of the server-side script. 
        The third argument specifies that the request should be handled asynchronously. 
        The send() method sends the request off to the server. 
        If we assume that the HTML and ASP file are in the same directory, the code would be: */
  }

/*  readystate  http://en.wikipedia.org/wiki/XMLHttpRequest ; http://www.w3schools.com/ajax/ajax_xmlhttprequest.asp
    httpstatus  http://en.wikipedia.org/wiki/List_of_HTTP_status_codes  */
function responseAHAH(pageElement, req) {  
   
   var output = '';
   if(req.readyState == 4) {
      if(req.status == 200) {
         output = req.responseText; // The responseText Property; The data sent back from the server can be retrieved with the responseText property.
         document.getElementById(pageElement).innerHTML = output;
         }
      }
  }
