﻿Type.registerNamespace("Core.Web.UI.Controls");Core.Web.UI.Controls.ContentLoader=function(c){var b=null,a=this;Core.Web.UI.Controls.ContentLoader.initializeBase(a,[c]);a._ourControl=b;a._loadAsync=true;a._enableHistory=false;a._renderUrl=b;a._queryData=b;a._staticUrl=b;a._querystringDictionary=b;a._contentDivClientId=b;a._loadingDivClientId=b;a._errorDivClientId=b;a._isLoaded=false;a._loadingTemplateDelay=0;a._onClientAsyncLoadComplete=b;a._onClientAsyncLoading=b;a._onClientAsyncLoadError=b;a._disableAsyncRequestOnLoad=false};Core.Web.UI.Controls.ContentLoader.prototype={initialize:function(){var a=this;Core.Web.UI.Controls.ContentLoader.callBaseMethod(a,"initialize");a._staticUrl=a._renderUrl;a._ourControl=a.get_element();a.ResetState();a._enableHistory&&Sys.Application.add_navigate(Function.createDelegate(a,a.OnNavigate));a._ourControl.Update=Function.createDelegate(a,function(a,b){if(b==undefined)b=true;if(b&&this._enableHistory){var c=null;if(a!=null&&a.length>0)c=escape(a);Sys.Application.addHistoryPoint({query:c,key:this.get_id()})}else this.LoadContent(a)});a._ourControl.ResetState=Function.createDelegate(a,a.ResetState);!a._disableAsyncRequestOnLoad&&a._loadAsync&&a.LoadContent()},ConsumeQuery:function(a,b){if(a==null||a.length<1)return;if(b==null)b=new Core.Web.UI.Common.Dictionary;if(a.startsWith("&"))a=a.substring(1);a=a.split("&");for(var c=0,c=0;c<a.length;c++){var d=a[c].split("=");b.Add(d[0],d[1])}},ResetState:function(){var a=this;a._querystringDictionary=new Core.Web.UI.Common.Dictionary;a.ConsumeQuery(a._queryData,a._querystringDictionary)},LoadContent:function(newQuerystring){var b=this,url=b._renderUrl;b.ConsumeQuery(newQuerystring,b._querystringDictionary);for(i=0;i<b._querystringDictionary.GetAllKeys().length;i++){var key=b._querystringDictionary.GetAllKeys()[i];url=url+"&"+key+"="+b._querystringDictionary[key]}b._isLoaded=false;setTimeout(Function.createDelegate(b,function(){var a=this;if(a._isLoaded)return;a.ContentAnimateOut();a.LoadingAnimateIn();a.ErrorAnimateOut()}),b._loadingTemplateDelay);if(b._onClientAsyncLoading!=null&&b._onClientAsyncLoading.length>0)eval(b._onClientAsyncLoading);url=url.replace(/ /g,"%20");$("#"+b._contentDivClientId).load(url,null,Function.createDelegate(b,b.OnContentLoaded))},OnContentLoaded:function(responseText,textStatus,XMLHttpRequest){var a=this;a._isLoaded=true;a.LoadingAnimateOut();if(XMLHttpRequest.status==200){a.ContentAnimateIn();a.ErrorAnimateOut();if(a._onClientAsyncLoadComplete!=null&&a._onClientAsyncLoadComplete.length>0)eval(a._onClientAsyncLoadComplete)}else{a.ErrorAnimateIn();a.ContentAnimateOut();if(a._onClientAsyncError!=null&&a._onClientAsyncError.length>0)eval(a._onClientAsyncError)}},OnNavigate:function(e,d){var a=this,c=d.get_state().key;if(c!=null&&c!=a.get_id())return;var b=d.get_state().query;if(b==null||b.length<1){a.ResetState();a.LoadContent()}else a.LoadContent(unescape(b))},LoadingAnimateOut:function(){var a=$("#"+this._loadingDivClientId)[0];if(typeof this._ourControl.LoadingAnimateOut=="function")this._ourControl.LoadingAnimateOut(a);else $(a).hide()},LoadingAnimateIn:function(){var a=$("#"+this._loadingDivClientId)[0];if(typeof this._ourControl.LoadingAnimateIn=="function")this._ourControl.LoadingAnimateIn(a);else $(a).show()},ContentAnimateIn:function(){var a=$("#"+this._contentDivClientId)[0];if(typeof this._ourControl.ContentAnimateIn=="function")this._ourControl.ContentAnimateIn(a);else $(a).show()},ContentAnimateOut:function(){var a=$("#"+this._contentDivClientId)[0];if(typeof this._ourControl.ContentAnimateOut=="function")this._ourControl.ContentAnimateOut(a);else $(a).hide()},ErrorAnimateIn:function(){var a=$("#"+this._errorDivClientId)[0];if(typeof this._ourControl.ErrorAnimateIn=="function")this._ourControl.ErrorAnimateIn(a);else $(a).show()},ErrorAnimateOut:function(){var a=$("#"+this._errorDivClientId)[0];if(typeof this._ourControl.ErrorAnimateOut=="function")this._ourControl.ErrorAnimateOut(a);else $(a).hide()},get_loadAsync:function(){return this._loadAsync},set_loadAsync:function(a){if(this._loadAsync!=a){this._loadAsync=a;this.raisePropertyChanged("loadAsync")}},get_enableHistory:function(){return this._enableHistory},set_enableHistory:function(a){if(this._enableHistory!=a){this._enableHistory=a;this.raisePropertyChanged("enableHistory")}},get_renderUrl:function(){return this._renderUrl},set_renderUrl:function(a){if(this._renderUrl!=a){this._renderUrl=a;this.raisePropertyChanged("renderUrl")}},get_loadingDivClientId:function(){return this._loadingDivClientId},set_loadingDivClientId:function(a){if(this._loadingDivClientId!=a){this._loadingDivClientId=a;this.raisePropertyChanged("loadingDivClientId")}},get_contentDivClientId:function(){return this._contentDivClientId},set_contentDivClientId:function(a){if(this._contentDivClientId!=a){this._contentDivClientId=a;this.raisePropertyChanged("contentDivClientId")}},get_errorDivClientId:function(){return this._errorDivClientId},set_errorDivClientId:function(a){if(this._errorDivClientId!=a){this._errorDivClientId=a;this.raisePropertyChanged("errorDivClientId")}},get_loadingTemplateDelay:function(){return this._loadingTemplateDelay},set_loadingTemplateDelay:function(a){if(this._loadingTemplateDelay!=a){this._loadingTemplateDelay=a;this.raisePropertyChanged("loadingTemplateDelay")}},get_onClientAsyncLoadComplete:function(){return this._onClientAsyncLoadComplete},set_onClientAsyncLoadComplete:function(a){if(this._onClientAsyncLoadComplete!=a){this._onClientAsyncLoadComplete=a;this.raisePropertyChanged("onClientAsyncLoadComplete")}},get_onClientAsyncLoading:function(){return this._onClientAsyncLoading},set_onClientAsyncLoading:function(a){if(this._onClientAsyncLoading!=a){this._onClientAsyncLoading=a;this.raisePropertyChanged("onClientAsyncLoading")}},get_onClientAsyncLoadError:function(){return this._onClientAsyncLoadError},set_onClientAsyncLoadError:function(a){if(this._onClientAsyncLoadError!=a){this._onClientAsyncLoadError=a;this.raisePropertyChanged("onClientAsyncLoadError")}},get_disableAsyncRequestOnLoad:function(){return this._disableAsyncRequestOnLoad},set_disableAsyncRequestOnLoad:function(a){if(this._disableAsyncRequestOnLoad!=a){this._disableAsyncRequestOnLoad=a;this.raisePropertyChanged("disableAsyncRequestOnLoad")}},get_queryData:function(){return this._queryData},set_queryData:function(a){if(this._queryData!=a){this._queryData=a;this.raisePropertyChanged("queryData")}}};Core.Web.UI.Controls.ContentLoader.registerClass("Core.Web.UI.Controls.ContentLoader",Sys.UI.Control)
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();