/*
jQWidgets v4.5.4 (2017-June)
Copyright (c) 2011-2017 jQWidgets.
License: http://jqwidgets.com/license/
*/
!function(a){a.jqx.jqxWidget("jqxNotification","",{}),a.extend(a.jqx._jqxNotification.prototype,{defineInstance:function(){var b={width:"auto",height:"auto",appendContainer:null,position:"top-right",zIndex:99999,browserBoundsOffset:5,notificationOffset:5,opacity:.9,hoverOpacity:1,autoOpen:!1,animationOpenDelay:400,animationCloseDelay:800,closeOnClick:!0,autoClose:!0,autoCloseDelay:3e3,showCloseButton:!0,template:"info",icon:null,blink:!1,disabled:!1,rtl:!1,events:["open","close","click"]};return this===a.jqx._jqxNotification.prototype?b:(a.extend(!0,this,b),b)},createInstance:function(a){var b=this;b.render(),1==b.autoOpen&&b.open()},render:function(){var b=this;if(0==b.host.hasClass("jqx-notification")){b.host.addClass(b.toThemeProperty("jqx-rc-all")),b.host.addClass(b.toThemeProperty("jqx-notification")),b.host.css({zIndex:b.zIndex,display:"none",opacity:b.opacity}),b._container=b._notificationContainer(),b._appendContent(),b._setHoverFunctions(),b._instances=new Array,b._instanceKey=0;var c=a.data(document.body,"jqxNotifications");void 0==c&&(c=0),a.data(document.body,"jqxNotifications",c+1)}else b.refresh()},refresh:function(a){a||this._appendContent(!0)},open:function(){var a=this;if(0==a.disabled){var b=a.host.clone();b.removeAttr("id"),b.width(a.width),b.height(a.height),null!=this.width&&-1!=this.width.toString().indexOf("%")&&b.css("width",this.width),null!=this.height&&-1!=this.height.toString().indexOf("%")&&b.css("height",this.height),a.appendContainer||"bottom-left"!=a.position&&"bottom-right"!=a.position?(b.css("margin-bottom",a.notificationOffset),a._container.append(b)):(b.css("margin-top",a.notificationOffset),a._container.prepend(b)),a._addHandlers(b),b.fadeIn(a.animationOpenDelay,function(){a._raiseEvent("0",{element:b})}),1==a.blink&&(b._blinkInterval=setInterval(function(){b.fadeTo(400,a.opacity/1.5,function(){b.fadeTo(400,a.opacity)})},850)),1==a.autoClose&&(b._autoCloseTimeout=setTimeout(function(){a._close(b)},a.autoCloseDelay)),b._key=a._instanceKey,a._instances[a._instanceKey]=b,a._instanceKey++}},closeAll:function(){for(var a=this,b=0;b<a._instances.length;b++)a._instances[b]&&a._close(a._instances[b])},closeLast:function(){for(var a=this,b=a._instances.length;b>=0;b--)if(a._instances[b]){a._close(a._instances[b]);break}},destroy:function(){var b=this;b.closeAll(),b.host.remove();var c=a.data(document.body,"jqxNotifications");a.data(document.body,"jqxNotifications",c-1),b._destroyContainers(c-1)},propertyChangedHandler:function(a,b,c,d){var e=this;if(d!=c)switch(b){case"width":case"height":var f=c.indexOf&&-1!=c.indexOf("%");f=void 0!=f&&f;var g=d.indexOf&&-1!=d.indexOf("%");g=void 0!=g&&g,g!=f&&(e[b]=c);break;case"appendContainer":case"position":e._container=e._notificationContainer();break;case"browserBoundsOffset":e.appendContainer||e._position(e._container);break;case"opacity":e.host.css("opacity",d);break;case"showCloseButton":case"template":case"icon":case"rtl":e._appendContent(!0)}},_raiseEvent:function(b,c){var d=this,e=d.events[b],f=new a.Event(e);f.owner=d,f.args=c;try{var g=d.host.trigger(f)}catch(a){}return g},_close:function(a){var b=this;b._instances[a._key]&&(b._instances[a._key]=!1,clearInterval(a._blinkInterval),clearTimeout(a._autoCloseTimeout),a.fadeOut(b.animationCloseDelay,function(){b._removeHandlers(a),a.remove(),b._raiseEvent("1")}))},_addHandlers:function(a){var b=this;if(b.addHandler(a,"click.notification"+b.element.id,function(c){b._raiseEvent("2"),1==b.closeOnClick&&b._close(a)}),b.addHandler(a,"mouseenter.notification"+b.element.id,function(c){a._blinkInterval||b.mouseenterFunction(a)}),b.addHandler(a,"mouseleave.notification"+b.element.id,function(c){a._blinkInterval||"none"==a.css("display")||b.mouseleaveFunction(a)}),1==b.showCloseButton){var c=a.find(".jqx-notification-close-button");b.addHandler(c,"click.notification"+b.element.id,function(c){c.stopPropagation(),b._close(a)})}},_removeHandlers:function(a){var b=this;b.removeHandler(a,"click.notification"+b.element.id),b.removeHandler(a,"click.mouseenter"+b.element.id),b.removeHandler(a,"click.mouseleave"+b.element.id);var c=a.find(".jqx-notification-close-button");c.length>0&&b.removeHandler(c,"click.notification"+b.element.id)},_appendContent:function(b){var c,d=this,e=d.host.html();b||(c=d.host.children().detach()),b&&(d.host.removeAttr("class"),d.host.addClass(d.toThemeProperty("jqx-rc-all")),d.host.addClass(d.toThemeProperty("jqx-notification")));var f=a("<table class='"+d.toThemeProperty("jqx-notification-table")+"'></table>"),g=a("<tr></tr>");f.append(g);var h=d.rtl?"jqx-notification-content-rtl":"";if(b){var i=d.host.find(".jqx-notification-content");e=i.html(),c=i.detach(),d.rtl?i.addClass("jqx-notification-content-rtl"):i.removeClass("jqx-notification-content-rtl")}else var i=a("<td class='"+d.toThemeProperty("jqx-notification-content")+" "+h+"'></td>");g.html(i);var j,k=function(){0==d.rtl?(j.addClass("jqx-notification-icon-ltr"),i.before(j)):(j.addClass("jqx-notification-icon-rtl"),i.after(j))};if(d.template?(d.host.addClass("jqx-widget"),d.host.addClass("jqx-popup"),d.host.addClass("jqx-notification-"+d.template),j=a("<td class='"+d.toThemeProperty("jqx-notification-icon")+" jqx-notification-icon-"+d.template+"'></td>"),k()):(d.host.addClass(d.toThemeProperty("jqx-widget")),d.host.addClass(d.toThemeProperty("jqx-popup")),d.host.addClass(d.toThemeProperty("jqx-fill-state-normal")),d.icon&&(j=a("<td class='"+d.toThemeProperty("jqx-notification-icon")+"'></td>"),d.icon.padding=d.icon.padding?parseInt(d.icon.padding):5,j.css({width:parseInt(d.icon.width)+d.icon.padding,height:d.icon.height,"background-image":"url('"+d.icon.url+"')"}),k())),1==d.showCloseButton){var l;l=d.template?"jqx-notification-close-button jqx-notification-close-button-"+d.template:d.toThemeProperty("jqx-icon-close")+" "+d.toThemeProperty("jqx-notification-close-button");var m=a("<td class='"+d.toThemeProperty("jqx-notification-close-button-container")+"'><div class='"+l+" "+d.element.id+"CloseButton' title='Close'></div></td>");0==d.rtl?(m.find("div").addClass("jqx-notification-close-button-ltr"),i.after(m)):(m.find("div").addClass("jqx-notification-close-button-rtl"),i.before(m))}d.host[0].innerHTML="",d.host.append(f),c.length>0?d.host.find(".jqx-notification-content").append(c):d.host.find(".jqx-notification-content").html(e)},_position:function(a){var b,c,d,e,f=this;switch(f.position){case"top-right":b="",c=f.browserBoundsOffset,d=f.browserBoundsOffset,e="";break;case"top-left":b=f.browserBoundsOffset,c="",d=f.browserBoundsOffset,e="";break;case"bottom-left":b=f.browserBoundsOffset,c="",d="",e=f.browserBoundsOffset;break;case"bottom-right":b="",c=f.browserBoundsOffset,d="",e=f.browserBoundsOffset}a.css({left:b,right:c,top:d,bottom:e})},_notificationContainer:function(){var b,c=this;if(c.appendContainer){if(b=a(c.appendContainer),0==b.length)throw new Error("jqxNotification: Invalid appendContainer jQuery Selector - "+c.appendContainer+"! Please, check whether the used ID or CSS Class name is correct.")}else b=a("#jqxNotificationDefaultContainer-"+c.position),0==b.length&&(a("body").append("<div id='jqxNotificationDefaultContainer-"+c.position+"' class='jqx-notification-container'></div>"),b=a("#jqxNotificationDefaultContainer-"+c.position),c.width.indexOf&&-1!=c.width.indexOf("%")&&b.addClass(c.toThemeProperty("jqx-notification-container-full-width")),c.height.indexOf&&-1!=c.height.indexOf("%")&&b.addClass(c.toThemeProperty("jqx-notification-container-full-height")),c._position(b));return b},_destroyContainers:function(b){0==b&&a(".jqx-notification-container").remove()},_setHoverFunctions:function(){var b=this,c=!1;"msie"==a.jqx.browser.browser&&"9.0"==a.jqx.browser.version&&(c=!0),0==c?(b.mouseenterFunction=function(a){a.fadeTo("fast",b.hoverOpacity)},b.mouseleaveFunction=function(a){a.fadeTo("fast",b.opacity)}):(b.mouseenterFunction=function(a){a.css("filter","alpha(opacity = "+100*b.hoverOpacity+")")},b.mouseleaveFunction=function(a){a.css("filter","alpha(opacity = "+100*b.opacity+")")})}})}(jqxBaseFramework);

