﻿Type.registerNamespace("AjaxControlToolkit");AjaxControlToolkit.ModalPopupBehavior=function(A){AjaxControlToolkit.ModalPopupBehavior.initializeBase(this,[A]);this._PopupControlID=null;this._PopupDragHandleControlID=null;this._BackgroundCssClass=null;this._DropShadow=false;this._Drag=false;this._OkControlID=null;this._CancelControlID=null;this._OnOkScript=null;this._OnCancelScript=null;this._xCoordinate=-1;this._yCoordinate=-1;this._backgroundElement=null;this._foregroundElement=null;this._relativeOrAbsoluteParentElement=null;this._popupElement=null;this._dragHandleElement=null;this._showHandler=null;this._okHandler=null;this._cancelHandler=null;this._scrollHandler=null;this._resizeHandler=null;this._windowHandlersAttached=false;this._dropShadowBehavior=null;this._dragBehavior=null;this._isIE6=false;this._saveTabIndexes=new Array();this._saveDesableSelect=new Array();this._tagWithTabIndex=new Array("A","AREA","BUTTON","INPUT","OBJECT","SELECT","TEXTAREA","IFRAME")};AjaxControlToolkit.ModalPopupBehavior.prototype={initialize:function(){AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this,"initialize");this._isIE6=(Sys.Browser.agent==Sys.Browser.InternetExplorer&&Sys.Browser.version<7);if(this._PopupDragHandleControlID){this._dragHandleElement=$get(this._PopupDragHandleControlID)}this._popupElement=$get(this._PopupControlID);if(this._DropShadow){this._foregroundElement=document.createElement("div");this._popupElement.parentNode.appendChild(this._foregroundElement);this._foregroundElement.appendChild(this._popupElement)}else{this._foregroundElement=$get(this._PopupControlID)}this._backgroundElement=document.createElement("div");this._backgroundElement.style.display="none";this._backgroundElement.style.position="fixed";this._backgroundElement.style.left="0px";this._backgroundElement.style.top="0px";this._backgroundElement.style.zIndex=10000;if(this._BackgroundCssClass){this._backgroundElement.className=this._BackgroundCssClass}this._foregroundElement.parentNode.appendChild(this._backgroundElement);this._foregroundElement.style.display="none";this._foregroundElement.style.position="fixed";this._foregroundElement.style.zIndex=$common.getCurrentStyle(this._backgroundElement,"zIndex",this._backgroundElement.style.zIndex)+1;this._showHandler=Function.createDelegate(this,this._onShow);$addHandler(this.get_element(),"click",this._showHandler);if(this._OkControlID){this._okHandler=Function.createDelegate(this,this._onOk);$addHandler($get(this._OkControlID),"click",this._okHandler)}if(this._CancelControlID){this._cancelHandler=Function.createDelegate(this,this._onCancel);$addHandler($get(this._CancelControlID),"click",this._cancelHandler)}this._scrollHandler=Function.createDelegate(this,this._onLayout);this._resizeHandler=Function.createDelegate(this,this._onLayout);this.registerPartialUpdateEvents()},dispose:function(){this._detachPopup();if(this._DropShadow){this._foregroundElement.parentNode.appendChild(this._popupElement);this._foregroundElement.parentNode.removeChild(this._foregroundElement)}this._scrollHandler=null;this._resizeHandler=null;if(this._cancelHandler&&$get(this._CancelControlID)){$removeHandler($get(this._CancelControlID),"click",this._cancelHandler);this._cancelHandler=null}if(this._okHandler&&$get(this._OkControlID)){$removeHandler($get(this._OkControlID),"click",this._okHandler);this._okHandler=null}if(this._showHandler){$removeHandler(this.get_element(),"click",this._showHandler);this._showHandler=null}AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this,"dispose")},_attachPopup:function(){if(this._DropShadow&&!this._dropShadowBehavior){this._dropShadowBehavior=$create(AjaxControlToolkit.DropShadowBehavior,{},null,null,this._popupElement)}if(this._dragHandleElement&&!this._dragBehavior){this._dragBehavior=$create(AjaxControlToolkit.FloatingBehavior,{handle:this._dragHandleElement},null,null,this._foregroundElement)}$addHandler(window,"resize",this._resizeHandler);$addHandler(window,"scroll",this._scrollHandler);this._windowHandlersAttached=true},_detachPopup:function(){if(this._windowHandlersAttached){if(this._scrollHandler){$removeHandler(window,"scroll",this._scrollHandler)}if(this._resizeHandler){$removeHandler(window,"resize",this._resizeHandler)}this._windowHandlersAttached=false}if(this._dragBehavior){this._dragBehavior.dispose();this._dragBehavior=null}if(this._dropShadowBehavior){this._dropShadowBehavior.dispose();this._dropShadowBehavior=null}},_onShow:function(A){if(!this.get_element().disabled){this.show();A.preventDefault();return false}},_onOk:function(B){var A=$get(this._OkControlID);if(A&&!A.disabled){if(this.hide()&&this._OnOkScript){window.setTimeout(this._OnOkScript,0)}B.preventDefault();return false}},_onCancel:function(B){var A=$get(this._CancelControlID);if(A&&!A.disabled){if(this.hide()&&this._OnCancelScript){window.setTimeout(this._OnCancelScript,0)}B.preventDefault();return false}},_onLayout:function(){this._layout()},show:function(){var A=new Sys.CancelEventArgs();this.raiseShowing(A);if(A.get_cancel()){return }this.populate();this._attachPopup();this._backgroundElement.style.display="";this._foregroundElement.style.display="";this._popupElement.style.display="";if(this._isIE6){this._foregroundElement.style.position="absolute";this._backgroundElement.style.position="absolute";var B=this._foregroundElement.parentNode;while(B&&(B!=document.documentElement)){if((B.style.position!="relative")&&(B.style.position!="absolute")){B=B.parentNode}else{this._relativeOrAbsoluteParentElement=B;break}}}this.disableTab();this._layout();this._layout();this.raiseShown(Sys.EventArgs.Empty)},disableTab:function(){var C=0;var E;var F=new Array();Array.clear(this._saveTabIndexes);for(var B=0;B<this._tagWithTabIndex.length;B++){E=this._foregroundElement.getElementsByTagName(this._tagWithTabIndex[B]);for(var A=0;A<E.length;A++){F[C]=E[A];C++}}C=0;for(var B=0;B<this._tagWithTabIndex.length;B++){E=document.getElementsByTagName(this._tagWithTabIndex[B]);for(var A=0;A<E.length;A++){if(Array.indexOf(F,E[A])==-1){this._saveTabIndexes[C]={tag:E[A],index:E[A].tabIndex};E[A].tabIndex="-1";C++}}}C=0;if((Sys.Browser.agent===Sys.Browser.InternetExplorer)&&(Sys.Browser.version<7)){var D=new Array();for(var B=0;B<this._tagWithTabIndex.length;B++){E=this._foregroundElement.getElementsByTagName("SELECT");for(var A=0;A<E.length;A++){D[C]=E[A];C++}}C=0;Array.clear(this._saveDesableSelect);E=document.getElementsByTagName("SELECT");for(var A=0;A<E.length;A++){if(Array.indexOf(D,E[A])==-1){this._saveDesableSelect[C]={tag:E[A],visib:$common.getCurrentStyle(E[A],"visibility")};E[A].style.visibility="hidden";C++}}}},restoreTab:function(){for(var B=0;B<this._saveTabIndexes.length;B++){this._saveTabIndexes[B].tag.tabIndex=this._saveTabIndexes[B].index}if((Sys.Browser.agent===Sys.Browser.InternetExplorer)&&(Sys.Browser.version<7)){for(var A=0;A<this._saveDesableSelect.length;A++){this._saveDesableSelect[A].tag.style.visibility=this._saveDesableSelect[A].visib}}},hide:function(){var A=new Sys.CancelEventArgs();this.raiseHiding(A);if(A.get_cancel()){return false}this._backgroundElement.style.display="none";this._foregroundElement.style.display="none";this.restoreTab();this._detachPopup();this.raiseHidden(Sys.EventArgs.Empty);return true},_layout:function(){var C=(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);var B=(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);var G=$common.getClientBounds();var I=G.width;var F=G.height;this._layoutBackgroundElement();var A=0;var E=0;if(this._xCoordinate<0){var D=this._foregroundElement.offsetWidth?this._foregroundElement.offsetWidth:this._foregroundElement.scrollWidth;A=((I-D)/2);if(this._foregroundElement.style.position=="absolute"){A+=C}this._foregroundElement.style.left=A+"px"}else{if(this._isIE6){this._foregroundElement.style.left=(this._xCoordinate+C)+"px";A=this._xCoordinate+C}else{this._foregroundElement.style.left=this._xCoordinate+"px";A=this._xCoordinate}}if(this._yCoordinate<0){var H=this._foregroundElement.offsetHeight?this._foregroundElement.offsetHeight:this._foregroundElement.scrollHeight;E=((F-H)/2);if(this._foregroundElement.style.position=="absolute"){E+=B}this._foregroundElement.style.top=E+"px"}else{if(this._isIE6){this._foregroundElement.style.top=(this._yCoordinate+B)+"px";E=this._yCoordinate+B}else{this._foregroundElement.style.top=this._yCoordinate+"px";E=this._yCoordinate}}this._layoutForegroundElement(A,E);if(this._dropShadowBehavior){this._dropShadowBehavior.setShadow();window.setTimeout(Function.createDelegate(this,this._fixupDropShadowBehavior),0)}this._layoutBackgroundElement()},_layoutForegroundElement:function(F,E){if(this._isIE6&&this._relativeOrAbsoluteParentElement){var D=$common.getLocation(this._foregroundElement);var B=$common.getLocation(this._relativeOrAbsoluteParentElement);var C=D.x;if(C!=F){this._foregroundElement.style.left=(F-B.x)+"px"}var A=D.y;if(A!=E){this._foregroundElement.style.top=(E-B.y)+"px"}}},_layoutBackgroundElement:function(){if(this._isIE6){var B=$common.getLocation(this._backgroundElement);var F=B.x;if(F!=0){this._backgroundElement.style.left=(-F)+"px"}var D=B.y;if(D!=0){this._backgroundElement.style.top=(-D)+"px"}}var C=$common.getClientBounds();var E=C.width;var A=C.height;this._backgroundElement.style.width=Math.max(Math.max(document.documentElement.scrollWidth,document.body.scrollWidth),E)+"px";this._backgroundElement.style.height=Math.max(Math.max(document.documentElement.scrollHeight,document.body.scrollHeight),A)+"px"},_fixupDropShadowBehavior:function(){if(this._dropShadowBehavior){this._dropShadowBehavior.setShadow()}},_partialUpdateEndRequest:function(A,C){AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this,"_partialUpdateEndRequest",[A,C]);if(this.get_element()){var B=C.get_dataItems()[this.get_element().id];if("show"==B){this.show()}else{if("hide"==B){this.hide()}}}this._layout()},_onPopulated:function(B,A){AjaxControlToolkit.ModalPopupBehavior.callBaseMethod(this,"_onPopulated",[B,A]);this._layout()},get_PopupControlID:function(){return this._PopupControlID},set_PopupControlID:function(A){if(this._PopupControlID!=A){this._PopupControlID=A;this.raisePropertyChanged("PopupControlID")}},get_X:function(){return this._xCoordinate},set_X:function(A){if(this._xCoordinate!=A){this._xCoordinate=A;this.raisePropertyChanged("X")}},get_Y:function(){return this._yCoordinate},set_Y:function(A){if(this._yCoordinate!=A){this._yCoordinate=A;this.raisePropertyChanged("Y")}},get_PopupDragHandleControlID:function(){return this._PopupDragHandleControlID},set_PopupDragHandleControlID:function(A){if(this._PopupDragHandleControlID!=A){this._PopupDragHandleControlID=A;this.raisePropertyChanged("PopupDragHandleControlID")}},get_BackgroundCssClass:function(){return this._BackgroundCssClass},set_BackgroundCssClass:function(A){if(this._BackgroundCssClass!=A){this._BackgroundCssClass=A;this.raisePropertyChanged("BackgroundCssClass")}},get_DropShadow:function(){return this._DropShadow},set_DropShadow:function(A){if(this._DropShadow!=A){this._DropShadow=A;this.raisePropertyChanged("DropShadow")}},get_Drag:function(){return this._Drag},set_Drag:function(A){if(this._Drag!=A){this._Drag=A;this.raisePropertyChanged("Drag")}},get_OkControlID:function(){return this._OkControlID},set_OkControlID:function(A){if(this._OkControlID!=A){this._OkControlID=A;this.raisePropertyChanged("OkControlID")}},get_CancelControlID:function(){return this._CancelControlID},set_CancelControlID:function(A){if(this._CancelControlID!=A){this._CancelControlID=A;this.raisePropertyChanged("CancelControlID")}},get_OnOkScript:function(){return this._OnOkScript},set_OnOkScript:function(A){if(this._OnOkScript!=A){this._OnOkScript=A;this.raisePropertyChanged("OnOkScript")}},get_OnCancelScript:function(){return this._OnCancelScript},set_OnCancelScript:function(A){if(this._OnCancelScript!=A){this._OnCancelScript=A;this.raisePropertyChanged("OnCancelScript")}},add_showing:function(A){this.get_events().addHandler("showing",A)},remove_showing:function(A){this.get_events().removeHandler("showing",A)},raiseShowing:function(A){var B=this.get_events().getHandler("showing");if(B){B(this,A)}},add_shown:function(A){this.get_events().addHandler("shown",A)},remove_shown:function(A){this.get_events().removeHandler("shown",A)},raiseShown:function(A){var B=this.get_events().getHandler("shown");if(B){B(this,A)}},add_hiding:function(A){this.get_events().addHandler("hiding",A)},remove_hiding:function(A){this.get_events().removeHandler("hiding",A)},raiseHiding:function(A){var B=this.get_events().getHandler("hiding");if(B){B(this,A)}},add_hidden:function(A){this.get_events().addHandler("hidden",A)},remove_hidden:function(A){this.get_events().removeHandler("hidden",A)},raiseHidden:function(A){var B=this.get_events().getHandler("hidden");if(B){B(this,A)}}};AjaxControlToolkit.ModalPopupBehavior.registerClass("AjaxControlToolkit.ModalPopupBehavior",AjaxControlToolkit.DynamicPopulateBehaviorBase);AjaxControlToolkit.ModalPopupBehavior.invokeViaServer=function(B,A){var C=$find(B);if(C){if(A){C.show()}else{C.hide()}}};
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();