/*
 * @require jade.js
 */
jade.Ajax=function(c,d,a,b){this.url=c;this.method=d?d:"POST";
this.user=a;this.password=b};jade.Ajax.prototype.url=null;jade.Ajax.prototype.method=null;
jade.Ajax.prototype.user=null;jade.Ajax.prototype.password=null;jade.Ajax.resetSessionTimeout=null;
jade.Ajax.getRequestor=function(){if(window.XMLHttpRequest){return new XMLHttpRequest()
}if(window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP")}throw new Error("Unable to initialize Ajax requestor")
};jade.Ajax.getResponse=function(a){var b;b=a.getResponseHeader("Content-Type");if(b&&b.toLowerCase().indexOf("xml")!=-1){return a.responseXML
}else{return a.responseText}};jade.Ajax.prototype.send=function(c,d,a){var b;b=jade.Ajax.getRequestor();
b.open(this.method,this.url,true,this.user,this.password);if(d){new jade.AjaxResponse(b,d,a)
}if(!c||!c.getElementById){b.setRequestHeader("Content-type","text/plain")}b.send(c);
if(jade.sessionTimeout){jade.sessionTimeout.reset()}if(jade.Ajax.resetSessionTimeout){jade.Ajax.resetSessionTimeout()
}};jade.Ajax.send=function(b,d,e,a){var c;c=new jade.Ajax(b,d?"POST":"GET");c.send(d,e,a)
};jade.Ajax.prototype.request=function(b){var a;a=jade.Ajax.getRequestor();a.open(this.method,this.url,false,this.user,this.password);
if(!b||!b.getElementById){a.setRequestHeader("Content-type","text/plain")}a.send(b);
if(a.status!=200){throw new Error("HTTP request failed: "+a.status+" "+a.statusText)
}if(jade.sessionTimeout){jade.sessionTimeout.reset()}if(jade.Ajax.resetSessionTimeout){jade.Ajax.resetSessionTimeout()
}return jade.Ajax.getResponse(a)};jade.Ajax.request=function(a,c){var b;b=new jade.Ajax(a,c?"POST":"GET");
return b.request(c)};jade.AjaxResponse=function(b,d,a){var c;this.requestor=b;this.onResponse=d;
if(a){this.onResponseScope=a}c=jade.AjaxResponse.nextInstance++;jade.AjaxResponse.instances[c]=this;
b.onreadystatechange=function(){jade.AjaxResponse.handleReadyStateChange(c)}};jade.AjaxResponse.prototype.requestor=null;
jade.AjaxResponse.prototype.onResponse=null;jade.AjaxResponse.prototype.onResponseScope=window;
jade.AjaxResponse.nextInstance=1;jade.AjaxResponse.instances=[];jade.AjaxResponse.prototype.handleReadyStateChange=function(a){if(this.requestor.readyState==4){this.onResponse.call(this.onResponseScope,jade.Ajax.getResponse(this.requestor),this.requestor);
jade.AjaxResponse.instances[a]=null}};jade.AjaxResponse.handleReadyStateChange=function(a){jade.AjaxResponse.instances[a].handleReadyStateChange(a)
};