// (c) 2010 CodePlex Foundation Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.ModalPopupRepositionMode=function(){throw Error.invalidOperation();};Sys.Extended.UI.ModalPopupRepositionMode.prototype={None:0,RepositionOnWindowResize:1,RepositionOnWindowScroll:2,RepositionOnWindowResizeAndScroll:3};Sys.Extended.UI.ModalPopupRepositionMode.registerEnum("Sys.Extended.UI.ModalPopupRepositionMode");Sys.Extended.UI.ModalPopupBehavior=function(d){var c=false,b=null,a=this;Sys.Extended.UI.ModalPopupBehavior.initializeBase(a,[d]);a._PopupControlID=b;a._PopupDragHandleControlID=b;a._BackgroundCssClass=b;a._DropShadow=c;a._Drag=c;a._OkControlID=b;a._CancelControlID=b;a._OnOkScript=b;a._OnCancelScript=b;a._xCoordinate=-1;a._yCoordinate=-1;a._repositionMode=Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll;a._onShown=new Sys.Extended.UI.Animation.GenericAnimationBehavior(d);a._onHidden=new Sys.Extended.UI.Animation.GenericAnimationBehavior(d);a._onShowing=new Sys.Extended.UI.Animation.GenericAnimationBehavior(d);a._onHiding=new Sys.Extended.UI.Animation.GenericAnimationBehavior(d);a._backgroundElement=b;a._foregroundElement=b;a._relativeOrAbsoluteParentElement=b;a._popupElement=b;a._dragHandleElement=b;a._showHandler=b;a._okHandler=b;a._cancelHandler=b;a._scrollHandler=b;a._resizeHandler=b;a._windowHandlersAttached=c;a._dropShadowBehavior=b;a._dragBehavior=b;a._isIE6=c;a._saveTabIndexes=[];a._saveDesableSelect=[];a._tagWithTabIndex=["A","AREA","BUTTON","INPUT","OBJECT","SELECT","TEXTAREA","IFRAME"];a._isAnimationJustEnded=c;a._hidingAnimationEndedHandler=b;a._showingAnimationEndedHandler=b};Sys.Extended.UI.ModalPopupBehavior.prototype={initialize:function(){var b="click",a=this;Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(a,"initialize");a._isIE6=Sys.Browser.agent==Sys.Browser.InternetExplorer&&Sys.Browser.version<7;if(a._PopupDragHandleControlID)a._dragHandleElement=$get(a._PopupDragHandleControlID);a._popupElement=$get(a._PopupControlID);if(a._DropShadow){a._foregroundElement=document.createElement("div");a._foregroundElement.id=a.get_id()+"_foregroundElement";a._popupElement.parentNode.appendChild(a._foregroundElement);a._foregroundElement.appendChild(a._popupElement)}else a._foregroundElement=a._popupElement;a._backgroundElement=document.createElement("div");a._backgroundElement.id=a.get_id()+"_backgroundElement";a._backgroundElement.style.display="none";a._backgroundElement.style.position="fixed";a._backgroundElement.style.left="0px";a._backgroundElement.style.top="0px";a._backgroundElement.style.zIndex=1e4;if(a._BackgroundCssClass)a._backgroundElement.className=a._BackgroundCssClass;a._foregroundElement.parentNode.appendChild(a._backgroundElement);a._foregroundElement.style.display="none";a._foregroundElement.style.position="fixed";a._foregroundElement.style.zIndex=$common.getCurrentStyle(a._backgroundElement,"zIndex",a._backgroundElement.style.zIndex)+1;a._showHandler=Function.createDelegate(a,a._onShow);$addHandler(a.get_element(),b,a._showHandler);if(a._OkControlID){a._okHandler=Function.createDelegate(a,a._onOk);$addHandler($get(a._OkControlID),b,a._okHandler)}if(a._CancelControlID){a._cancelHandler=Function.createDelegate(a,a._onCancel);$addHandler($get(a._CancelControlID),b,a._cancelHandler)}a._scrollHandler=Function.createDelegate(a,a._onLayout);a._resizeHandler=Function.createDelegate(a,a._onLayout);a.registerPartialUpdateEvents();a._resetAnimationsTarget();if(a._onHiding.get_animation()){a._hidingAnimationEndedHandler=Function.createDelegate(a,function(){this._isAnimationJustEnded=true;this.hide()});a._onHiding.get_animation().add_ended(a._hidingAnimationEndedHandler)}if(a._onShowing.get_animation()){a._showingAnimationEndedHandler=Function.createDelegate(a,function(){this._isAnimationJustEnded=true;this.show()});a._onShowing.get_animation().add_ended(a._showingAnimationEndedHandler)}},dispose:function(){var c="click",b=null,a=this;a._hideImplementation();if(a._foregroundElement&&a._foregroundElement.parentNode){a._foregroundElement.parentNode.removeChild(a._backgroundElement);if(a._DropShadow){a._foregroundElement.parentNode.appendChild(a._popupElement);a._foregroundElement.parentNode.removeChild(a._foregroundElement)}}a._scrollHandler=b;a._resizeHandler=b;if(a._cancelHandler&&$get(a._CancelControlID)){$removeHandler($get(a._CancelControlID),c,a._cancelHandler);a._cancelHandler=b}if(a._okHandler&&$get(a._OkControlID)){$removeHandler($get(a._OkControlID),c,a._okHandler);a._okHandler=b}if(a._showHandler){$removeHandler(a.get_element(),c,a._showHandler);a._showHandler=b}a._hidingAnimationEndedHandler&&a._onHiding.get_animation().remove_ended(a._hidingAnimationEndedHandler);a._showingAnimationEndedHandler&&a._onShowing.get_animation().remove_ended(a._showingAnimationEndedHandler);Sys.Extended.UI.ModalPopupBehavior.callBaseMethod(a,"dispose")},_attachPopup:function(){var b=null,a=this;if(a._DropShadow&&!a._dropShadowBehavior)a._dropShadowBehavior=$create(Sys.Extended.UI.DropShadowBehavior,{},b,b,a._popupElement);if(a._dragHandleElement&&!a._dragBehavior)a._dragBehavior=$create(Sys.Extended.UI.FloatingBehavior,{handle:a._dragHandleElement},b,b,a._foregroundElement);$addHandler(window,"resize",a._resizeHandler);$addHandler(window,"scroll",a._scrollHandler);a._windowHandlersAttached=true},_detachPopup:function(){var a=this;if(a._windowHandlersAttached){a._scrollHandler&&$removeHandler(window,"scroll",a._scrollHandler);a._resizeHandler&&$removeHandler(window,"resize",a._resizeHandler);a._windowHandlersAttached=false}if(a._dragBehavior){a._dragBehavior.dispose();a._dragBehavior=null}if(a._dropShadowBehavior){a._dropShadowBehavior.dispose();a._dropShadowBehavior=null}},_onShow:function(a){if(!this.get_element().disabled){this.show();a.preventDefault();return false}},_onOk:function(c){var a=this,b=$get(a._OkControlID);if(b&&!b.disabled){a.hide()&&a._OnOkScript&&window.setTimeout(a._OnOkScript,0);c.preventDefault();return false}},_onCancel:function(c){var a=this,b=$get(a._CancelControlID);if(b&&!b.disabled){a.hide()&&a._OnCancelScript&&window.setTimeout(a._OnCancelScript,0);c.preventDefault();return false}},_onLayout:function(c){var b=this,a=b.get_repositionMode();if((a===Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowScroll||a===Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)&&c.type==="scroll")b._layout();else if((a===Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResize||a===Sys.Extended.UI.ModalPopupRepositionMode.RepositionOnWindowResizeAndScroll)&&c.type==="resize")b._layout();else b._layoutBackgroundElement()},show:function(){var c="absolute",a=this;if(!a._isAnimationJustEnded){var d=new Sys.CancelEventArgs;a.raiseShowing(d);if(d.get_cancel())return;else if(a._onShowing.get_animation()){a._onShowing.play();return}}else a._isAnimationJustEnded=false;a.populate();a._attachPopup();a._backgroundElement.style.display="";a._foregroundElement.style.display="";a._popupElement.style.display="";if(a._isIE6){a._foregroundElement.style.position=c;a._backgroundElement.style.position=c;var b=a._foregroundElement.parentNode;while(b&&b!=document.documentElement)if(b.style.position!="relative"&&b.style.position!=c)b=b.parentNode;else{a._relativeOrAbsoluteParentElement=b;break}}a.disableTab();a._layout();a._layout();a.raiseShown(Sys.EventArgs.Empty);a._onShown.play()},disableTab:function(){var c=this,d=0,a,f=[];Array.clear(c._saveTabIndexes);for(var e=0;e