// Ajax functions
function XMLDoc() { }
XMLDoc.prototype.req = null;
XMLDoc.prototype.onChange = null;

XMLDoc.prototype.processChange = function() {
	// The page has loaded and the HTTP status code is 200 OK
    if (this.req && this.req.readyState == 4 && this.req.status == 200) {
	    this.onChange(this.req.responseText);
    }
}

XMLDoc.prototype.getRequest = function() {
	// Internet Explorer
   try {
      req = new ActiveXObject("Msxml2.XMLHTTP");
   }
	catch(e) {
      try { req = new ActiveXObject("Microsoft.XMLHTTP"); }
      catch(oc) { req = null; }
   }

   // Mozilla/Safari
   if (!req && typeof XMLHttpRequest != "undefined") { req = new XMLHttpRequest(); }
   return req;
}

XMLDoc.prototype.load = function(url) {
   var _this = this;
   this.req = this.getRequest();

   // Call the processChange() function when the page has loaded
   if (this.req != null) {
     this.req.onreadystatechange = function() { _this.processChange(); }

     try { this.req.open("GET", url, true); }
     catch(ex) { alert(ex); }

     this.req.send(null);
   }
}