|
|
|
|
Type.registerNamespace("AjaxControlToolkit");AjaxControlToolkit.PopupBehavior=function(c){var b=null,a=this;AjaxControlToolkit.PopupBehavior.initializeBase(a,[c]);a._x=0;a._y=0;a._positioningMode=AjaxControlToolkit.PositioningMode.Absolute;a._parentElement=b;a._parentElementID=b;a._moveHandler=b;a._firstPopup=true;a._originalParent=b;a._visible=false;a._onParentRepositionHandler=b;a._elementsWithAttachedRepositionHandlers=b;a._onShow=b;a._onShowEndedHandler=b;a._onHide=b;a._onHideEndedHandler=b};AjaxControlToolkit.PopupBehavior.prototype={initialize:function(){var a=this;AjaxControlToolkit.PopupBehavior.callBaseMethod(a,"initialize");a._hidePopup();a._prepareElement();a._onShowEndedHandler=Function.createDelegate(a,a._onShowEnded);a._onHideEndedHandler=Function.createDelegate(a,a._onHideEnded)},dispose:function(){var b=null,a=this,c=a.get_element();if(c){a._visible&&a.hide();if(a._originalParent){c.parentNode.removeChild(c);a._originalParent.appendChild(c);a._originalParent=b}c._hideWindowedElementsIFrame=b}a._parentElement=b;a._onShow&&a._onShow.get_animation()&&a._onShowEndedHandler&&a._onShow.get_animation().remove_ended(a._onShowEndedHandler);a._onShowEndedHandler=b;a._onShow=b;a._onHide&&a._onHide.get_animation()&&a._onHideEndedHandler&&a._onHide.get_animation().remove_ended(a._onHideEndedHandler);a._onHideEndedHandler=b;a._onHide=b;a._onParentRepositionHandler!=b&&$removeHandler(window,"resize",a._onParentRepositionHandler);if(a._elementsWithAttachedRepositionHandlers!=b){for(var d=0;d<a._elementsWithAttachedRepositionHandlers.length;d++){$removeHandler(a._elementsWithAttachedRepositionHandlers[d],"resize",a._onParentRepositionHandler);$removeHandler(a._elementsWithAttachedRepositionHandlers[d],"scroll",a._onParentRepositionHandler)}a._elementsWithAttachedRepositionHandlers=b}a._onParentRepositionHandler=b;AjaxControlToolkit.PopupBehavior.callBaseMethod(a,"dispose")},_prepareElement:function(){var a=this,c=a.get_element();a._onParentRepositionHandler=Function.createDelegate(a,a._reposition);a._elementsWithAttachedRepositionHandlers=[];var b=c.parentNode;while(b){if(b==document.body)break;$addHandler(b,"scroll",a._onParentRepositionHandler);$addHandler(b,"resize",a._onParentRepositionHandler);a._elementsWithAttachedRepositionHandlers.push(b);b=b.parentNode}$addHandler(window,"resize",a._onParentRepositionHandler);c.style.position="absolute";$common.appendElementToFormOrBody(c)},_reposition:function(){if(!this._visible)return;this.setupPopup()},show:function(){var a=this;if(a._visible)return;var b=new Sys.CancelEventArgs;a.raiseShowing(b);if(b.get_cancel())return;a._visible=true;var c=a.get_element();$common.setVisible(c,true);a.setupPopup();if(a._onShow){$common.setVisible(c,false);a.onShow()}else a.raiseShown(Sys.EventArgs.Empty)},hide:function(){var a=this;if(!a._visible)return;var b=new Sys.CancelEventArgs;a.raiseHiding(b);if(b.get_cancel())return;a._visible=false;if(a._onHide)a.onHide();else{a._hidePopup();a._hideCleanup()}},getBounds:function(){var d=this,c=d.get_element(),j=c.offsetParent||document.documentElement,g,a;if(d._parentElement){a=$common.getBounds(d._parentElement);var i=$common.getLocation(j);g={x:a.x-i.x,y:a.y-i.y}}else{a=$common.getBounds(j);g={x:0,y:0}}var e=c.offsetWidth-(c.clientLeft?c.clientLeft*2:0),f=c.offsetHeight-(c.clientTop?c.clientTop*2:0);if(d._firstpopup){c.style.width=e+"px";d._firstpopup=false}var h,b;switch(d._positioningMode){case AjaxControlToolkit.PositioningMode.Center:b={x:Math.round(a.width/2-e/2),y:Math.round(a.height/2-f/2),altX:Math.round(a.width/2-e/2),altY:Math.round(a.height/2-f/2)};break;case AjaxControlToolkit.PositioningMode.BottomLeft:b={x:0,y:a.height,altX:a.width-e,altY:0-f};break;case AjaxControlToolkit.PositioningMode.BottomRight:b={x:a.width-e,y:a.height,altX:0,altY:0-f};break;case AjaxControlToolkit.PositioningMode.TopLeft:b={x:0,y:-c.offsetHeight,altX:a.width-e,altY:a.height};break;case AjaxControlToolkit.PositioningMode.TopRight:b={x:a.width-e,y:-c.offsetHeight,altX:0,altY:a.height};break;case AjaxControlToolkit.PositioningMode.Right:b={x:a.width,y:0,al
|