function RequestMessage(method,url){this.method=method;this.url=url;this.httpDriver=RequestMessage.createHttpDriver();}RequestMessage.createHttpDriver=function(){if(typeof (XMLHttpRequest)=="function"||typeof (XMLHttpRequest)=="object"){return new XMLHttpRequest();}else{if(typeof (ActiveXObject)=="function"){return new ActiveXObject("MSXML2.XMLHTTP.3.0");}else{alert("No XML callback facility found!");}}};RequestMessage.prototype.asyncSend=function(parameters,callback){this.callback=callback;var self=this;this.httpDriver.onreadystatechange=function(){self.responseRecieved();};if(this.getMethod()=="POST"){this.httpDriver.open(this.getMethod(),this.getFullyQualifiedUrl(),true);this.httpDriver.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.httpDriver.send(parameters.toString());}else{if(this.getMethod()=="GET"){var urlWithParameters=this.appendParameters(this.getFullyQualifiedUrl(),parameters);this.httpDriver.open(this.getMethod(),urlWithParameters,true);this.httpDriver.send(null);}}};RequestMessage.prototype.send=function(parameters){if(this.getMethod()=="POST"){this.httpDriver.open(this.getMethod(),this.getFullyQualifiedUrl(),false);this.httpDriver.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.httpDriver.send(parameters.toString());}else{if(this.getMethod()=="GET"){var urlWithParameters=this.appendParameters(this.getFullyQualifiedUrl(),parameters);this.httpDriver.open(this.getMethod(),urlWithParameters,false);this.httpDriver.send(null);}}return new ResponseMessage(this.httpDriver);};RequestMessage.prototype.appendParameters=function(url,parameters){if(url.contains("?")&&!url.endsWith("&")){url+="&";}else{url+="?";}url+=parameters.toString();return url;};RequestMessage.prototype.responseRecieved=function(){if(this.httpDriver.readyState==4){this.callback(new ResponseMessage(this.httpDriver));}};RequestMessage.prototype.getMethod=function(){return this.method.toUpperCase();};RequestMessage.prototype.getFullyQualifiedUrl=function(){return new UrlQualifier(window.location).qualify(this.url);};function ResponseMessage(httpDriver){this.httpDriver=httpDriver;}ResponseMessage.prototype.getText=function(){return this.httpDriver.responseText;};ResponseMessage.prototype.getXml=function(){return this.httpDriver.responseXml;};ResponseMessage.prototype.isSuccess=function(){return this.httpDriver.status==200;};function UrlQualifier(location){this.location=location;}UrlQualifier.prototype.qualify=function(url){if(url.contains(":")){return url;}else{if(url.startsWith("?")){return this.location.href.split("?")[0]+url;}else{if(url.startsWith("/")){return this.location.protocol+"//"+this.location.host+url;}else{var parts=url.split("/");parts[parts.length-1]=url;return parts.join("/");}}}};