/*######################################################### # # ajax functions # #########################################################*/ function HTTP() { this.toString = function() { return "HTTP"; } this.status = function(_status) { switch(_status) { case 200: return "success"; break; case 404: return "File not found."; break; default: return "HTTP Status: " + _status; } } } function AjaxCall() { this.toString = function() { return "AjaxCall"; } this.http = new HTTP(); this.makeRequest = function(_method, _url, _callbackMethod) { this.request = (window.XMLHttpRequest)? new XMLHttpRequest(): new ActiveXObject("MSXML2.XMLHTTP"); this.request.onreadystatechange = _callbackMethod; this.request.open(_method, _url, true); this.request.send(_url); } this.checkReadyState = function(_id, _1, _2, _3) { switch(this.request.readyState) { case 1: //document.getElementById(_id).innerHTML = _1; break; case 2: //document.getElementById(_id).innerHTML = _2; break; case 3: //document.getElementById(_id).innerHTML = _3; break; case 4: //document.getElementById(_id).innerHTML = this.http.status(this.request.status); return this.http.status(this.request.status); } } }