﻿(function(){var scriptName="ExtendedDynamicPopulate";function execute(){var f="populated",c="populating",e=false,d=null;Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.DynamicPopulateBehavior=function(b){var a=this;Sys.Extended.UI.DynamicPopulateBehavior.initializeBase(a,[b]);a._servicePath=location.pathname;a._serviceMethod=d;a._contextKey=d;a._cacheDynamicResults=e;a._populateTriggerID=d;a._setUpdatingCssClass=d;a._clearDuringUpdate=true;a._customScript=d;a._clickHandler=d;a._callID=0;a._currentCallID=-1;a._populated=e};Sys.Extended.UI.DynamicPopulateBehavior.prototype={initialize:function(){var a=this;Sys.Extended.UI.DynamicPopulateBehavior.callBaseMethod(a,"initialize");$common.prepareHiddenElementForATDeviceUpdate();if(a._populateTriggerID){var b=$get(a._populateTriggerID);if(b){a._clickHandler=Function.createDelegate(a,a._onPopulateTriggerClick);$addHandler(b,"click",a._clickHandler)}}},dispose:function(){var a=this;if(a._populateTriggerID&&a._clickHandler){var b=$get(a._populateTriggerID);b&&$removeHandler(b,"click",a._clickHandler);a._populateTriggerID=d;a._clickHandler=d}Sys.Extended.UI.DynamicPopulateBehavior.callBaseMethod(a,"dispose")},populate:function(contextKey){var a=this;if(a._populated&&a._cacheDynamicResults)return;if(a._currentCallID==-1){var eventArgs=new Sys.CancelEventArgs;a.raisePopulating(eventArgs);if(eventArgs.get_cancel())return;a._setUpdating(true)}if(a._customScript){var scriptResult=eval(a._customScript);a._setTargetHtml(scriptResult);a._setUpdating(e)}else{a._currentCallID=++a._callID;if(a._servicePath&&a._serviceMethod){Sys.Net.WebServiceProxy.invoke(a._servicePath,a._serviceMethod,e,{contextKey:contextKey?contextKey:a._contextKey},Function.createDelegate(a,a._onMethodComplete),Function.createDelegate(a,a._onMethodError),a._currentCallID);$common.updateFormToRefreshATDeviceBuffer()}}},_onMethodComplete:function(b,a){if(a!=this._currentCallID)return;this._setTargetHtml(b);this._setUpdating(e)},_onMethodError:function(b,c){var a=this;if(c!=a._currentCallID)return;if(b.get_timedOut())a._setTargetHtml(Sys.Extended.UI.Resources.DynamicPopulate_WebServiceTimeout);else a._setTargetHtml(String.format(Sys.Extended.UI.Resources.DynamicPopulate_WebServiceError,b.get_statusCode()));a._setUpdating(e)},_onPopulateTriggerClick:function(){this.populate(this._contextKey)},_setUpdating:function(b){var a=this;a.setStyle(b);if(!b){a._currentCallID=-1;a._populated=true;a.raisePopulated(a,Sys.EventArgs.Empty)}},_setTargetHtml:function(b){var a=this.get_element();if(a)if(a.tagName=="INPUT")a.value=b;else a.innerHTML=b},setStyle:function(c){var a=this,b=a.get_element();if(a._setUpdatingCssClass)if(!c){b.className=a._oldCss;a._oldCss=d}else{a._oldCss=b.className;b.className=a._setUpdatingCssClass}c&&a._clearDuringUpdate&&a._setTargetHtml("")},get_ClearContentsDuringUpdate:function(){return this._clearDuringUpdate},set_ClearContentsDuringUpdate:function(a){if(this._clearDuringUpdate!=a){this._clearDuringUpdate=a;this.raisePropertyChanged("ClearContentsDuringUpdate")}},get_ContextKey:function(){return this._contextKey},set_ContextKey:function(a){if(this._contextKey!=a){this._contextKey=a;this.raisePropertyChanged("ContextKey")}},get_PopulateTriggerID:function(){return this._populateTriggerID},set_PopulateTriggerID:function(a){if(this._populateTriggerID!=a){this._populateTriggerID=a;this.raisePropertyChanged("PopulateTriggerID")}},get_ServicePath:function(){return this._servicePath},set_ServicePath:function(a){if(this._servicePath!=a){this._servicePath=a;this.raisePropertyChanged("ServicePath")}},get_ServiceMethod:function(){return this._serviceMethod},set_ServiceMethod:function(a){if(this._serviceMethod!=a){this._serviceMethod=a;this.raisePropertyChanged("ServiceMethod")}},get_cacheDynamicResults:function(){return this._cacheDynamicResults},set_cacheDynamicResults:function(a){if(this._cacheDynamicResults!=a){this._cacheDynamicResults=a;this.raisePropertyChanged("cacheDynamicResults")}},get_UpdatingCssClass:function(){return this._setUpdatingCssClass},set_UpdatingCssClass:function(a){if(this._setUpdatingCssClass!=a){this._setUpdatingCssClass=a;this.raisePropertyChanged("UpdatingCssClass")}},get_CustomScript:function(){return this._customScript},set_CustomScript:function(a){if(this._customScript!=a){this._customScript=a;this.raisePropertyChanged("CustomScript")}},add_populating:function(a){this.get_events().addHandler(c,a)},remove_populating:function(a){this.get_events().removeHandler(c,a)},raisePopulating:function(b){var a=this.get_events().getHandler(c);a&&a(this,b)},add_populated:function(a){this.get_events().addHandler(f,a)},remove_populated:function(a){this.get_events().removeHandler(f,a)},raisePopulated:function(b){var a=this.get_events().getHandler(f);a&&a(this,b)}};Sys.Extended.UI.DynamicPopulateBehavior.registerClass("Sys.Extended.UI.DynamicPopulateBehavior",Sys.Extended.UI.BehaviorBase);Sys.registerComponent(Sys.Extended.UI.DynamicPopulateBehavior,{name:"dynamicPopulate"})}if(window.Sys&&Sys.loader)Sys.loader.registerScript(scriptName,["ExtendedBase","ExtendedCommon","Network"],execute);else execute()})();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();