(function(){var a=null;function b(){var b=false,d="callback",c="undefined";Type._registerScript("MicrosoftAjaxWebServices.js",["MicrosoftAjaxNetwork.js"]);Type.registerNamespace("Sys.Net");Sys.Net.WebServiceProxy=function(){};Sys.Net.WebServiceProxy.prototype={get_timeout:function(){return this._timeout||0},set_timeout:function(a){this._timeout=a},get_defaultUserContext:function(){return typeof this._userContext===c?a:this._userContext},set_defaultUserContext:function(a){this._userContext=a},get_defaultSucceededCallback:function(){return this._succeeded||a},set_defaultSucceededCallback:function(a){this._succeeded=a},get_defaultFailedCallback:function(){return this._failed||a},set_defaultFailedCallback:function(a){this._failed=a},get_enableJsonp:function(){return !!this._jsonp},set_enableJsonp:function(a){this._jsonp=a},get_path:function(){return this._path||a},set_path:function(a){this._path=a},get_jsonpCallbackParameter:function(){return this._callbackParameter||d},set_jsonpCallbackParameter:function(a){this._callbackParameter=a},_invoke:function(g,h,j,i,f,e,d){var b=this;f=f||b.get_defaultSucceededCallback();e=e||b.get_defaultFailedCallback();if(d===a||typeof d===c)d=b.get_defaultUserContext();return Sys.Net.WebServiceProxy.invoke(g,h,j,i,f,e,d,b.get_timeout(),b.get_enableJsonp(),b.get_jsonpCallbackParameter())}};Sys.Net.WebServiceProxy.registerClass("Sys.Net.WebServiceProxy");Sys.Net.WebServiceProxy.invoke=function(u,e,q,p,o,f,l,j,z,t){var h="Content-Type",n=z!==b?Sys.Net.WebServiceProxy._xdomain.exec(u):a,g,r=n&&n.length===3&&(n[1]!==location.protocol||n[2]!==location.host);q=r||q;if(r){t=t||d;g="_jsonp"+Sys._jsonp++}if(!p)p={};var v=p;if(!q||!v)v={};var m,k=a,s=a,x=Sys.Net.WebRequest._createUrl(e?u+"/"+encodeURIComponent(e):u,v,r?t+"=Sys."+g:a);if(r){function y(){if(k===a)return;k=a;m=new Sys.Net.WebServiceError(true,String.format(Sys.Res.webServiceTimedOut,e));delete Sys[g];if(f)f(m,l,e)}function w(d,h){if(k!==a){window.clearTimeout(k);k=a}delete Sys[g];g=a;if(typeof h!==c&&h!==200){if(f){m=new Sys.Net.WebServiceError(b,d.Message||String.format(Sys.Res.webServiceFailedNoMsg,e),d.StackTrace||a,d.ExceptionType||a,d);m._statusCode=h;f(m,l,e)}}else if(o)o(d,l,e)}Sys[g]=w;j=j||Sys.Net.WebRequestManager.get_defaultTimeout();if(j>0)k=window.setTimeout(y,j);Sys._loadJsonp(x,function(){if(g)w({Message:String.format(Sys.Res.webServiceFailedNoMsg,e)},-1)});return a}var i=new Sys.Net.WebRequest;i.set_url(x);i.get_headers()[h]="application/json; charset=utf-8";if(!q){s=Sys.Serialization.JavaScriptSerializer.serialize(p);if(s==="{}")s=""}i.set_body(s);i.add_completed(A);if(j&&j>0)i.set_timeout(j);i.invoke();function A(i){var g="application/json";if(i.get_responseAvailable()){var r,k=i.get_statusCode(),d=a;try{var j=i.getResponseHeader(h);d=j.startsWith(g)?i.get_object():j.startsWith("text/xml")?i.get_xml():i.get_responseData()}catch(r){}var p=i.getResponseHeader("jsonerror"),m=p==="true";if(m){if(d)d=new Sys.Net.WebServiceError(b,d.Message,d.StackTrace,d.ExceptionType,d)}else if(j.startsWith(g))d=!d||typeof d.d===c?d:d.d;if(k<200||k>=300||m){if(f){if(!d||!m)d=new Sys.Net.WebServiceError(b,String.format(Sys.Res.webServiceFailedNoMsg,e));d._statusCode=k;f(d,l,e)}}else if(o)o(d,l,e)}else{var n=i.get_timedOut(),q=String.format(n?Sys.Res.webServiceTimedOut:Sys.Res.webServiceFailedNoMsg,e);if(f)f(new Sys.Net.WebServiceError(n,q,"",""),l,e)}}return i};Sys.Net.WebServiceProxy._generateTypedConstructor=function(a){return function(b){if(b)for(var c in b)this[c]=b[c];this.__type=a}};Sys._jsonp=0;Sys.Net.WebServiceProxy._xdomain=/^\s*([a-zA-Z0-9\+\-\.]+\:)\/\/([^?#\/]+)/;Sys._loadJsonp=function(h,g){var d="onreadystatechange",c=createElement("script");c.type="text/javascript";c.src=h;var f=c.attachEvent;function e(){if(!f||/loaded|complete/.test(c.readyState)){if(f)c.detachEvent(d,e);else{c.removeEventListener("load",e,b);c.removeEventListener("error",e,b)}g.apply(c);c=a}}if(f)c.attachEvent(d,e);else{c.addEventListener("load",e,b);c.addEventListener("error",e,b)}document.getElementsByTagName("head")[0].appendChild(c)};Sys.Net.WebServiceError=function(e,f,d,b,c){var a=this;a._timedOut=e;a._message=f;a._stackTrace=d;a._exceptionType=b;a._errorObject=c;a._statusCode=-1};Sys.Net.WebServiceError.prototype={get_timedOut:function(){return this._timedOut},get_statusCode:function(){return this._statusCode},get_message:function(){return this._message},get_stackTrace:function(){return this._stackTrace||""},get_exceptionType:function(){return this._exceptionType||""},get_errorObject:function(){return this._errorObject||a}};Sys.Net.WebServiceError.registerClass("Sys.Net.WebServiceError")}if(window.Sys&&Sys.loader)Sys.loader.registerScript("WebServices",a,b);else b()})();
