function Subsys_JsHttpRequest_Js(){this._construct()}(function(){var l=0;var n={};var o={};Subsys_JsHttpRequest_Js.dataReady=function(a,b,c){var d;var e=n[a];delete n[a];if(e){delete e._xmlReq;if(e.caching)o[e.hash]=[b,c];e._dataReady(b,c)}else if(typeof(e)!=typeof(d)){alert("ScriptLoader: unknown pending id: "+a)}};Subsys_JsHttpRequest_Js.prototype={onreadystatechange:null,readyState:0,responseText:null,responseXML:null,status:200,statusText:"OK",session_name:"PHPSESSID",responseJS:null,caching:false,_span:null,_id:null,_xmlReq:null,_openArg:null,_reqHeaders:null,dummy:function(){},abort:function(){if(this._xmlReq)return this._xmlReq.abort();if(this._span){this.readyState=0;if(this.onreadystatechange)this.onreadystatechange();this._cleanupScript()}},open:function(a,b,c,d,e){this._openArg={'method':a,'url':b,'asyncFlag':c,'username':d,'password':e};this._id=null;this._xmlReq=null;this._reqHeaders=[];return true},send:function(b){var d=(new Date().getTime())+""+l++;b['COOKIE']=document.cookie;var e=this._hash2query(b);var f=this._openArg.url;var g=this._getSid();if(g)f+=(f.indexOf('?')>=0?'&':'?')+this.session_name+"="+this.escape(g);var h=this.hash=f+'?'+e;if(this.caching&&o[h]){var c=o[h];this._dataReady(c[0],c[1]);return false}this._xmlReq=this._obtainXmlReq(d,f);var j=this._xmlReq&&(window.ActiveXObject||this._xmlReq.setRequestHeader);var k,body;if(this._xmlReq&&j&&(""+this._openArg.method).toUpperCase()=="POST"){this._openArg.method="POST";k=f;body=e}else{this._openArg.method="GET";k=f+(f.indexOf('?')>=0?'&':'?')+e;body=null}k=k+(k.indexOf('?')>=0?'&':'?')+d;n[d]=this;if(this._xmlReq){var a=this._openArg;this._xmlReq.open(a.method,k+"-xml",a.asyncFlag,a.username,a.password);if(j){for(var i=0;i<this._reqHeaders.length;i++)this._xmlReq.setRequestHeader(this._reqHeaders[i][0],this._reqHeaders[i][1]);this._xmlReq.setRequestHeader('Content-Type','application/octet-stream')}return this._xmlReq.send(body)}else{this._obtainScript(d,k);return true}},getAllResponseHeaders:function(){if(this._xmlReq)return this._xmlReq.getAllResponseHeaders();return''},getResponseHeader:function(a){if(this._xmlReq)return this._xmlReq.getResponseHeader(a);return''},setRequestHeader:function(a,b){this._reqHeaders[this._reqHeaders.length]=[a,b]},_construct:function(){},_dataReady:function(a,b){with(this){if(a!==null||b!==null){readyState=4;responseText=responseXML=a;responseJS=b}else{readyState=0;responseText=responseXML=responseJS=null}if(onreadystatechange)onreadystatechange();_cleanupScript()}},_obtainXmlReq:function(b,c){if(c.match(new RegExp('^[a-z]+://','i')))return null;var d=null;if(window.XMLHttpRequest){try{d=new XMLHttpRequest()}catch(e){}}else if(window.ActiveXObject){try{d=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}if(!d)try{d=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}}if(d){var f=this;d.onreadystatechange=function(){var s=d.readyState;if(s==4){d.onreadystatechange=f.dummy;var a=d.responseText;try{eval(a)}catch(e){Subsys_JsHttpRequest_Js.dataReady(b,"JavaScript code generated by backend is invalid!\n"+a,null)}}else{f.readyState=s;if(f.onreadystatechange)f.onreadystatechange()}};this._id=b}return d},_obtainScript:function(a,b){with(document){var c=null;c=body.appendChild(createElement("SPAN"));c.style.display='none';c.innerHTML='Text for stupid IE.<s'+'cript></'+'script>';setTimeout(function(){var s=c.getElementsByTagName("script")[0];s.language="JavaScript";if(s.setAttribute)s.setAttribute('src',b);else s.src=b},10);this._id=a;this._span=c}},_cleanupScript:function(){var a=this._span;if(a){this._span=null;setTimeout(function(){a.parentNode.removeChild(a)},50)}return false},_hash2query:function(a,b){if(b==null)b="";var c=[];if(a instanceof Object){for(var k in a){var v=a[k];if(v==null||((v.constructor||{}).prototype||{})[k])continue;var d=b?b+'['+this.escape(k)+']':this.escape(k);if(v instanceof Object)c[c.length]=this._hash2query(v,d);else c[c.length]=d+"="+this.escape(v)}}else{c=[a]}return c.join('&')},_getSid:function(){var m=document.location.search.match(new RegExp('[&?]'+this.session_name+'=([^&?]*)'));var a=null;if(m){a=m[1]}else{var m=document.cookie.match(new RegExp(s='(;|^)\\s*'+this.session_name+'=([^;]*)'));if(m)a=m[2]}return a},escape:function(s){return escape(s).replace(new RegExp('\\+','g'),'%2B')}}})();
