Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.PopupControlBehavior=function(n){Sys.Extended.UI.PopupControlBehavior.initializeBase(this,[n]);this._popupControlID=null;this._commitProperty=null;this._commitScript=null;this._position=null;this._offsetX=0;this._offsetY=0;this._extenderControlID=null;this._popupElement=null;this._popupBehavior=null;this._popupVisible=!1;this._focusHandler=null;this._popupKeyDownHandler=null;this._popupClickHandler=null;this._bodyClickHandler=null;this._onShowJson=null;this._onHideJson=null};Sys.Extended.UI.PopupControlBehavior.prototype={initialize:function(){Sys.Extended.UI.PopupControlBehavior.callBaseMethod(this,"initialize");var n=this.get_element();this._popupElement=$get(this._popupControlID);this._popupBehavior=$create(Sys.Extended.UI.PopupBehavior,{id:this.get_id()+"PopupBehavior",parentElement:n},null,null,this._popupElement);this._onShowJson&&this._popupBehavior.set_onShow(this._onShowJson);this._onHideJson&&this._popupBehavior.set_onHide(this._onHideJson);this._focusHandler=Function.createDelegate(this,this._onFocus);this._popupClickHandler=Function.createDelegate(this,this._onPopupClick);this._bodyClickHandler=Function.createDelegate(this,this._onBodyClick);this._popupKeyDownHandler=Function.createDelegate(this,this._onPopupKeyDown);$addHandler(n,"focus",this._focusHandler);$addHandler(n,"click",this._focusHandler);$addHandler(document.body,"click",this._bodyClickHandler);$addHandler(this._popupElement,"click",this._popupClickHandler);$addHandler(this._popupElement,"keydown",this._popupKeyDownHandler);this.registerPartialUpdateEvents();Sys.Extended.UI.PopupControlBehavior.__VisiblePopup&&this.get_id()==Sys.Extended.UI.PopupControlBehavior.__VisiblePopup.get_id()&&this._onFocus(null)},dispose:function(){var n=this.get_element();this._onShowJson=null;this._onHideJson=null;this._popupBehavior&&(this._popupBehavior.dispose(),this._popupBehavior=null);this._focusHandler&&($removeHandler(n,"focus",this._focusHandler),$removeHandler(n,"click",this._focusHandler),this._focusHandler=null);this._bodyClickHandler&&($removeHandler(document.body,"click",this._bodyClickHandler),this._bodyClickHandler=null);this._popupClickHandler&&($removeHandler(this._popupElement,"click",this._popupClickHandler),this._popupClickHandler=null);this._popupKeyDownHandler&&($removeHandler(this._popupElement,"keydown",this._popupKeyDownHandler),this._popupKeyDownHandler=null);Sys.Extended.UI.PopupControlBehavior.callBaseMethod(this,"dispose")},showPopup:function(){var n=Sys.Extended.UI.PopupControlBehavior.__VisiblePopup;n&&n._popupBehavior&&n.hidePopup();Sys.Extended.UI.PopupControlBehavior.callBaseMethod(this,"populate");this._popupBehavior.set_x(this._getLeftOffset());this._popupBehavior.set_y(this._getTopOffset());this._popupBehavior.show();this._popupVisible=!0;Sys.Extended.UI.PopupControlBehavior.__VisiblePopup=this},hidePopup:function(){this._popupBehavior.hide();this._popupVisible=!1;Sys.Extended.UI.PopupControlBehavior.__VisiblePopup=null},_onFocus:function(n){this._popupVisible||this.showPopup();n&&n.stopPropagation()},_onPopupKeyDown:function(n){this._popupVisible&&n.keyCode==27&&this.get_element().focus()},_onPopupClick:function(n){n.stopPropagation()},_onBodyClick:function(){this._popupVisible&&this.hidePopup()},_close:function(result){var e=this.get_element();null!=result&&("$$CANCEL$$"!=result&&(this._commitProperty?e[this._commitProperty]=result:"text"==e.type?e.value=result:Sys.Debug.assert(!1,String.format(Sys.Extended.UI.Resources.PopupControl_NoDefaultProperty,e.id,e.type)),this._commitScript&&eval(this._commitScript)),this.hidePopup())},_partialUpdateEndRequest:function(n,t){if(Sys.Extended.UI.PopupControlBehavior.callBaseMethod(this,"_partialUpdateEndRequest",[n,t]),this.get_element()){var i=t.get_dataItems()[this.get_element().id];undefined===i&&Sys.Extended.UI.PopupControlBehavior.__VisiblePopup&&this.get_id()==Sys.Extended.UI.PopupControlBehavior.__VisiblePopup.get_id()&&(i=t.get_dataItems()._PopupControl_Proxy_ID_);undefined!==i&&this._close(i)}},_onPopulated:function(n,t){Sys.Extended.UI.PopupControlBehavior.callBaseMethod(this,"_onPopulated",[n,t]);this._popupVisible&&this._popupBehavior.show()},_getLeftOffset:function(){return Sys.Extended.UI.PopupControlPopupPosition.Left==this._position?-1*this.get_element().offsetWidth+this._offsetX:Sys.Extended.UI.PopupControlPopupPosition.Right==this._position?this.get_element().offsetWidth+this._offsetX:this._offsetX},_getTopOffset:function(){return Sys.Extended.UI.PopupControlPopupPosition.Top==this._position?-1*this.get_element().offsetHeight+this._offsetY:Sys.Extended.UI.PopupControlPopupPosition.Bottom==this._position?this.get_element().offsetHeight+this._offsetY:this._offsetY},get_onShow:function(){return this._popupBehavior?this._popupBehavior.get_onShow():this._onShowJson},set_onShow:function(n){this._popupBehavior?this._popupBehavior.set_onShow(n):this._onShowJson=n;this.raisePropertyChanged("onShow")},get_onShowBehavior:function(){return this._popupBehavior?this._popupBehavior.get_onShowBehavior():null},onShow:function(){this._popupBehavior&&this._popupBehavior.onShow()},get_onHide:function(){return this._popupBehavior?this._popupBehavior.get_onHide():this._onHideJson},set_onHide:function(n){this._popupBehavior?this._popupBehavior.set_onHide(n):this._onHideJson=n;this.raisePropertyChanged("onHide")},get_onHideBehavior:function(){return this._popupBehavior?this._popupBehavior.get_onHideBehavior():null},onHide:function(){this._popupBehavior&&this._popupBehavior.onHide()},get_popupControlID:function(){return this._popupControlID},set_popupControlID:function(n){this._popupControlID!=n&&(this._popupControlID=n,this.raisePropertyChanged("popupControlID"))},get_PopupControlID:function(){return Sys.Extended.Deprecated("get_PopupControlID()","get_popupControlID()"),this.get_popupControlID()},set_PopupControlID:function(n){Sys.Extended.Deprecated("set_PopupControlID(value)","set_popupControlID(value)");this.set_popupControlID(n)},get_commitProperty:function(){return this._commitProperty},set_commitProperty:function(n){this._commitProperty!=n&&(this._commitProperty=n,this.raisePropertyChanged("commitProperty"))},get_CommitProperty:function(){return Sys.Extended.Deprecated("get_CommitProperty()","get_commitProperty()"),this.get_commitProperty()},set_CommitProperty:function(n){Sys.Extended.Deprecated("set_CommitProperty(value)","set_commitProperty(value)");this.set_commitProperty(n)},get_commitScript:function(){return this._commitScript},set_commitScript:function(n){this._commitScript!=n&&(this._commitScript=n,this.raisePropertyChanged("commitScript"))},get_CommitScript:function(){return Sys.Extended.Deprecated("get_CommitScript()","get_commitScript()"),this.get_commitScript()},set_CommitScript:function(n){Sys.Extended.Deprecated("set_CommitScript(value)","set_commitScript(value)");this.set_commitScript(n)},get_position:function(){return this._position},set_position:function(n){this._position!=n&&(this._position=n,this.raisePropertyChanged("position"))},get_Position:function(){return Sys.Extended.Deprecated("get_Position()","get_position()"),this.get_position()},set_Position:function(n){Sys.Extended.Deprecated("set_Position(value)","set_position(value)");this.set_position(n)},get_extenderControlID:function(){return this._extenderControlID},set_extenderControlID:function(n){this._extenderControlID!=n&&(this._extenderControlID=n,this.raisePropertyChanged("extenderControlID"))},get_ExtenderControlID:function(){return Sys.Extended.Deprecated("get_ExtenderControlID()","get_extenderControlID()"),this.get_extenderControlID()},set_ExtenderControlID:function(n){Sys.Extended.Deprecated("set_ExtenderControlID(value)","set_extenderControlID(value)");this.set_extenderControlID(n)},get_offsetX:function(){return this._offsetX},set_offsetX:function(n){this._offsetX!=n&&(this._offsetX=n,this.raisePropertyChanged("offsetX"))},get_OffsetX:function(){return Sys.Extended.Deprecated("get_OffsetX()","get_offsetX()"),this.get_offsetX()},set_OffsetX:function(n){Sys.Extended.Deprecated("set_OffsetX(value)","set_offsetX(value)");this.set_offsetX(n)},get_offsetY:function(){return this._offsetY},set_offsetY:function(n){this._offsetY!=n&&(this._offsetY=n,this.raisePropertyChanged("offsetY"))},get_OffsetY:function(){return Sys.Extended.Deprecated("get_OffsetY()","get_offsetY()"),this.get_offsetY()},set_OffsetY:function(n){Sys.Extended.Deprecated("set_OffsetY(value)","set_offsetY(value)");this.set_offsetY(n)},get_popupVisible:function(){return this._popupVisible},get_PopupVisible:function(){return Sys.Extended.Deprecated("get_PopupVisible()","get_popupVisible()"),this.get_popupVisible()},add_showing:function(n){this._popupBehavior&&this._popupBehavior.add_showing(n)},remove_showing:function(n){this._popupBehavior&&this._popupBehavior.remove_showing(n)},raise_showing:function(n){this._popupBehavior&&this._popupBehavior.raise_showing(n)},raiseShowing:function(n){Sys.Extended.Deprecated("raiseShowing(eventArgs)","raise_showing(eventArgs)");this.raise_showing(n)},add_shown:function(n){this._popupBehavior&&this._popupBehavior.add_shown(n)},remove_shown:function(n){this._popupBehavior&&this._popupBehavior.remove_shown(n)},raise_shown:function(n){this._popupBehavior&&this._popupBehavior.raise_shown(n)},raiseShown:function(n){Sys.Extended.Deprecated("raiseShown(eventArgs)","raise_shown(eventArgs)");this.raise_shown(n)},add_hiding:function(n){this._popupBehavior&&this._popupBehavior.add_hiding(n)},remove_hiding:function(n){this._popupBehavior&&this._popupBehavior.remove_hiding(n)},raise_hiding:function(){this._popupBehavior&&this._popupBehavior.raise_hiding(eventArgs)},raiseHiding:function(n){Sys.Extended.Deprecated("raiseHiding(eventArgs)","raise_hiding(eventArgs)");this.raise_hiding(n)},add_hidden:function(n){this._popupBehavior&&this._popupBehavior.add_hidden(n)},remove_hidden:function(n){this._popupBehavior&&this._popupBehavior.remove_hidden(n)},raise_hidden:function(n){this._popupBehavior&&this._popupBehavior.raise_hidden(n)},raiseHidden:function(n){Sys.Extended.Deprecated("raiseHidden(eventArgs)","raise_hidden(eventArgs)");this.raise_hidden(n)}};Sys.Extended.UI.PopupControlBehavior.registerClass("Sys.Extended.UI.PopupControlBehavior",Sys.Extended.UI.DynamicPopulateBehaviorBase);Sys.Extended.UI.PopupControlBehavior.__VisiblePopup=null;Sys.Extended.UI.PopupControlPopupPosition=function(){throw Error.invalidOperation();};Sys.Extended.UI.PopupControlPopupPosition.prototype={Center:0,Top:1,Left:2,Bottom:3,Right:4};Sys.Extended.UI.PopupControlPopupPosition.registerEnum("Sys.Extended.UI.PopupControlPopupPosition",!1);