Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.BalloonPopupControlBehavior=function(n){Sys.Extended.UI.BalloonPopupControlBehavior.initializeBase(this,[n]);this._balloonPopupControlID=null;this._position=Sys.Extended.UI.BalloonPopupPosition.Auto;this._balloonStyle=Sys.Extended.UI.BalloonPopupStyle.Rectangle;this._offsetX=0;this._offsetY=0;this._extenderControlID=null;this._displayOnMouseOver=!1;this._displayOnFocus=!1;this._displayOnClick=!0;this._balloonSize="small";this._shadow=!0;this._scrollBars=Sys.Extended.UI.ScrollBars.Auto;this._popupElement=null;this._styleElement=null;this._sizeElement=null;this._shadowElement=null;this._directionElement=null;this._contentElement=null;this._popupBehavior=null;this._popupVisible=!1;this._focusHandler=null;this._mouseOverHandler=null;this._clickHandler=null;this._popupClickHandler=null;this._bodyClickHandler=null;this._onShowJson=null;this._onHideJson=null;this._popupWidth=0;this._popupHeight=0;this._AutoPosition=null;this._directionClassName=null};Sys.Extended.UI.BalloonPopupControlBehavior.prototype={initialize:function(){Sys.Extended.UI.BalloonPopupControlBehavior.callBaseMethod(this,"initialize");var n=this.get_element();this.createPopupElement();this._popupBehavior=$create(Sys.Extended.UI.PopupBehavior,{id:this.get_id()+"BalloonPopupBehavior",parentElement:n},null,null,this._popupElement);this._onShowJson&&this._popupBehavior.set_onShow(this._onShowJson);this._onHideJson&&this._popupBehavior.set_onHide(this._onHideJson);this._displayOnFocus&&(this._focusHandler=Function.createDelegate(this,this._onFocus));this._displayOnMouseOver&&(this._mouseOverHandler=Function.createDelegate(this,this._onMouseOver));this._displayOnClick&&(this._clickHandler=Function.createDelegate(this,this._onFocus));this._popupClickHandler=Function.createDelegate(this,this._onPopupClick);this._bodyClickHandler=Function.createDelegate(this,this._onBodyClick);this._displayOnFocus&&$addHandler(n,"focus",this._focusHandler);this._displayOnMouseOver&&$addHandler(n,"mouseover",this._mouseOverHandler);this._displayOnClick&&$addHandler(n,"click",this._clickHandler);$addHandler(document,"click",this._bodyClickHandler);$addHandler(this._popupElement,"click",this._popupClickHandler)},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),this._focusHandler=null);this._mouseOverHandler&&($removeHandler(n,"mouseover",this._mouseOverHandler),this._mouseOverHandler=null);this._clickHandler&&($removeHandler(n,"click",this._clickHandler),this._clickHandler=null);this._bodyClickHandler&&($removeHandler(document,"click",this._bodyClickHandler),this._bodyClickHandler=null);this._popupClickHandler&&($removeHandler(this._popupElement,"click",this._popupClickHandler),this._popupClickHandler=null);Sys.Extended.UI.BalloonPopupControlBehavior.callBaseMethod(this,"dispose")},createPopupElement:function(){var n=this.get_element();if(this._popupElement=$common.createElementFromTemplate({nodeName:"div",properties:{id:this.get_id()+"_balloonPopup",style:{display:"block",position:"absolute"}},cssClasses:["ajax__balloon_popup"]},n.parentNode),this._styleElement=$common.createElementFromTemplate({nodeName:"span",Properties:{id:"ajax__style_wrapper"}},this._popupElement),this._sizeElement=$common.createElementFromTemplate({nodeName:"span",Properties:{id:"ajax__size_wrapper"}},this._styleElement),this._shadowElement=$common.createElementFromTemplate({nodeName:"div",Properties:{id:"ajax__shadow_wrapper"}},this._sizeElement),this._directionElement=$common.createElementFromTemplate({nodeName:"div",Properties:{id:"ajax__direction_wrapper"}},this._shadowElement),this._contentElement=$common.createElementFromTemplate({nodeName:"div",Properties:{id:"ajax__content"},cssClasses:["ajax__content"]},this._directionElement),$get(this._balloonPopupControlID)==null)throw"Referred BalloonPopupControlId did not find.";$get(this._balloonPopupControlID).style.display="none";this.setStyle();this.setSize();this._directionElement.className=this._directionClassName;this._popupWidth=this._directionElement.offsetWidth;this._popupHeight=this._directionElement.offsetHeight;this.get_balloonPopupPosition()!=Sys.Extended.UI.BalloonPopupPosition.Auto&&(this.setPosition(),this.setContentPadding(),this.setScrollBar())},setStyle:function(){switch(this.get_balloonPopupStyle()){case Sys.Extended.UI.BalloonPopupStyle.Rectangle:this._styleElement.className="rect";this._directionClassName="rect";break;case Sys.Extended.UI.BalloonPopupStyle.Cloud:this._styleElement.className="cloud";this._directionClassName="cloud";break;case Sys.Extended.UI.BalloonPopupStyle.Custom:this._styleElement.className=this.get_customClassName();this._directionClassName=this.get_customClassName();break;default:this._styleElement.className="rect";this._directionClassName="rect"}},setSize:function(){switch(this.get_balloonSize()){case Sys.Extended.UI.BalloonPopupSize.Small:this._sizeElement.className+=" small";this._directionClassName+=" small";break;case Sys.Extended.UI.BalloonPopupSize.Medium:this._sizeElement.className+=" medium";this._directionClassName+=" medium";break;case Sys.Extended.UI.BalloonPopupSize.Large:this._sizeElement.className+=" large";this._directionClassName+=" large";break;default:this._sizeElement.className+=" small";this._directionClassName+=" small"}},setPosition:function(){var n=this.get_balloonPopupPosition()==Sys.Extended.UI.BalloonPopupPosition.Auto?this._autoPosition:this.get_balloonPopupPosition();switch(n){case Sys.Extended.UI.BalloonPopupPosition.TopLeft:this._directionElement.className=this._directionClassName+" top_left";this._shadowElement.className=this._directionClassName+" top_left_shadow";break;case Sys.Extended.UI.BalloonPopupPosition.TopRight:this._directionElement.className=this._directionClassName+" top_right";this._shadowElement.className=this._directionClassName+" top_right_shadow";break;case Sys.Extended.UI.BalloonPopupPosition.BottomLeft:this._directionElement.className=this._directionClassName+" bottom_left";this._shadowElement.className=this._directionClassName+" bottom_left_shadow";break;case Sys.Extended.UI.BalloonPopupPosition.BottomRight:this._directionElement.className=this._directionClassName+" bottom_right";this._shadowElement.className=this._directionClassName+" bottom_right_shadow";break;default:this._directionElement.className=this._directionClassName+" top_right";this._shadowElement.className=this._directionClassName+" top_right_shadow"}},setContentPadding:function(){var n=$common.getPaddingBox(this._contentElement),t=$get(this._balloonPopupControlID);$common.setBounds(t,{x:this._offsetX+n.left,y:this._offsetY+n.top,width:this._popupWidth-n.left-n.right,height:this._popupHeight-n.top-n.bottom})},setScrollBar:function(){var n=$get(this._balloonPopupControlID);switch(this.get_scrollBars()){case Sys.Extended.UI.ScrollBars.Horizontal:$common.setStyle(n,{overflowX:"scroll",overflowY:"hidden"});break;case Sys.Extended.UI.ScrollBars.Vertical:$common.setStyle(n,{overflowY:"scroll",overflowX:"hidden"});break;case Sys.Extended.UI.ScrollBars.Both:$common.setStyle(n,{overflow:"scroll"});break;case Sys.Extended.UI.ScrollBars.None:$common.setStyle(n,{overflow:"hidden"});break;default:$common.setStyle(n,{overflow:"auto"})}},showPopup:function(){var n,t,i;this._contentElement.appendChild($get(this._balloonPopupControlID));$get(this._balloonPopupControlID).style.display="block";Sys.Extended.UI.BalloonPopupPosition.Auto==this._position&&(this._setAutoPosition(),this.setPosition(),this.setContentPadding(),this.setScrollBar());this._shadow||(this._shadowElement.className="");n=Sys.Extended.UI.BalloonPopupControlBehavior.__VisiblePopup;n&&n._popupBehavior&&n.hidePopup();Sys.Extended.UI.BalloonPopupControlBehavior.callBaseMethod(this,"populate");this._popupBehavior.set_x(this._getLeftOffset());this._popupBehavior.set_y(this._getTopOffset());this._popupBehavior.show();this._popupVisible=!0;Sys.Extended.UI.BalloonPopupControlBehavior.__VisiblePopup=this;t=$common.getCurrentStyle(this._directionElement,"backgroundPositionX");i=$common.getCurrentStyle(this._directionElement,"backgroundPositionY");$common.setStyle(this._styleElement,{backgroundPositionX:t,backgroundPositionY:i})},hidePopup:function(){this._popupBehavior.hide();this._popupVisible=!1;Sys.Extended.UI.BalloonPopupControlBehavior.__VisiblePopup=null},_onFocus:function(n){this._popupVisible||this.showPopup();n&&n.stopPropagation()},_onMouseOver:function(n){this._popupVisible||this.showPopup();n&&n.stopPropagation()},_onPopupClick:function(n){n.stopPropagation()},_onBodyClick:function(){this._popupVisible&&this.hidePopup()},_onPopulated:function(n,t){Sys.Extended.UI.BalloonPopupControlBehavior.callBaseMethod(this,"_onPopulated",[n,t]);this._popupVisible&&this._popupBehavior.show()},_getLeftOffset:function(){var n=Sys.Extended.UI.BalloonPopupPosition.Auto==this._position?this._autoPosition:this._position;return Sys.Extended.UI.BalloonPopupPosition.BottomLeft==n||Sys.Extended.UI.BalloonPopupPosition.TopLeft==n?-1*this._popupWidth+this._offsetX:Sys.Extended.UI.BalloonPopupPosition.BottomRight==n||Sys.Extended.UI.BalloonPopupPosition.TopRight==n?this.get_element().offsetWidth+this._offsetX:this._offsetX},_getTopOffset:function(){var n=Sys.Extended.UI.BalloonPopupPosition.Auto==this._position?this._autoPosition:this._position;return Sys.Extended.UI.BalloonPopupPosition.TopLeft==n||Sys.Extended.UI.BalloonPopupPosition.TopRight==n?-1*this._popupHeight+this._offsetY:Sys.Extended.UI.BalloonPopupPosition.BottomLeft==n||Sys.Extended.UI.BalloonPopupPosition.BottomRight==n?this.get_element().offsetHeight+this._offsetY:this._offsetY},_setAutoPosition:function(){var t=0,i=0,n=this.get_element();if(n.offsetParent)do i+=n.offsetLeft,t+=n.offsetTop;while(n=n.offsetParent);var r=this.posTop(),o=this.posLeft(),s=this.pageWidth(),h=this.pageHeight(),c=r+h,u=o+s,f=t-this._popupHeight,a=i-this._popupWidth,l=t+this.get_element().offsetHeight+this._popupHeight,e=i+this.get_element().offsetWidth+this._popupWidth;this._autoPosition=f-r>0&&f-r>c-l?u