Type.registerNamespace("Telerik.Web.UI");
(function($,$T){$telerik.toNotification=function(Notification){return Notification;
};
$telerik.findNotification=$find;
$.registerEnum($T,"NotificationLoad",{PageLoad:0,FirstShow:1,EveryShow:2,TimeInterval:3});
$.registerEnum($T,"NotificationPosition",{TopLeft:11,TopCenter:12,TopRight:13,MiddleLeft:21,Center:22,MiddleRight:23,BottomLeft:31,BottomCenter:32,BottomRight:33});
$.registerEnum($T,"NotificationHorizontalPosition",{Left:1,Center:2,Right:3});
$.registerEnum($T,"NotificationVerticalPosition",{Top:1,Middle:2,Bottom:3});
$.registerEnum($T,"NotificationScrolling",{Auto:0,None:1,X:2,Y:3,Both:4,Default:5});
$.registerEnum($T,"NotificationAnimation",{None:0,Resize:1,Fade:2,Slide:4,FlyIn:8});
$T.RadNotification=function(element){$T.RadNotification.initializeBase(this,[element]);
this._popupElement=$get(this.get_id()+"_popup");
this._titlebar=$get(this.get_id()+"_titlebar");
this._menuIcon=$get(this.get_id()+"_rnMenuIcon");
this._closeIcon=$get(this.get_id()+"_rnCloseIcon");
this._xmlPanel=$find(this.get_id()+"_XmlPanel");
this._titleMenu=$find(this.get_id()+"_TitleMenu");
this._position=$T.NotificationPosition.BottomRight;
this._visibleTitlebar=true;
this._width="";
this._height="";
this._updateInterval=0;
this._showInterval=0;
this._loadContentOn=$T.NotificationLoad.PageLoad;
this._keepOnMouseOver=true;
this._enabled=true;
this._text="";
this._title="";
this._firstShow=true;
this._autoCloseRef=null;
this._horizontalPosition=$T.NotificationHorizontalPosition.Right;
this._verticalPosition=$T.NotificationVerticalPosition.Bottom;
this._cancelAutoClose=false;
this._popupTouchScroll=null;
};
$T.RadNotification.prototype={initialize:function(){$T.RadNotification.callBaseMethod(this,"initialize");
var declarativeIndex=this.get_element().style.zIndex||$telerik.getCurrentStyle(this.get_element(),"zIndex");
if(!parseInt(declarativeIndex)){declarativeIndex=10000;
}this.set_zIndex(declarativeIndex);
this._addToDocument();
this._attachXmlPanelHandlers();
this._registerPopupHandlers(true);
if(this.get_enableAriaSupport()){this._applyAriaSupport();
}if(this.get_visibleOnPageLoad()){setTimeout(Function.createDelegate(this,function(){this.show();
}),0);
}},dispose:function(){this._stopTimer("_updateTimer");
this._stopTimer("_showTimer");
this.cancelAutoCloseDelay();
this._registerPopupHandlers(false);
this._createTouchScrollExtender(false);
var popup=this.get_popupElement();
if(Sys&&Sys.WebForms){var prm=Sys.WebForms.PageRequestManager.getInstance();
if(prm&&prm.get_isInAsyncPostBack()){$telerik.disposeElement(popup);
}}if(popup&&popup.parentNode){popup.parentNode.removeChild(popup);
}$T.RadNotification.callBaseMethod(this,"dispose");
},_attachXmlPanelHandlers:function(){var xmlPanel=this._xmlPanel;
xmlPanel.add_responseEnding(Function.createDelegate(this,this._onResponseEnding));
xmlPanel.add_responseEnded(Function.createDelegate(this,this._onResponseEnded));
xmlPanel.add_responseError(Function.createDelegate(this,this._onResponseError));
},_registerPopupHandlers:function(attachEvent){this._registerMouseKeepHandlers(attachEvent);
this._registerTitlebarHandlers(attachEvent);
this._registerWindowResizeHandler(attachEvent);
},_registerMouseKeepHandlers:function(attachEvent){var popup=this.get_popupElement();
if(true==attachEvent&&this.get_keepOnMouseOver()){this._mouseEnterHandler=Function.createDelegate(this,this._onMouseEnter);
$addHandler(popup,"mouseover",this._mouseEnterHandler);
this._mouseLeaveHandler=Function.createDelegate(this,this._onMouseLeave);
$addHandler(popup,"mouseout",this._mouseLeaveHandler);
}else{if(this._mouseEnterHandler||this._mouseLeaveHandler){$clearHandlers(popup);
this._mouseEnterHandler=null;
this._mouseLeaveHandler=null;
}}},_registerTitlebarHandlers:function(attachEvent){if(true==attachEvent){if(this.get_showTitleMenu()&&this._menuIcon){this._showMenuHandler=Function.createDelegate(this,this._onMenuIconClick);
$addHandler(this._menuIcon,"click",this._showMenuHandler);
}if(this.get_showCloseButton()&&this._closeIcon){this._closeHandler=Function.createDelegate(this,this._close);
$addHandler(this._closeIcon,"click",this._closeHandler);
}}else{if(this._showMenuHandler&&this._menuIcon){$removeHandler(this._menuIcon,"click",this._showMenuHandler);
}if(this._closeHandler&&this._closeIcon){$removeHandler(this._closeIcon,"click",this._closeHandler);
}}},_registerWindowResizeHandler:function(attachEvent){if(attachEvent){this._onWindowResizeDelegate=Function.createDelegate(this,this._repositionOnResize);
$addHandler(window,"resize",this._onWindowResizeDelegate);
}else{if(this._onWindowResizeDelegate){$removeHandler(window,"resize",this._onWindowResizeDelegate);
this._onWindowResizeDelegate=null;
}}},_repositionOnResize:function(){if(this.isVisible()){this._show();
if($telerik.isIE9){this._show();
}}},_close:function(e){this._hide(true);
return $telerik.cancelRawEvent(e);
},_onMenuIconClick:function(e){if(this.get_titleMenu()){this.get_titleMenu().show(e);
}return $telerik.cancelRawEvent(e);
},_onMouseEnter:function(e){var toKeep=$telerik.isMouseOverElementEx(this.get_popupElement(),e);
if(toKeep){this._cancelAutoClose=true;
this.cancelAutoCloseDelay();
var popup=this.get_popupElement();
if(this.get_animation()!=$T.NotificationAnimation.None){$telerik.$(popup).stop(true,true);
}this._stopTimer("_showTimer");
popup.style.position=this.get_pinned()?"fixed":"absolute";
$telerik.setVisible(popup,true);
}},_onMouseLeave:function(e){var toKeep=$telerik.isMouseOverElementEx(this.get_popupElement(),e);
if(!toKeep){this._cancelAutoClose=false;
this._resetAutoCloseDelay();
}},_onResponseEnding:function(sender,args){this.raiseEvent("updating",args);
},_onResponseEnded:function(sender,args){var hidden=$get(this.get_id()+"_hiddenState");
if(hidden&&hidden.value&&sender._isCallbackPanel){this.set_value(hidden.value);
}var contentElement=this.get_contentElement();
if(sender._getWebServiceLoader()&&!sender._isCallbackPanel&&contentElement){contentElement.innerHTML=args.get_content();
}this.raiseEvent("updated",args);
this.setSize(this.get_width(),this.get_height());
this._setOverflow();
if(this.isVisible()){this._popupBehavior.pin(false);
this._show();
this._popupBehavior.pin(this.get_pinned());
}},_onResponseError:function(sender,args){this.raiseEvent("updateError",args);
},show:function(){if(!this.get_enabled()){return;
}if(this.isVisible()){if(this.get_animation()!=$T.NotificationAnimation.None){$telerik.$(this.get_popupElement()).stop(true,true);
}}this.setSize(this.get_width(),this.get_height());
this._setOverflow();
var cancelArgs=new Sys.CancelEventArgs();
this.raiseEvent("showing",cancelArgs);
if(cancelArgs.get_cancel()){return;
}if(!this._popupBehavior){this._popupBehavior=$create(Telerik.Web.PopupBehavior,{id:(new Date()-100)+"PopupBehavior",parentElement:null,overlay:this._overlay,keepInScreenBounds:false},null,null,this.get_popupElement());
}this._popupBehavior.pin(false);
var loadContentOn=this.get_loadContentOn();
if(loadContentOn==$T.NotificationLoad.EveryShow||(loadContentOn==$T.NotificationLoad.FirstShow&&this._firstShow)){this.update();
}this._firstShow=false;
if(this.get_animation()==$T.NotificationAnimation.None){this._show();
this._afterShow();
}else{this._playAnimation();
}},update:function(){if(!this.get_enabled()){return;
}this._xmlPanel.set_value(this.get_value());
},_show:function(){var bounds=this.getBounds();
this._setPopupVisible(bounds.x,bounds.y);
var contentElem=this.get_contentElement();
if(contentElem){$telerik.repaintChildren(contentElem);
}},moveTo:function(x,y){this._setPopupVisible(x,y);
},_afterShow:function(){this._popupBehavior.pin(this.get_pinned());
this._updateOpacity();
this._setOverflow();
this.raiseEvent("shown");
if(this.get_enableAriaSupport()){this.get_popupElement().setAttribute("aria-hidden","false");
}if(!this._cancelAutoClose){this._resetAutoCloseDelay();
}},_playAnimation:function(){var pinned=this.get_pinned();
this._popupBehavior.pin(pinned);
var endBounds=this.getBounds();
if(!pinned&&($telerik.isMobileSafari||$telerik.isSafari||$telerik.isChrome)){var offsetY=window.pageYOffset;
var offsetX=window.pageXOffset;
if(document.body.scrollTop){endBounds.y+=offsetY;
}if(document.body.scrollLeft){endBounds.x+=offsetX;
}}var onAnimationEnd=Function.createDelegate(this,function(){this._setDocumentOverflow(true);
var popupElement=this.get_popupElement();
this._popupBehavior.pin(false);
this._show();
this._afterShow();
this._setDocumentOverflow(false);
if($telerik.isFirefox&&!this.get_pinned()){this._show();
}});
var animatedElement=this.get_popupElement();
var position=this.get_position();
var animationType=this.get_animation();
if(this._verticalPosition!=2){vp=(this._verticalPosition==1?3:1);
position=parseInt(vp+""+this._horizontalPosition);
}var resize=animationType==$T.NotificationAnimation.Resize;
var startBounds=$telerik.getBounds(document.documentElement);
if(resize){startBounds.width=0;
startBounds.height=0;
startBounds.x=endBounds.x;
startBounds.y=endBounds.y;
}else{startBounds.width=endBounds.width;
startBounds.height=endBounds.height;
}var animationDuration=this.get_animationDuration();
var opacity=this.get_opacity()/100;
window.setTimeout(function(){$T.Animations.playJQueryAnimation(animatedElement,animationType,startBounds,endBounds,position,null,onAnimationEnd,animationDuration,opacity);
},0);
},hide:function(){if(!this.isVisible()){return;
}this._hide();
},_hide:function(manualClose){var popupElement=this.get_popupElement();
var animated=this.get_animation()!=$T.NotificationAnimation.None;
if(animated){$telerik.$(popupElement).stop(true,true);
}var cancelArgs=new Sys.CancelEventArgs();
cancelArgs._manualClose=manualClose?manualClose:false;
cancelArgs.get_manualClose=function(){return this._manualClose;
};
this.raiseEvent("hiding",cancelArgs);
if(cancelArgs.get_cancel()){return;
}if(animated&&!manualClose){var fnc=Function.createDelegate(this,this._afterHide);
$telerik.$(popupElement).fadeOut(this.get_animationDuration(),fnc);
}else{this._afterHide();
}},_afterHide:function(){if(this.get_titleMenu()){this.get_titleMenu().hide();
}this._popupBehavior.hide();
this._popupBehavior.pin(false);
this.cancelAutoCloseDelay();
if(this.get_keepOnMouseOver()){this._resetTimer("_showTimer",this.show,this.get_showInterval());
}this.raiseEvent("hidden");
if(this.get_enableAriaSupport()&&!this.isVisible()){this.get_popupElement().setAttribute("aria-hidden","true");
}},_setPopupVisible:function(x,y){if($telerik.isMobileSafari||$telerik.isSafari||$telerik.isChrome){var offsetY=window.pageYOffset;
var offsetX=window.pageXOffset;
if(document.body.scrollTop){y+=offsetY;
}if(document.body.scrollLeft){x+=offsetX;
}}this._popupBehavior.set_x(x);
this._popupBehavior.set_y(y);
this._popupBehavior.show();
if(!this.get_width()){this.get_popupElement().style.width="";
}},_addToDocument:function(){var popup=this.get_popupElement();
var parent=this._getDefaultParent();
parent.appendChild(popup);
if($telerik.isRightToLeft(parent)){Sys.UI.DomElement.addCssClass(popup,"rnRtl");
}},_getDefaultParent:function(){var formID=this.get_formID();
var parent=formID?document.getElementById(formID):null;
if(!parent){if(document.forms&&document.forms.length>0){parent=document.forms[0];
}else{parent=document.body;
}}return parent;
},getBounds:function(){var popupElement=this.get_popupElement();
var tempHide=(popupElement.style.display=="none")?true:false;
if(tempHide){popupElement.style.visibility="hidden";
}popupElement.style.display="";
var parent=document.documentElement;
this._popupBehavior.set_parentElement(parent);
var popupBounds=$telerik.getBounds(popupElement);
var bounds=this._getBoundsRelativeToBrowser(popupBounds);
if(tempHide){popupElement.style.display="none";
popupElement.style.visibility="";
}return bounds;
},_getBoundsRelativeToBrowser:function(popupBounds){var horSide=this._horizontalPosition;
var verSide=this._verticalPosition;
var x=0;
var y=0;
var screenBounds=$telerik.getClientBounds();
var scrolls=$telerik.getScrollOffset(document.compatMode&&document.compatMode!="BackCompat"?document.documentElement:document.body);
if("fixed"!=this.get_popupElement().style.position){x+=scrolls.x;
y+=scrolls.y;
}switch(horSide){case 2:x+=-parseInt(popupBounds.width/2-screenBounds.width/2);
break;
case 1:break;
case 3:default:x+=screenBounds.width;
x-=popupBounds.width;
break;
}switch(verSide){case 2:y+=-parseInt((popupBounds.height-screenBounds.height)/2);
break;
case 1:break;
case 3:default:y+=screenBounds.height;
y-=popupBounds.height;
break;
}x+=this.get_offsetX();
y+=this.get_offsetY();
return new Sys.UI.Bounds(x,y,popupBounds.width,popupBounds.height);
},get_popupElement:function(){return this._popupElement;
},get_contentElement:function(){return $get(this.get_id()+"_C");
},get_position:function(){return this._position;
},set_position:function(value){if(this._position!=value){this._position=value;
}var position=this.get_position();
this._horizontalPosition=this._getSide(position,true);
this._verticalPosition=this._getSide(position,false);
},get_visibleTitlebar:function(){return this._visibleTitlebar;
},set_visibleTitlebar:function(value){if(value!=this.get_visibleTitlebar()){this._visibleTitlebar=value;
this._titlebar.style.display=value?"":"none";
if(this.get_enableAriaSupport()){this._titlebar.setAttribute("aria-hidden",!value);
}this.set_height(this.get_height());
var wrapper=this.get_popupElement();
if(value){Sys.UI.DomElement.removeCssClass(wrapper,"rnNoTitleBar");
}else{Sys.UI.DomElement.addCssClass(wrapper,"rnNoTitleBar");
}}},get_width:function(){return this._width;
},set_width:function(value){var newWidth=parseInt(value);
this._width=newWidth;
this.get_popupElement().style.width=isNaN(newWidth)?"":newWidth+"px";
var contentElement=this.get_contentElement();
if(!contentElement){return;
}contentElement.style.width=!isNaN(newWidth)?newWidth-=$telerik.getPaddingBox(contentElement).horizontal:"";
},get_height:function(){return this._height;
},set_height:function(value){var newHeight=parseInt(value);
this._height=newHeight;
this.get_popupElement().style.height=isNaN(newHeight)?"":newHeight+"px";
var contentElement=this.get_contentElement();
if(!contentElement){return;
}newHeight-=$telerik.getPaddingBox(contentElement).vertical;
var titleBarHeight=$telerik.getBounds(this._titlebar).height;
if(this.get_visibleTitlebar()&&this._titlebar&&!isNaN(newHeight)){newHeight-=(titleBarHeight!=0?titleBarHeight:parseInt($telerik.getCurrentStyle(this._titlebar,"height")));
}contentElement.style.height=isNaN(newHeight)?"":newHeight+"px";
},get_showInterval:function(){return this._showInterval;
},set_showInterval:function(value){if(value!=this.get_showInterval()&&!isNaN(parseInt(value))){this._showInterval=value;
this._resetTimer("_showTimer",this.show,value);
}},get_updateInterval:function(){return this._updateInterval;
},set_updateInterval:function(value){if(value!=this.get_updateInterval()&&this.get_loadContentOn()==$T.NotificationLoad.TimeInterval&&!isNaN(parseInt(value))){this._updateInterval=value;
this._resetTimer("_updateTimer",this.update,this.get_updateInterval());
}},get_loadContentOn:function(){return this._loadContentOn;
},set_loadContentOn:function(value){if(value!=this.get_loadContentOn()){if(this.get_loadContentOn()==$T.NotificationLoad.TimeInterval){this._stopTimer("_updateTimer");
}this._loadContentOn=value;
}},_stopTimer:function(timer){if(this[timer]){clearInterval(this[timer]);
this[timer]=null;
}},_resetTimer:function(timer,func,interval){this._stopTimer(timer);
if(interval!=0){this[timer]=setInterval(Function.createDelegate(this,func),interval);
}},get_keepOnMouseOver:function(){return this._keepOnMouseOver;
},set_keepOnMouseOver:function(value){if(value!=this.get_keepOnMouseOver()){this._keepOnMouseOver=value;
this._registerMouseKeepHandlers(value);
}},get_enabled:function(){return this._enabled;
},set_enabled:function(value){if(value!=this.get_enabled()){this._enabled=value;
if(!value){this._stopTimer("_showTimer");
this._stopTimer("_updateTimer");
}else{this._resetTimer("_showTimer",this.show,this.get_showInterval());
this._resetTimer("_updateTimer",this.update,this.get_updateInterval());
}}},get_opacity:function(){return this._opacity;
},set_opacity:function(value){if(this.get_opacity()!=value){this._opacity=value>100?100:value;
this._opacity=value<0?0:value;
this._updateOpacity();
}},_updateOpacity:function(){var opaqueElem=this.get_popupElement();
var opacity=this.get_opacity();
if(opacity<100){var style=opaqueElem.style;
style.filter="alpha(opacity="+opacity+")";
style.opacity=(opacity/100);
}else{if($telerik.isIE){opaqueElem.style.removeAttribute("filter");
opaqueElem.style.removeAttribute("opacity");
}else{opaqueElem.style.filter="";
opaqueElem.style.opacity="";
}}},get_title:function(){return this._title;
},set_title:function(value){if(this._title!=value){this._title=value;
var titleElement=$telerik.getChildByClassName(this._titlebar,"rnTitleBarTitle",1);
if(titleElement){titleElement.innerHTML=value;
}}},get_text:function(){return this._text;
},set_text:function(value){var simpleContentDiv=$get(this.get_id()+"_simpleContentDiv");
if(this.get_text()!=value&&simpleContentDiv){this._text=value;
simpleContentDiv.innerHTML=value;
}},_getSide:function(oPos,isHorizontal){var index=isHorizontal?1:0;
return parseInt((oPos+"").charAt(index));
},_setOverflow:function(){var flow=this.get_contentScrolling();
if(flow==$T.NotificationScrolling.Default){return;
}var contentElement=this.get_contentElement();
if(!contentElement){return;
}var overflow="";
var enabledScrolling=true;
with($T.NotificationScrolling){switch(flow){case Auto:overflow="auto";
break;
case None:overflow="hidden";
enabledScrolling=false;
break;
case X:overflow="";
contentElement.style.overflowX="scroll";
contentElement.style.overflowY="hidden";
break;
case Y:overflow="";
contentElement.style.overflowY="scroll";
contentElement.style.overflowX="hidden";
break;
case Both:overflow="scroll";
}}if(overflow!=""){contentElement.style.overflow=overflow;
}if(enabledScrolling&&$T.TouchScrollExtender._getNeedsScrollExtender()&&!this._popupTouchScroll){this._createTouchScrollExtender(true);
}},_createTouchScrollExtender:function(toCreate){var contentElement=this.get_contentElement();
if(contentElement){var control=this._popupTouchScroll;
if(control){if(!toCreate){control.dispose();
this._popupTouchScroll=null;
}}else{if(toCreate){this._popupTouchScroll=new $T.TouchScrollExtender(contentElement);
this._popupTouchScroll.initialize();
}}}},_setDocumentOverflow:function(removeOverflow){if(removeOverflow){this._documentOverflowX=document.documentElement.style.overflowX;
this._scrollY=document.documentElement.scrollTop;
document.documentElement.style.overflowX="hidden";
}else{if(null!=this._documentOverflowX){document.documentElement.style.overflowX=this._documentOverflowX;
this._documentOverflowX=null;
if(this._scrollY){document.documentElement.scrollTop=this._scrollY;
}this._scrollY=null;
}}},_applyAriaSupport:function(){var popup=this.get_popupElement();
popup.setAttribute("role","alert");
popup.setAttribute("aria-live","polite");
popup.setAttribute("aria-atomic","true");
popup.setAttribute("aria-hidden","true");
popup.setAttribute("aria-relevant","additions text");
if(!this.get_visibleTitlebar()){this._titlebar.setAttribute("aria-hidden","true");
}else{this._titlebar.setAttribute("role","toolbar");
if(this._closeIcon){this._closeIcon.removeAttribute("href");
this._closeIcon.setAttribute("role","button");
}if(this._menuIcon){this._menuIcon.removeAttribute("href");
this._menuIcon.setAttribute("role","button");
}var titleElement=$telerik.getChildByClassName(this._titlebar,"rnTitleBarTitle",1);
if(titleElement){titleElement.setAttribute("id",this.get_id()+"_title");
popup.setAttribute("aria-labelledby",titleElement.id);
}var ulElement=$telerik.getChildByClassName(this._titlebar," rnCommands",1);
if(ulElement){ulElement.setAttribute("role","presentation");
}}if(this._xmlPanel){popup.setAttribute("aria-describedby",this._xmlPanel.get_id());
}},isVisible:function(){var popup=this.get_popupElement();
return(popup&&popup.style.display!="none");
},setSize:function(width,height){this.set_width(width);
this.set_height(height);
},_resetAutoCloseDelay:function(){this.cancelAutoCloseDelay();
if(this.get_autoCloseDelay()!=0){this._autoCloseRef=window.setTimeout(Function.createDelegate(this,function(){this.hide();
}),this.get_autoCloseDelay());
}},cancelAutoCloseDelay:function(){if(this._autoCloseRef){window.clearTimeout(this._autoCloseRef);
this._autoCloseRef=0;
}},get_titleMenu:function(){return this._titleMenu;
},get_zIndex:function(){return this._zIndex;
},set_zIndex:function(value){var zIndex=parseInt(value);
if(isNaN(zIndex)){return;
}if(this._zIndex!=value){this._zIndex=zIndex;
this.get_popupElement().style.zIndex=zIndex;
var menu=this.get_titleMenu();
if(menu){menu._getContextMenuElement().style.zIndex=menu._originalZIndex=menu._defaultZIndex=zIndex+100;
}}}};
$.registerControlProperties($T.RadNotification,{animation:$T.NotificationAnimation.None,animationDuration:500,formID:null,offsetX:0,offsetY:0,pinned:true,overlay:false,contentScrolling:$T.NotificationScrolling.Default,value:"",autoCloseDelay:3000,visibleOnPageLoad:false,showCloseButton:true,showTitleMenu:false,enableAriaSupport:false});
$.registerControlEvents($T.RadNotification,["hidden","hiding","shown","showing","updated","updateError","updating"]);
Telerik.Web.UI.RadNotification.registerClass("Telerik.Web.UI.RadNotification",$T.RadWebControl);
})($telerik.$,Telerik.Web.UI);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
