function ajaxObject(url,layer) {                                   
   var that=this;                                                   
   var updating = false;                                            
   this.callback = function() {}                                    

   this.update = function(passData) {                             
      if (updating==true) { return false; }                       
      updating=true;                                              
      var AJAX = null;                                            
      if (window.XMLHttpRequest) {                                
         AJAX=new XMLHttpRequest();                               
      } else {                                                      
         AJAX=new ActiveXObject("Microsoft.XMLHTTP");               
      }                                                             
      if (AJAX==null) {                                             
         alert("Your browser doesn't support AJAX.");               
         return false                                               
      } else {
         AJAX.onreadystatechange = function() {                      
            if (AJAX.readyState==4 || AJAX.readyState=="complete") { 
               LayerID.innerHTML=AJAX.responseText;                 
               delete AJAX;                                          
               updating=false;                                       
               that.callback();                                     
            }                                                        
         }                                                           
         var timestamp = new Date();                                 
         var uri=urlCall+'?'+passData+'&timestamp='+(timestamp*1);   
         AJAX.open("GET", uri, true);                                
         AJAX.send(null);                                            
         return true;                                               
      }                                                                            
   }
   
   var LayerID = document.getElementById(layer);                     // Remember the layer associated with this object.
   var urlCall = url;     
                                            
}           
     
function processData() {
      data = layerID.innerHTML;
      // rest of code processes data which is just a giant string containing all the data recieved from the server.
   }                                                   