!function(a,b,c,d){a.fn.nag=function(c){var e,f=a(this),g=a.extend(!0,{},a.fn.nag.settings,c),h=g.className,i=g.selector,j=g.error,k=g.namespace,l="."+k,m=k+"-module",n=f.selector||"",o=(new Date).getTime(),p=[],q=arguments[0],r="string"==typeof q,s=[].slice.call(arguments,1);return a(this).each(function(){var c,k,t,u,v,w,x,y,z,A=a(this),B=A.find(i.close),C=a(g.context),D=this,E=A.data(m),F=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)};z={initialize:function(){z.verbose("Initializing element"),c=A.offset(),k=A.outerHeight(),t=C.outerWidth(),u=C.outerHeight(),v=C.offset(),A.data(m,z),B.on("click"+l,z.dismiss),g.context==b&&"fixed"==g.position&&A.addClass(h.fixed),g.sticky&&(z.verbose("Adding scroll events"),"absolute"==g.position?C.on("scroll"+l,z.event.scroll).on("resize"+l,z.event.scroll):a(b).on("scroll"+l,z.event.scroll).on("resize"+l,z.event.scroll),a.proxy(z.event.scroll,this)()),g.displayTime>0&&setTimeout(z.hide,g.displayTime),z.should.show()?A.is(":visible")||z.show():z.hide()},destroy:function(){z.verbose("Destroying instance"),A.removeData(m).off(l),g.sticky&&C.off(l)},refresh:function(){z.debug("Refreshing cached calculations"),c=A.offset(),k=A.outerHeight(),t=C.outerWidth(),u=C.outerHeight(),v=C.offset()},show:function(){z.debug("Showing nag",g.animation.show),"fade"==g.animation.show?A.fadeIn(g.duration,g.easing):A.slideDown(g.duration,g.easing)},hide:function(){z.debug("Showing nag",g.animation.hide),"fade"==g.animation.show?A.fadeIn(g.duration,g.easing):A.slideUp(g.duration,g.easing)},onHide:function(){z.debug("Removing nag",g.animation.hide),A.remove(),g.onHide&&g.onHide()},stick:function(){if(z.refresh(),"fixed"==g.position){var c=a(b).prop("pageYOffset")||a(b).scrollTop(),d=A.hasClass(h.bottom)?v.top+(u-k)-c:v.top-c;A.css({position:"fixed",top:d,left:v.left,width:t-g.scrollBarWidth})}else A.css({top:x})},unStick:function(){A.css({top:""})},dismiss:function(a){g.storageMethod&&z.storage.set(g.storedKey,g.storedValue),z.hide(),a.stopImmediatePropagation(),a.preventDefault()},should:{show:function(){return g.persist?(z.debug("Persistent nag is set, can show nag"),!0):z.storage.get(g.storedKey)!=g.storedValue?(z.debug("Stored value is not set, can show nag",z.storage.get(g.storedKey)),!0):(z.debug("Stored value is set, cannot show nag",z.storage.get(g.storedKey)),!1)},stick:function(){return w=C.prop("pageYOffset")||C.scrollTop(),x=A.hasClass(h.bottom)?u-A.outerHeight()+w:w,x>c.top?!0:"fixed"==g.position?!0:!1}},storage:{set:function(c,e){z.debug("Setting stored value",c,e,g.storageMethod),"local"==g.storageMethod&&b.store!==d?b.store.set(c,e):a.cookie!==d?a.cookie(c,e):z.error(j.noStorage)},get:function(c){return z.debug("Getting stored value",c,g.storageMethod),"local"==g.storageMethod&&b.store!==d?b.store.get(c):a.cookie!==d?a.cookie(c):(z.error(j.noStorage),void 0)}},event:{scroll:function(){y!==d&&clearTimeout(y),y=setTimeout(function(){z.should.stick()?F(z.stick):z.unStick()},g.lag)}},setting:function(b,c){return z.debug("Changing setting",b,c),c===d?g[b]:(a.isPlainObject(b)?a.extend(!0,g,b):g[b]=c,void 0)},internal:function(b,c){return z.debug("Changing internal",b,c),c===d?z[b]:(a.isPlainObject(b)?a.extend(!0,z,b):z[b]=c,void 0)},debug:function(){g.debug&&(g.performance?z.performance.log(arguments):(z.debug=Function.prototype.bind.call(console.info,console,g.name+":"),z.debug.apply(console,arguments)))},verbose:function(){g.verbose&&g.debug&&(g.performance?z.performance.log(arguments):(z.verbose=Function.prototype.bind.call(console.info,console,g.name+":"),z.verbose.apply(console,arguments)))},error:function(){z.error=Function.prototype.bind.call(console.error,console,g.name+":"),z.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;g.performance&&(b=(new Date).getTime(),d=o||b,c=b-d,o=b,p.push({Element:D,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(z.performance.timer),z.performance.timer=setTimeout(z.performance.display,100)},display:function(){var b=g.name+":",c=0;o=!1,clearTimeout(z.performance.timer),a.each(p,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",n&&(b+=" '"+n+"'"),f.size()>1&&(b+=" ("+f.size()+")"),(console.group!==d||console.table!==d)&&p.length>0&&(console.groupCollapsed(b),console.table?console.table(p):a.each(p,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(b,c,f){var g,h,i;return c=c||s,f=D||f,"string"==typeof b&&E!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(c,e){var f=c!=g?e+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(E[e])&&c!=g)E=E[e];else{if(!a.isPlainObject(E[f])||c==g)return E[e]!==d?(h=E[e],!1):E[f]!==d?(h=E[f],!1):(z.error(j.method),!1);E=E[f]}})),a.isFunction(h)?i=h.apply(f,c):h!==d&&(i=h),a.isArray(e)?e.push(i):"string"==typeof e?e=[e,i]:i!==d&&(e=i),h}},r?(E===d&&z.initialize(),z.invoke(q)):(E!==d&&z.destroy(),z.initialize())}),e!==d?e:this},a.fn.nag.settings={name:"Nag",verbose:!0,debug:!0,performance:!0,namespace:"Nag",persist:!1,displayTime:0,animation:{show:"slide",hide:"slide"},position:"fixed",scrollBarWidth:18,storageMethod:"cookie",storedKey:"nag",storedValue:"dismiss",sticky:!1,lag:0,context:b,error:{noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",method:"The method you called is not defined."},className:{bottom:"bottom",fixed:"fixed"},selector:{close:".icon.close"},speed:500,easing:"easeOutQuad",onHide:function(){}}}(jQuery,window,document);