function ajax_debug(text) { if(document.getElementById("javascript-debug-pane")) document.getElementById("javascript-debug-pane").value+=text + "\n"; } function httpRequest() { // Create the requestHandler try { this.requestHandler=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e1) { try { this.requestHandler=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e2) { this.requestHandler=false; } } if(!this.requestHandler && window.createRequest) { try { this.requestHandler=window.createRequest(); } catch(e) { this.requestHandler=false; } } if(!this.requestHandler && typeof(XMLHttpRequest)!='undefined') { try { this.requestHandler=new XMLHttpRequest(); } catch(e) { this.requestHandler=false; } } ajax_debug("New httpRequest created"); } httpRequest.prototype.handleChange=function() { //ajax_debug("ReadyState changed to " + this.requestHandler.readyState); if(this.requestHandler.readyState==4 && this.callback) this.callback(this.requestHandler.responseText); } httpRequest.prototype.get=function(url, callback) { ajax_debug("GET " + url + (callback==null ? " (no callback)" : " (with callback)")); var copy=this; this.requestHandler.onreadystatechange=function() {copy.handleChange();} if(callback) this.callback=callback; else this.callback=null; this.requestHandler.open("GET", url, true); this.requestHandler.send(null); } function ajax_describe(what) { a=""; for(part in what) try{a+=part + "=" + what[part] + "\n";} catch(e) {} return a; } function throwaway_request(url) { var req=new httpRequest(); req.get(url); } function callback_request(url, callback) { var req=new httpRequest(); req.get(url, callback); }