﻿Object.extend=function(a,b,c){for(var d in b)c==false&&a[d]!=null||(a[d]=b[d]);return a};
Object.extend(Function.prototype,{apply:function(a,b){var c;if(typeof a!="object")a={};a.__fapply=this;for(var d="r = o.__fapply(",e=0;e<b.length;e++){if(e>0)d+=",";d+="a["+e+"]"}d+=");";eval(d);delete a.__fapply;return c},bind:function(a){if(!Function.__objs){Function.__objs=[];Function.__funcs=[]}var b=a.__oid;if(!b)Function.__objs[b=a.__oid=Function.__objs.length]=a;var c=this,d=c.__fid;if(!d)Function.__funcs[d=c.__fid=Function.__funcs.length]=c;if(!a.__closures)a.__closures=[];if(a=a.__closures[d])return a;
c=a=null;return Function.__objs[b].__closures[d]=function(){return Function.__funcs[d].apply(Function.__objs[b],arguments)}}},false);Object.extend(Array.prototype,{push:function(a){this[this.length]=a},addRange:function(a){if(a.length>0)for(var b=0;b<a.length;b++)this.push(a[b])},clear:function(){this.length=0;return this},shift:function(){if(this.length==0)return null;for(var a=this[0],b=0;b<this.length-1;b++)this[b]=this[b+1];this.length--;return a}},false);
Object.extend(String.prototype,{trimLeft:function(){return this.replace(/^\s*/,"")},trimRight:function(){return this.replace(/\s*$/,"")},trim:function(){return this.trimRight().trimLeft()},endsWith:function(a){if(this.length==0||this.length<a.length)return false;return this.substr(this.length-a.length)==a},startsWith:function(a){if(this.length==0||this.length<a.length)return false;return this.substr(0,a.length)==a},split:function(a){var b=[];if(this.length==0)return b;for(var c=0,d=0;d<this.length;d++)if(this.charAt(d)==
a){b.push(this.substring(c,d));c=++d}b.push(s.substr(c));return b}},false);Object.extend(String,{format:function(a){for(var b=1;b<arguments.length;b++)a=a.replace("{"+(b-1)+"}",arguments[b]);return a},isNullOrEmpty:function(a){if(a==null||a.length==0)return true;return false}},false);
if(typeof addEvent=="undefined")addEvent=function(a,b,c,d){if(a==null)return false;if(a.addEventListener){a.addEventListener(b,c,d);return true}else if(a.attachEvent)return a.attachEvent("on"+b,c);else try{a["on"+b]=c}catch(e){}};if(typeof removeEvent=="undefined")removeEvent=function(a,b,c,d){if(a==null)return false;if(a.removeEventListener){a.removeEventListener(b,c,d);return true}else if(a.detachEvent)a.detachEvent("on"+b,c);else try{a["on"+b]=function(){}}catch(e){}};
Object.extend(Function.prototype,{getArguments:function(){for(var a=[],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()}else setTimeout(this.readystatechanged.bind(this),10)},open:function(a,
b,c){if(c==false)alert("Synchronous call using IFrameXMLHttp is not supported.");else{if(this.iframe==null){if(document.createElement&&document.documentElement&&(window.opera||navigator.userAgent.indexOf("MSIE 5.0")==-1)){var d=document.createElement("iframe");d.setAttribute("id","hans");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 document.body&&document.body.insertAdjacentHTML&&
document.body.insertAdjacentHTML("beforeEnd",'<iframe name="hans" id="hans" style="border:1px solid black;display:none"></iframe>');if(window.frames&&window.frames.hans)this.iframe=window.frames.hans;this.iframe.name="hans";this.iframe.document.open();this.iframe.document.write("<html><body></body></html>");this.iframe.document.close()}this.method=a;this.url=b;this.async=c}},setRequestHeader:function(a,b){for(var c=0;c<this.headers.length;c++)if(this.headers[c].name==a){this.headers[c].value=b;return}this.headers.push({name:a,
value:b})},getResponseHeader:function(){return null},addInput:function(a,b,c,d){var e="input";if(d.indexOf("\n")>=0)e="textarea";if(a.all)a=a.createElement("<"+e+' name="'+c+'" />');else{a=a.createElement(e);a.setAttribute("name",c)}a.setAttribute("value",d);b.appendChild(a)},send:function(a){if(this.iframe!=null){var b=this.iframe.contentDocument||this.iframe.document,c=b.createElement("form");b.body.appendChild(c);c.setAttribute("action",this.url);c.setAttribute("method",this.method);c.setAttribute("enctype",
"application/x-www-form-urlencoded");for(var d=0;d<this.headers.length;d++)switch(this.headers[d].name.toLowerCase()){case "content-length":case "accept-encoding":case "content-type":break;default:this.addInput(b,c,this.headers[d].name,this.headers[d].value)}this.addInput(b,c,"data",a);c.submit();setTimeout(this.readystatechanged.bind(this),0)}}};var progids=["Msxml2.XMLHTTP.6.0","Msxml2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],progid=null;
if(typeof ActiveXObject!="undefined"){var ie7xmlhttp=false;if(typeof XMLHttpRequest=="object")try{var o=new XMLHttpRequest;ie7xmlhttp=true}catch(e$$2){}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:"9.2.17.1",ID:"AjaxPro",noActiveX:false,timeoutPeriod:15E3,queue:null,noUtcTime:false,regExDate:function(a){var b=a=a.substring(1).replace('"',"");if(a.substring(0,7)=="\\/Date("){a=a.match(/Date\((.*?)\)/)[1];b="new Date("+parseInt(a)+")"}else{a=a.split(/[-,:,T,Z]/);a[1]=(parseInt(a[1],0)-1).toString();
b="new Date(Date.UTC("+a.join(",")+"))"}return b},parse:function(a){a=a.replace(/(\"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}.*?\")|(\"\\\/Date\(.*?\)\\\/")/g,this.regExDate);return eval("("+a+")")},m:{"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},toJSON:function(a){if(a==null)return"null";var b=[],c;c=a.constructor;if(c==Number)return isFinite(a)?a.toString():AjaxPro.toJSON(null);else if(c==Boolean)return a.toString();else if(c==String){if(/["\\\x00-\x1f]/.test(a))a=a.replace(/([\x00-\x1f\\"])/g,
function(e,f){if(e=AjaxPro.m[f])return e;e=f.charCodeAt();return"\\u00"+Math.floor(e/16).toString(16)+(e%16).toString(16)});return'"'+a+'"'}else if(c==Array){for(c=0;c<a.length;c++)b.push(AjaxPro.toJSON(a[c]));return"["+b.join(",")+"]"}else if(c==Date)return AjaxPro.toJSON("/Date("+(new Date(Date.UTC(a.getUTCFullYear(),a.getUTCMonth(),a.getUTCDate(),a.getUTCHours(),a.getUTCMinutes(),a.getUTCSeconds(),a.getUTCMilliseconds()))).getTime()+")/");if(typeof a.toJSON=="function")return a.toJSON();if(typeof a==
"object"){for(var d in a)typeof a[d]!="function"&&b.push('"'+d+'":'+AjaxPro.toJSON(a[d]));if(b.length>0)return"{"+b.join(",")+"}";return"{}"}return a.toString()},dispose:function(){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(){this.timeoutTimer!=null&&clearTimeout(this.timeoutTimer);if(this.xmlHttp){this.xmlHttp.onreadystatechange=AjaxPro.noOperation;this.xmlHttp.abort()}if(this.isRunning){this.isRunning=false;if(this.onLoading){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();a.error!=null&&this.onError(a.error,this);typeof this.callback=="function"&&this.callback(a,this)},mozerror:function(){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)){this.duration=
(new Date).getTime()-this.__start;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(a,b){if(!b){if(typeof this.xmlHttp.responseText=="unknown"){a.error={Message:"XmlHttpRequest error reading property responseText.",
Type:"XmlHttpRequestException"};return a}b=""+this.xmlHttp.responseText;if(AjaxPro.cryptProvider!=null&&typeof AjaxPro.cryptProvider.decrypt=="function")b=AjaxPro.cryptProvider.decrypt(b);if(this.xmlHttp.getResponseHeader("Content-Type")=="text/xml")a.value=this.xmlHttp.responseXML;else if(b!=null&&b.trim().length>0){a.json=b;var c=null;c=AjaxPro.parse(b);if(c!=null)if(typeof c.value!="undefined")a.value=c.value;else if(typeof c.error!="undefined")a.error=c.error}}return a},timeout:function(){this.duration=
(new Date).getTime()-this.__start;var a;if(this.onTimeout)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(a,b,c,d){this.__start=(new Date).getTime();this.xmlHttp=new XMLHttpRequest;this.isRunning=true;this.method=a;this.args=b;this.callback=c;this.context=d;if(c=typeof c=="function"&&c!=AjaxPro.noOperation){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)}if(this.onLoading){this.onLoading(true)}}b=AjaxPro.toJSON(b)+"";if(AjaxPro.cryptProvider!=null&&typeof AjaxPro.cryptProvider.encrypt=="function")b=AjaxPro.cryptProvider.encrypt(b);this.xmlHttp.open("POST",this.url,c);this.xmlHttp.setRequestHeader("Content-Type","text/plain; charset=utf-8");this.xmlHttp.setRequestHeader("X-"+AjaxPro.ID+"-Method",a);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(e){}if(!c)return this.createResponse({error:null,value:null});return true}};
AjaxPro.RequestQueue=function(a){this.queue=[];this.requests=[];this.timer=null;if(isNaN(a))a=2;for(var b=0;b<a;b++){this.requests[b]=new AjaxPro.Request;this.requests[b].callback=function(c){var d=c.context;c.context=d[3][1];d[3][0](c,this)};this.requests[b].callbackHandle=this.requests[b].callback.bind(this.requests[b])}this.processHandle=this.process.bind(this)};
AjaxPro.RequestQueue.prototype={process:function(){this.timer=null;if(this.queue.length!=0){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)}if(this.queue.length>0&&this.timer==null)this.timer=setTimeout(this.processHandle,0)}},add:function(a,b,c,d){this.queue.push([a,b,c,d]);if(this.timer==null)this.timer=setTimeout(this.processHandle,0)},abort:function(){this.queue.length=0;this.timer!=null&&
clearTimeout(this.timer);this.timer=null;for(var a=0;a<this.requests.length;a++)this.requests[a].isRunning==true&&this.requests[a].abort()},dispose:function(){for(var a=0;a<this.requests.length;a++)this.requests[a].dispose();this.requests.clear()}};AjaxPro.queue=new AjaxPro.RequestQueue(2);AjaxPro.AjaxClass=function(a){this.url=a};
AjaxPro.AjaxClass.prototype={invoke:function(a,b,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,a,b,c)}c=new AjaxPro.Request;c.url=this.url;return c.invoke(a,b)}};if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.NameValueCollection=="undefined")Ajax.Web.NameValueCollection={};
Ajax.Web.NameValueCollection=function(a){this.__type="System.Collections.Specialized.NameValueCollection";this.keys=[];this.values=[];if(a!=null&&!isNaN(a.length))for(var b=0;b<a.length;b++)this.add(a[b][0],a[b][1])};
Object.extend(Ajax.Web.NameValueCollection.prototype,{add:function(a,b){if(a==null||a.constructor!=String||b==null||b.constructor!=String)return-1;this.keys.push(a);this.values.push(b);return this.values.length-1},containsKey:function(a){for(var b=0;b<this.keys.length;b++)if(this.keys[b]==a)return true;return false},getKeys:function(){return this.keys},getValue:function(a){for(var b=0;b<this.keys.length&&b<this.values.length;b++)if(this.keys[b]==a)return this.values[b];return null},setValue:function(a,
b){if(a==null||a.constructor!=String||b==null||b.constructor!=String)return-1;for(;0<this.keys.length&&0<this.values.length;){if(this.keys[0]==a)this.values[0]=b;return 0}return this.add(a,b)},toJSON:function(){return AjaxPro.toJSON({__type:this.__type,keys:this.keys,values:this.values})}},true);if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.DataSet=="undefined")Ajax.Web.DataSet={};
Ajax.Web.DataSet=function(a){this.__type="System.Data.DataSet,System.Data";this.Tables=[];this.addTable=function(c){this.Tables.push(c)};if(a!=null)for(var b=0;b<a.length;b++)this.addTable(a[b])};if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.DataTable=="undefined")Ajax.Web.DataTable={};
Ajax.Web.DataTable=function(a,b){this.__type="System.Data.DataTable,System.Data";this.Columns=[];this.Rows=[];this.addColumn=function(e,f){this.Columns.push({Name:e,__type:f})};this.toJSON=function(){var e={},f;e.Columns=[];for(f=0;f<this.Columns.length;f++)e.Columns.push([this.Columns[f].Name,this.Columns[f].__type]);e.Rows=[];for(f=0;f<this.Rows.length;f++){for(var h=[],g=0;g<this.Columns.length;g++)h.push(this.Rows[f][this.Columns[g].Name]);e.Rows.push(h)}return AjaxPro.toJSON(e)};this.addRow=
function(e){this.Rows.push(e)};if(a!=null)for(var c=0;c<a.length;c++)this.addColumn(a[c][0],a[c][1]);if(b!=null)for(a=0;a<b.length;a++){c={};for(var d=0;d<this.Columns.length&&d<b[a].length;d++)c[this.Columns[d].Name]=b[a][d];this.addRow(c)}};if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.Profile=="undefined")Ajax.Web.Profile={};
Ajax.Web.Profile=function(){this.toJSON=function(){throw"Ajax.Web.Profile cannot be converted to JSON format.";};this.setProperty_callback=function(){};this.setProperty=function(a,b){this[a]=b;AjaxPro.Services.Profile.SetProfile({name:o},this.setProperty_callback.bind(this))}};if(typeof Ajax=="undefined")Ajax={};if(typeof Ajax.Web=="undefined")Ajax.Web={};if(typeof Ajax.Web.Dictionary=="undefined")Ajax.Web.Dictionary={};
Ajax.Web.Dictionary=function(a,b){this.__type=a;this.keys=[];this.values=[];if(b!=null&&!isNaN(b.length))for(a=0;a<b.length;a++)this.add(b[a][0],b[a][1])};
Object.extend(Ajax.Web.Dictionary.prototype,{add:function(a,b){this.keys.push(a);this.values.push(b);return this.values.length-1},containsKey:function(a){for(var b=0;b<this.keys.length;b++)if(this.keys[b]==a)return true;return false},getKeys:function(){return this.keys},getValue:function(a){for(var b=0;b<this.keys.length&&b<this.values.length;b++)if(this.keys[b]==a)return this.values[b];return null},setValue:function(a,b){for(;0<this.keys.length&&0<this.values.length;){if(this.keys[0]==a)this.values[0]=
b;return 0}return this.add(a,b)},toJSON:function(){return AjaxPro.toJSON({__type:this.__type,keys:this.keys,values:this.values})}},true);
