Object.extend(Function.prototype,{getArguments:function(){var a=[];for(var b=0;b<this.arguments.length;b++){a.push(this.arguments[b])}return a}},false);var MS={Browser:{}};Object.extend(MS.Browser,{isIE:navigator.userAgent.indexOf("MSIE")!=-1,isFirefox:navigator.userAgent.indexOf("Firefox")!=-1,isOpera:window.opera!=null},false);var AjaxPro={};AjaxPro.IFrameXmlHttp=function(){};AjaxPro.IFrameXmlHttp.prototype={onreadystatechange:null,headers:[],method:"POST",url:null,async:true,iframe:null,status:0,readyState:0,responseText:null,abort:function(){},readystatechanged:function(){var a=this.iframe.contentDocument||this.iframe.document;if(a!=null&&a.readyState=="complete"&&a.body!=null&&a.body.res!=null){this.status=200;this.statusText="OK";this.readyState=4;this.responseText=a.body.res;this.onreadystatechange();return}setTimeout(this.readystatechanged.bind(this),10)},open:function(f,a,b){if(b==false){alert("Synchronous call using IFrameXMLHttp is not supported.");return}if(this.iframe==null){var c="hans";if(document.createElement&&document.documentElement&&(window.opera||navigator.userAgent.indexOf("MSIE 5.0")==-1)){var d=document.createElement("iframe");d.setAttribute("id",c);d.style.visibility="hidden";d.style.position="absolute";d.style.width=d.style.height=d.borderWidth="0px";this.iframe=document.getElementsByTagName("body")[0].appendChild(d)}else{if(document.body&&document.body.insertAdjacentHTML){document.body.insertAdjacentHTML("beforeEnd",'<iframe name="'+c+'" id="'+c+'" style="border:1px solid black;display:none"></iframe>')}}if(window.frames&&window.frames[c]){this.iframe=window.frames[c]}this.iframe.name=c;this.iframe.document.open();this.iframe.document.write("<html><body></body></html>");this.iframe.document.close()}this.method=f;this.url=a;this.async=b},setRequestHeader:function(a,c){for(var b=0;b<this.headers.length;b++){if(this.headers[b].name==a){this.headers[b].value=c;return}}this.headers.push({name:a,value:c})},getResponseHeader:function(a,b){return null},addInput:function(g,c,b,f){var d;var a="input";if(f.indexOf("\n")>=0){a="textarea"}if(g.all){d=g.createElement("<"+a+' name="'+b+'" />')}else{d=g.createElement(a);d.setAttribute("name",b)}d.setAttribute("value",f);c.appendChild(d);d=null},send:function(c){if(this.iframe==null){return}var d=this.iframe.contentDocument||this.iframe.document;var b=d.createElement("form");d.body.appendChild(b);b.setAttribute("action",this.url);b.setAttribute("method",this.method);b.setAttribute("enctype","application/x-www-form-urlencoded");for(var a=0;a<this.headers.length;a++){switch(this.headers[a].name.toLowerCase()){case"content-length":case"accept-encoding":case"content-type":break;default:this.addInput(d,b,this.headers[a].name,this.headers[a].value)}}this.addInput(d,b,"data",c);b.submit();setTimeout(this.readystatechanged.bind(this),0)}};var progids=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];var progid=null;if(typeof ActiveXObject!="undefined"){var ie7xmlhttp=false;if(typeof XMLHttpRequest=="object"){try{var o=new XMLHttpRequest();ie7xmlhttp=true}catch(e){}}if(typeof XMLHttpRequest=="undefined"||!ie7xmlhttp){XMLHttpRequest=function(){var a=null;if(!AjaxPro.noActiveX){if(progid!=null){return new ActiveXObject(progid)}for(var b=0;b<progids.length&&a==null;b++){try{a=new ActiveXObject(progids[b]);progid=progids[b]}catch(c){}}}if(a==null&&MS.Browser.isIE){return new AjaxPro.IFrameXmlHttp()}return a}}}Object.extend(AjaxPro,{noOperation:function(){},onLoading:function(){},onError:function(){},onTimeout:function(){return true},onStateChanged:function(){},cryptProvider:null,queue:null,token:"",version:"7.7.31.1",ID:"AjaxPro",noActiveX:false,timeoutPeriod:15*1000,noUtcTime:false,m:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},toJSON:function(h){if(h==null){return"null"}var b=[];var f;var j=h.constructor;if(j==Number){return isFinite(h)?h.toString():AjaxPro.toJSON(null)}else{if(j==Boolean){return h.toString()}else{if(j==String){if(/["\\\x00-\x1f]/.test(h)){h=h.replace(/([\x00-\x1f\\"])/g,function(i,d){var k=AjaxPro.m[d];if(k){return k}k=d.charCodeAt();return"\\u00"+Math.floor(k/16).toString(16)+(k%16).toString(16)})}return'"'+h+'"'}else{if(j==Array){for(f=0;f<h.length;f++){b.push(AjaxPro.toJSON(h[f]))}return"["+b.join(",")+"]"}else{if(j==Date){var g={};g.__type="System.DateTime";if(AjaxPro.noUtcTime==true){g.Year=h.getFullYear();g.Month=h.getMonth()+1;g.Day=h.getDate();g.Hour=h.getHours();g.Minute=h.getMinutes();g.Second=h.getSeconds();g.Millisecond=h.getMilliseconds()}else{g.Year=h.getUTCFullYear();g.Month=h.getUTCMonth()+1;g.Day=h.getUTCDate();g.Hour=h.getUTCHours();g.Minute=h.getUTCMinutes();g.Second=h.getUTCSeconds();g.Millisecond=h.getUTCMilliseconds()}return AjaxPro.toJSON(g)}}}}}if(typeof h.toJSON=="function"){return h.toJSON()}if(typeof h=="object"){for(var a in h){if(typeof h[a]!="function"){b.push('"'+a+'":'+AjaxPro.toJSON(h[a]))}}if(b.length>0){return"{"+b.join(",")+"}"}return"{}"}return h.toString()},dispose:function(){if(AjaxPro.queue!=null){AjaxPro.queue.dispose()}}},false);addEvent(window,"unload",AjaxPro.dispose);AjaxPro.Request=function(a){this.url=a;this.xmlHttp=null};AjaxPro.Request.prototype={url:null,callback:null,onLoading:null,onError:null,onTimeout:null,onStateChanged:null,args:null,context:null,isRunning:false,abort:function(){if(this.timeoutTimer!=null){clearTimeout(this.timeoutTimer)}if(this.xmlHttp){this.xmlHttp.onreadystatechange=AjaxPro.noOperation;this.xmlHttp.abort()}if(this.isRunning){this.isRunning=false;this.onLoading(false)}},dispose:function(){this.abort()},getEmptyRes:function(){return{error:null,value:null,request:{method:this.method,args:this.args},context:this.context,duration:this.duration}},endRequest:function(a){this.abort();if(a.error!=null){this.onError(a.error,this)}if(typeof this.callback=="function"){this.callback(a,this)}},mozerror:function(){if(this.timeoutTimer!=null){clearTimeout(this.timeoutTimer)}var a=this.getEmptyRes();a.error={Message:"Unknown",Type:"ConnectFailure",Status:0};this.endRequest(a)},doStateChange:function(){this.onStateChanged(this.xmlHttp.readyState,this);if(this.xmlHttp.readyState!=4||!this.isRunning){return}this.duration=new Date().getTime()-this.__start;if(this.timeoutTimer!=null){clearTimeout(this.timeoutTimer)}var a=this.getEmptyRes();if(this.xmlHttp.status==200&&this.xmlHttp.statusText=="OK"){a=this.createResponse(a)}else{a=this.createResponse(a,true);a.error={Message:this.xmlHttp.statusText,Type:"ConnectFailure",Status:this.xmlHttp.status}}this.endRequest(a)},createResponse:function(r,noContent){if(!noContent){if(typeof(this.xmlHttp.responseText)=="unknown"){r.error={Message:"XmlHttpRequest error reading property responseText.",Type:"XmlHttpRequestException"};return r}var responseText=""+this.xmlHttp.responseText;if(AjaxPro.cryptProvider!=null&&typeof AjaxPro.cryptProvider.decrypt=="function"){responseText=AjaxPro.cryptProvider.decrypt(responseText)}if(this.xmlHttp.getResponseHeader("Content-Type")=="text/xml"){r.value=this.xmlHttp.responseXML}else{if(responseText!=null&&responseText.trim().length>0){r.json=responseText;var v=null;eval("v = "+responseText+";");if(v!=null){if(typeof v.value!="undefined"){r.value=v.value}else{if(typeof v.error!="undefined"){r.error=v.error}}}}}}return r},timeout:function(){this.duration=new Date().getTime()-this.__start;var a;if(typeof this.onTimeout==="function"){a=this.onTimeout(this.duration,this)}if(typeof a=="undefined"||a!=false){this.abort()}else{this.timeoutTimer=setTimeout(this.timeout.bind(this),AjaxPro.timeoutPeriod)}},invoke:function(h,a,g,c){this.__start=new Date().getTime();this.xmlHttp=new XMLHttpRequest();this.isRunning=true;this.method=h;this.args=a;this.callback=g;this.context=c;var d=typeof(g)=="function"&&g!=AjaxPro.noOperation;if(d){if(MS.Browser.isIE){this.xmlHttp.onreadystatechange=this.doStateChange.bind(this)}else{this.xmlHttp.onload=this.doStateChange.bind(this);this.xmlHttp.onerror=this.mozerror.bind(this)}this.onLoading(true)}var b=AjaxPro.toJSON(a)+"";if(AjaxPro.cryptProvider!=null&&typeof AjaxPro.cryptProvider.encrypt=="function"){b=AjaxPro.cryptProvider.encrypt(b)}this.xmlHttp.open("POST",this.url,d);this.xmlHttp.setRequestHeader("Content-Type","text/plain; charset=utf-8");this.xmlHttp.setRequestHeader("X-"+AjaxPro.ID+"-Method",h);if(AjaxPro.token!=null&&AjaxPro.token.length>0){this.xmlHttp.setRequestHeader("X-"+AjaxPro.ID+"-Token",AjaxPro.token)}this.timeoutTimer=setTimeout(this.timeout.bind(this),AjaxPro.timeoutPeriod);try{this.xmlHttp.send(b)}catch(f){}if(!d){return this.createResponse({error:null,value:null})}return true}};AjaxPro.RequestQueue=function(b){this.queue=[];this.requests=[];this.timer=null;if(isNaN(b)){b=2}for(var a=0;a<b;a++){this.requests[a]=new AjaxPro.Request();this.requests[a].callback=function(c){var d=c.context;c.context=d[3][1];d[3][0](c,this)};this.requests[a].callbackHandle=this.requests[a].callback.bind(this.requests[a])}this.processHandle=this.process.bind(this)};AjaxPro.RequestQueue.prototype={process:function(){this.timer=null;if(this.queue.length==0){return}for(var a=0;a<this.requests.length&&this.queue.length>0;a++){if(this.requests[a].isRunning==false){var b=this.queue.shift();this.requests[a].url=b[0];this.requests[a].onLoading=b[3].length>2&&b[3][2]!=null&&typeof b[3][2]=="function"?b[3][2]:AjaxPro.onLoading;this.requests[a].onError=b[3].length>3&&b[3][3]!=null&&typeof b[3][3]=="function"?b[3][3]:AjaxPro.onError;this.requests[a].onTimeout=b[3].length>4&&b[3][4]!=null&&typeof b[3][4]=="function"?b[3][4]:AjaxPro.onTimeout;this.requests[a].onStateChanged=b[3].length>5&&b[3][5]!=null&&typeof b[3][5]=="function"?b[3][5]:AjaxPro.onStateChanged;this.requests[a].invoke(b[1],b[2],this.requests[a].callbackHandle,b);b=null}}if(this.queue.length>0&&this.timer==null){this.timer=setTimeout(this.processHandle,0)}},add:function(b,d,a,c){this.queue.push([b,d,a,c]);if(this.timer==null){this.timer=setTimeout(this.processHandle,0)}},abort:function(){this.queue.length=0;if(this.timer!=null){clearTimeout(this.timer)}this.timer=null;for(var a=0;a<this.requests.length;a++){if(this.requests[a].isRunning==true){this.requests[a].abort()}}},dispose:function(){for(var a=0;a<this.requests.length;a++){var b=this.requests[a];b.dispose()}this.requests.clear()}};AjaxPro.queue=new AjaxPro.RequestQueue(2);AjaxPro.AjaxClass=function(a){this.url=a};AjaxPro.AjaxClass.prototype={invoke:function(d,a,c){if(c!=null){if(c.length!=6){for(;c.length<6;){c.push(null)}}if(c[0]!=null&&typeof(c[0])=="function"){return AjaxPro.queue.add(this.url,d,a,c)}}var b=new AjaxPro.Request();b.url=this.url;return b.invoke(d,a)}};
