Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.DynamicPopulateBehavior=function(n){Sys.Extended.UI.DynamicPopulateBehavior.initializeBase(this,[n]);this._servicePath=location.pathname;this._serviceMethod=null;this._contextKey=null;this._cacheDynamicResults=!1;this._populateTriggerID=null;this._setUpdatingCssClass=null;this._clearDuringUpdate=!0;this._customScript=null;this._clickHandler=null;this._callID=0;this._currentCallID=-1;this._populated=!1};Sys.Extended.UI.DynamicPopulateBehavior.prototype={initialize:function(){if(Sys.Extended.UI.DynamicPopulateBehavior.callBaseMethod(this,"initialize"),$common.prepareHiddenElementForATDeviceUpdate(),this._populateTriggerID){var n=$get(this._populateTriggerID);n&&(this._clickHandler=Function.createDelegate(this,this._onPopulateTriggerClick),$addHandler(n,"click",this._clickHandler))}},dispose:function(){if(this._populateTriggerID&&this._clickHandler){var n=$get(this._populateTriggerID);n&&$removeHandler(n,"click",this._clickHandler);this._populateTriggerID=null;this._clickHandler=null}Sys.Extended.UI.DynamicPopulateBehavior.callBaseMethod(this,"dispose")},populate:function(contextKey){var eventArgs,scriptResult;if(contextKey&&(this._contextKey=contextKey),!this._populated||!this._cacheDynamicResults){if(this._currentCallID==-1){if(eventArgs=new Sys.CancelEventArgs,this.raise_populating(eventArgs),eventArgs.get_cancel())return;this._setUpdating(!0)}if(this._customScript)scriptResult=eval(this._customScript),this._setTargetHtml(scriptResult),this._setUpdating(!1);else{if(this._currentCallID=++this._callID,!this._servicePath||!this._serviceMethod)return;Sys.Net.WebServiceProxy.invoke(this._servicePath,this._serviceMethod,!1,{contextKey:contextKey?contextKey:this._contextKey},Function.createDelegate(this,this._onMethodComplete),Function.createDelegate(this,this._onMethodError),this._currentCallID);$common.updateFormToRefreshATDeviceBuffer()}}},_onMethodComplete:function(n,t){t==this._currentCallID&&(this._setTargetHtml(n),this._setUpdating(!1))},_onMethodError:function(n,t){t==this._currentCallID&&(n.get_timedOut()?this._setTargetHtml(Sys.Extended.UI.Resources.DynamicPopulate_WebServiceTimeout):this._setTargetHtml(String.format(Sys.Extended.UI.Resources.DynamicPopulate_WebServiceError,n.get_statusCode())),this._setUpdating(!1))},_onPopulateTriggerClick:function(){this.populate(this._contextKey)},_setUpdating:function(n){this.setStyle(n);n||(this._currentCallID=-1,this._populated=!0,this.raise_populated(this,Sys.EventArgs.Empty))},_setTargetHtml:function(n){var t=this.get_element();t&&(t.tagName=="INPUT"?t.value=n:t.innerHTML=n)},setStyle:function(n){var t=this.get_element();this._setUpdatingCssClass&&(n?(this._oldCss=t.className,t.className=this._setUpdatingCssClass):(t.className=this._oldCss,this._oldCss=null));n&&this._clearDuringUpdate&&this._setTargetHtml("")},get_clearContentsDuringUpdate:function(){return this._clearDuringUpdate},set_clearContentsDuringUpdate:function(n){this._clearDuringUpdate!=n&&(this._clearDuringUpdate=n,this.raisePropertyChanged("clearContentsDuringUpdate"))},get_ClearContentsDuringUpdate:function(){return Sys.Extended.Deprecated("get_ClearContentsDuringUpdate","get_clearContentsDuringUpdate"),this.get_clearContentsDuringUpdate()},set_ClearContentsDuringUpdate:function(n){Sys.Extended.Deprecated("set_ClearContentsDuringUpdate","set_clearContentsDuringUpdate");this.set_clearContentsDuringUpdate(n)},get_contextKey:function(){return this._contextKey},set_contextKey:function(n){this._contextKey!=n&&(this._contextKey=n,this.raisePropertyChanged("contextKey"))},get_ContextKey:function(){return Sys.Extended.Deprecated("get_ContextKey","get_contextKey"),this.get_contextKey()},set_ContextKey:function(n){Sys.Extended.Deprecated("set_ContextKey","set_contextKey");this.set_contextKey(n)},get_populateTriggerID:function(){return this._populateTriggerID},set_populateTriggerID:function(n){this._populateTriggerID!=n&&(this._populateTriggerID=n,this.raisePropertyChanged("populateTriggerID"))},get_PopulateTriggerID:function(){return Sys.Extended.Deprecated("get_PopulateTriggerID","get_populateTriggerID"),this.get_populateTriggerID()},set_PopulateTriggerID:function(n){Sys.Extended.Deprecated("set_PopulateTriggerID","set_populateTriggerID");this.set_populateTriggerID(n)},get_servicePath:function(){return this._servicePath},set_servicePath:function(n){this._servicePath!=n&&(this._servicePath=n,this.raisePropertyChanged("servicePath"))},get_ServicePath:function(){return Sys.Extended.Deprecated("get_ServicePath","get_servicePath"),this.get_servicePath()},set_ServicePath:function(n){Sys.Extended.Deprecated("set_ServicePath","set_servicePath");this.set_servicePath(n)},get_serviceMethod:function(){return this._serviceMethod},set_serviceMethod:function(n){this._serviceMethod!=n&&(this._serviceMethod=n,this.raisePropertyChanged("serviceMethod"))},get_ServiceMethod:function(){return Sys.Extended.Deprecated("get_ServiceMethod","get_serviceMethod"),this.get_serviceMethod()},set_ServiceMethod:function(n){Sys.Extended.Deprecated("set_ServiceMethod","set_serviceMethod");this.set_serviceMethod(n)},get_cacheDynamicResults:function(){return this._cacheDynamicResults},set_cacheDynamicResults:function(n){this._cacheDynamicResults!=n&&(this._cacheDynamicResults=n,this.raisePropertyChanged("cacheDynamicResults"))},get_updatingCssClass:function(){return this._setUpdatingCssClass},set_updatingCssClass:function(n){this._setUpdatingCssClass!=n&&(this._setUpdatingCssClass=n,this.raisePropertyChanged("updatingCssClass"))},get_UpdatingCssClass:function(){return Sys.Extended.Deprecated("get_UpdatingCssClass","get_updatingCssClass"),this.get_updatingCssClass()},set_UpdatingCssClass:function(n){Sys.Extended.Deprecated("set_UpdatingCssClass","set_updatingCssClass");this.set_updatingCssClass(n)},get_customScript:function(){return this._customScript},set_customScript:function(n){this._customScript!=n&&(this._customScript=n,this.raisePropertyChanged("customScript"))},get_CustomScript:function(){return Sys.Extended.Deprecated("get_CustomScript","get_customScript"),this.get_customScript()},set_CustomScript:function(n){Sys.Extended.Deprecated("set_CustomScript","set_customScript");this.set_customScript(n)},add_populating:function(n){this.get_events().addHandler("populating",n)},remove_populating:function(n){this.get_events().removeHandler("populating",n)},raise_populating:function(n){var t=this.get_events().getHandler("populating");t&&t(this,n)},raisePopulating:function(n){Sys.Extended.Deprecated("raisePopulating(eventArgs)","raise_populating(eventArgs)");this.raise_populating(n)},add_populated:function(n){this.get_events().addHandler("populated",n)},remove_populated:function(n){this.get_events().removeHandler("populated",n)},raise_populated:function(n){var t=this.get_events().getHandler("populated");t&&t(this,n)},raisePopulated:function(n){Sys.Extended.Deprecated("raisePopulated(eventArgs)","raise_populated(eventArgs)");this.raise_populated(n)}};Sys.Extended.UI.DynamicPopulateBehavior.registerClass("Sys.Extended.UI.DynamicPopulateBehavior",Sys.Extended.UI.BehaviorBase);