﻿Type.registerNamespace("AjaxControlToolkit");AjaxControlToolkit.PopupBehavior=function(A){AjaxControlToolkit.PopupBehavior.initializeBase(this,[A]);this._x=0;this._y=0;this._positioningMode=AjaxControlToolkit.PositioningMode.Absolute;this._parentElement=null;this._parentElementID=null;this._moveHandler=null;this._firstPopup=true;this._originalParent=null;this._visible=false;this._onShow=null;this._onShowEndedHandler=null;this._onHide=null;this._onHideEndedHandler=null};AjaxControlToolkit.PopupBehavior.prototype={initialize:function(){AjaxControlToolkit.PopupBehavior.callBaseMethod(this,"initialize");this._hidePopup();this.get_element().style.position="absolute";this._onShowEndedHandler=Function.createDelegate(this,this._onShowEnded);this._onHideEndedHandler=Function.createDelegate(this,this._onHideEnded)},dispose:function(){var A=this.get_element();if(A){if(this._visible){this.hide()}if(this._originalParent){A.parentNode.removeChild(A);this._originalParent.appendChild(A);this._originalParent=null}A._hideWindowedElementsIFrame=null}this._parentElement=null;if(this._onShow&&this._onShow.get_animation()&&this._onShowEndedHandler){this._onShow.get_animation().remove_ended(this._onShowEndedHandler)}this._onShowEndedHandler=null;this._onShow=null;if(this._onHide&&this._onHide.get_animation()&&this._onHideEndedHandler){this._onHide.get_animation().remove_ended(this._onHideEndedHandler)}this._onHideEndedHandler=null;this._onHide=null;AjaxControlToolkit.PopupBehavior.callBaseMethod(this,"dispose")},show:function(){if(this._visible){return }var A=new Sys.CancelEventArgs();this.raiseShowing(A);if(A.get_cancel()){return }this._visible=true;var B=this.get_element();$common.setVisible(B,true);this.setupPopup();if(this._onShow){$common.setVisible(B,false);this.onShow()}else{this.raiseShown(Sys.EventArgs.Empty)}},hide:function(){if(!this._visible){return }var A=new Sys.CancelEventArgs();this.raiseHiding(A);if(A.get_cancel()){return }this._visible=false;if(this._onHide){this.onHide()}else{this._hidePopup();this._hideCleanup()}},getBounds:function(){var D=this.get_element();var F=D.offsetParent||document.documentElement;var G;var H;if(this._parentElement){H=$common.getBounds(this._parentElement);var C=$common.getLocation(F);G={x:H.x-C.x,y:H.y-C.y}}else{H=$common.getBounds(F);G={x:0,y:0}}var E=D.offsetWidth-(D.clientLeft?D.clientLeft*2:0);var B=D.offsetHeight-(D.clientTop?D.clientTop*2:0);var A;switch(this._positioningMode){case AjaxControlToolkit.PositioningMode.Center:A={x:Math.round(H.width/2-E/2),y:Math.round(H.height/2-B/2)};break;case AjaxControlToolkit.PositioningMode.BottomLeft:A={x:0,y:H.height};break;case AjaxControlToolkit.PositioningMode.BottomRight:A={x:H.width-E,y:H.height};break;case AjaxControlToolkit.PositioningMode.TopLeft:A={x:0,y:-D.offsetHeight};break;case AjaxControlToolkit.PositioningMode.TopRight:A={x:H.width-E,y:-D.offsetHeight};break;default:A={x:0,y:0}}A.x+=this._x+G.x;A.y+=this._y+G.y;return new Sys.UI.Bounds(A.x,A.y,E,B)},adjustPopupPosition:function(E){var C=this.get_element();if(!E){E=this.getBounds()}if(this._firstPopup){C.style.width=E.width+"px";this._firstPopup=false}var B=$common.getBounds(C);var D=false;var A=self.innerWidth?self.innerWidth:document.documentElement.clientWidth;if(!A){A=document.body.clientWidth}if(B.x+B.width>A-5){E.x-=B.x+B.width-A+5;D=true}if(B.x<0){E.x-=B.x;D=true}if(B.y<0){E.y-=B.y;D=true}if(D){$common.setLocation(C,E)}},addBackgroundIFrame:function(){var A=this.get_element();if((Sys.Browser.agent===Sys.Browser.InternetExplorer)&&(Sys.Browser.version<7)){var B=A._hideWindowedElementsIFrame;if(!B){B=document.createElement("iframe");B.src="javascript:'<html></html>';";B.style.position="absolute";B.style.display="none";B.scrolling="no";B.frameBorder="0";B.tabIndex="-1";B.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";A.parentNode.insertBefore(B,A);A._hideWindowedElementsIFrame=B;this._moveHandler=Function.createDelegate(this,this._onMove);Sys.UI.DomEvent.addHandler(A,"move",this._moveHandler)}$common.setBounds(B,$common.getBounds(A));B.style.display=A.style.display;if(A.currentStyle&&A.currentStyle.zIndex){B.style.zIndex=A.currentStyle.zIndex}else{if(A.style.zIndex){B.style.zIndex=A.style.zIndex}}}},setupPopup:function(){var A=this.get_element();var B=this.getBounds();$common.setLocation(A,B);this.adjustPopupPosition(B);A.zIndex=1000;this.addBackgroundIFrame()},_hidePopup:function(){var A=this.get_element();$common.setVisible(A,false);if(A.originalWidth){A.style.width=A.originalWidth+"px";A.originalWidth=null}},_hideCleanup:function(){var A=this.get_element();if(this._moveHandler){Sys.UI.DomEvent.removeHandler(A,"move",this._moveHandler);this._moveHandler=null}if(Sys.Browser.agent===Sys.Browser.InternetExplorer){var B=A._hideWindowedElementsIFrame;if(B){B.style.display="none"}}this.raiseHidden(Sys.EventArgs.Empty)},_onMove:function(){var A=this.get_element();if(A._hideWindowedElementsIFrame){A.parentNode.insertBefore(A._hideWindowedElementsIFrame,A);A._hideWindowedElementsIFrame.style.top=A.style.top;A._hideWindowedElementsIFrame.style.left=A.style.left}},get_onShow:function(){return this._onShow?this._onShow.get_json():null},set_onShow:function(B){if(!this._onShow){this._onShow=new AjaxControlToolkit.Animation.GenericAnimationBehavior(this.get_element());this._onShow.initialize()}this._onShow.set_json(B);var A=this._onShow.get_animation();if(A){A.add_ended(this._onShowEndedHandler)}this.raisePropertyChanged("onShow")},get_onShowBehavior:function(){return this._onShow},onShow:function(){if(this._onShow){if(this._onHide){this._onHide.quit()}this._onShow.play()}},_onShowEnded:function(){this.adjustPopupPosition();this.addBackgroundIFrame();this.raiseShown(Sys.EventArgs.Empty)},get_onHide:function(){return this._onHide?this._onHide.get_json():null},set_onHide:function(B){if(!this._onHide){this._onHide=new AjaxControlToolkit.Animation.GenericAnimationBehavior(this.get_element());this._onHide.initialize()}this._onHide.set_json(B);var A=this._onHide.get_animation();if(A){A.add_ended(this._onHideEndedHandler)}this.raisePropertyChanged("onHide")},get_onHideBehavior:function(){return this._onHide},onHide:function(){if(this._onHide){if(this._onShow){this._onShow.quit()}this._onHide.play()}},_onHideEnded:function(){this._hideCleanup()},get_parentElement:function(){if(!this._parentElement&&this._parentElementID){this.set_parentElement($get(this._parentElementID));Sys.Debug.assert(this._parentElement!=null,String.format(AjaxControlToolkit.Resources.PopupExtender_NoParentElement,this._parentElementID))}return this._parentElement},set_parentElement:function(A){this._parentElement=A;this.raisePropertyChanged("parentElement")},get_parentElementID:function(){if(this._parentElement){return this._parentElement.id}return this._parentElementID},set_parentElementID:function(A){this._parentElementID=A;if(this.get_isInitialized()){this.set_parentElement($get(A))}},get_positioningMode:function(){return this._positioningMode},set_positioningMode:function(A){this._positioningMode=A;this.raisePropertyChanged("positioningMode")},get_x:function(){return this._x},set_x:function(A){if(A!=this._x){this._x=A;if(this._visible){this.setupPopup()}this.raisePropertyChanged("x")}},get_y:function(){return this._y},set_y:function(A){if(A!=this._y){this._y=A;if(this._visible){this.setupPopup()}this.raisePropertyChanged("y")}},get_visible:function(){return this._visible},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.PopupBehavior.registerClass("AjaxControlToolkit.PopupBehavior",AjaxControlToolkit.BehaviorBase);AjaxControlToolkit.PositioningMode=function(){throw Error.invalidOperation()};AjaxControlToolkit.PositioningMode.prototype={Absolute:0,Center:1,BottomLeft:2,BottomRight:3,TopLeft:4,TopRight:5};AjaxControlToolkit.PositioningMode.registerEnum("AjaxControlToolkit.PositioningMode");
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();