(function(s,E){function n(a){if(a){if(a.nodeType||a.item)return a;if("string"===typeof a)return document.getElementById(a);if("object"===typeof a&&"length"in a){for(var d=[],b=0,c=a.length;b<c;++b)d[d.length]=n(a[b]);return d}return a}return null}function J(){var a=function(){var b=document.getElementById("header")||document.getElementById("layout-header"),c=document.getElementById("body")||document.body,a=function(){};b?(v.register(document.getElementById("text-ad-container")||document.getElementById("body")),
c=b,a=function(b){b.className+=" wrapper";c.appendChild(b)}):c&&(a=function(b){c.insertBefore(b,c.firstChild)});return{attach:a}}(),d=function(){var b=document.getElementById(k.QUEUE)||document.createElement("div");b.id=k.QUEUE;return p[k.QUEUE]=b}();a.attach(d);F=!0}function q(a){F||J();p[a]=p[a]||document.getElementById(a);return p[a]}function G(a){var d="inject"===a?2:0,b=(a||"remove")+"Alert";return function(){var c=[].slice.apply(arguments),a=c[0],a=a===Object(a)&&!A(c[0]),e;e=a?c[0].node:c[d];
var f=q(k.QUEUE);e=n(e);e=e===q(k.OLD)?f:e||f;a?c[0].node=e:c[d]=e;return(e===q(k.QUEUE)?LI.GlobalAlertManager:t)[b].apply(this,c)}}function B(a){return"undefined"===typeof a?l.ACTION:l[a]||a||0}function A(a){return!(!a||1!==a.nodeType)}function H(a){var d=a&&a.childNodes||[],b,c;b=0;for(c=d.length;b<c;b++)if(a=d[b],A(a))return a;return null}function L(){function a(){n.remove(g.meta.uid);r.dequeue();c.showTopAlert()}function d(){g&&n.stash(g.contents,g.meta.uid);return g}function b(){c.attachEventHandlers();
c.enqueueExistingAlerts()}var c=this,m=/LI_JS_DEBUG/.test(window.location.hash),e=!!window.LI_JS_TEST,K=/<(span|a|button)[^>]+class\s*=\s*['\"]?[^'\"]*?\bdismiss\b/i,p=/<a/i,r=new LI.WeightedQueue,n=new LI.NodeStash,g,w=document.createElement("div"),h;(function(){function b(){var c,a;if(!g||!g.autoHide)return null;c=g.autoHide;if(isNaN(c)||!0===c)if(c=3E3,a=g.contents)a=a.textContent||a.innerText||"",c+=55*a.length;return c}function a(){var x;d();g&&(x=b())&&(f=m(),x=Math.max(3E3,x-e),C=window.setTimeout(function(){c.removeAlert()},
x))}function d(){window.clearTimeout(C);C=null}var C,e=0,f=0,m=Date.now||function(){return+new Date};h={clear:function(){e=0;d()},start:a,resume:a,stop:d,pause:function(){e+=Math.max(m()-f,0);d()}}})();c.showTopAlert=function(){function c(){f.fire(g.meta.origin,"view")}var b=q(k.QUEUE),a=d();if(r.length())if(g=r.peek(),a&&a.meta.uid===g.meta.uid)b.appendChild(g.contents);else{h.clear();a=g.contents;b.appendChild(a);v.shift(g.autoHide?null:a);t.injectAlert.animate(b,h.start);if(f.paused)return c;c()}else h.clear(),
t.removeAlert(b,!0),v.restore();return null};c.normalizeAlert=function(c,a){function b(c){d.meta={weight:B(a),uid:++I};"undefined"===typeof d.contents&&(w.innerHTML=c,d.contents=H(w));d.isDismissable=K.test(c);d.autoHide=d.isDismissable&&!p.test(c)}var d={};A(c)?(d.contents=c,w.innerHTML="",b(w.appendChild(c).innerHTML)):c===Object(c)?d=c:"string"===typeof c&&b(c);return d};c.enqueue=function(b,d,e){return b?(b=c.normalizeAlert(b,d))&&b.meta?(b.meta.origin=e,g&&g.meta.weight===b.meta.weight&&a(),
r.enqueue(b,b.meta.weight),f.fire(e,"enqueue"),c.showTopAlert()):null:null};c.dequeue=function(){g&&g.isDismissable&&a()};c.injectAlert=function(){var b={},a=t.injectAlert.normalizeInterface.apply(this,arguments),e;d();a.weight=B(a.weight);a.disableDismissHandler=!0;a.animate=!0;b.meta={weight:a.weight,uid:++I};b.isDismissable=!!a.dismissable;b.autoHide="undefined"!==typeof a.autoHide?a.autoHide:b.isDismissable&&!p.test(a.message||"");e=t.injectAlert(a);b.contents=e.firstChild;n.stash(b.contents,
b.meta.uid);c.enqueue(b,a.weight,a.origin||"injectAlert");return q(k.QUEUE)};c.removeAlert=function(){c.dequeue();g&&g.meta&&f.fire(g.meta.origin,"remove");c.showTopAlert()};c.attachEventHandlers=function(){function b(){f.fire(g.meta.origin,"dismiss");c.removeAlert()}function a(){f.fire(g.meta.origin,"interact")}var d=q(k.QUEUE),e;if(y)s(d).on("click",".dismiss",function(c){a();b()}).on("click","a",function(b){a()}).on("mouseenter focus",h.pause).on("mouseleave blur",h.resume);else u&&(e=function(b,
c){z.on(d,b,c)},e(d,"click",function(c){YDom.hasClass(z.getTarget(c),"dismiss")?(a(),b()):"A"===z.getTarget(c).tagName&&a()}),e("mouseenter",h.pause),e("focus",h.pause),e("mouseleave",h.resume),e("blur",h.resume))};c.enqueueExistingAlerts=function(){var b,a,d;f.pause();for(b in D)D.hasOwnProperty(b)&&(a=document.getElementById(b),d=c.enqueue(H(a),B(D[b]),b)||d);f.resume(d)};c.on=function(b,c,a){f.bind(b,c,a)};c.trigger=function(b,c){f.fire(b,c)};c.EnqueueAlertNode=function(b,a){a=a||{};c.enqueue(b,
a.weight||l.UNKNOWN,a.origin||b.id)};(function(){var c=LI.PageVisibility;c&&(c.on("hidden",h.pause),c.on("visible",h.resume));if(!e)if(y)s(b);else if(u)z.onDOMReady(b)})();c.publicInterface={injectAlert:c.injectAlert,removeAlert:c.removeAlert,trigger:c.trigger,on:c.on,EnqueueAlertNode:c.EnqueueAlertNode};m&&(c.publicInterface._debug={queue:r});e&&(c.publicInterface._test={queue:r,domReady:b});return c.publicInterface}if(!LI.GlobalAlertManager){var l={MAINTENANCE:100,UNKNOWN:200,EMAIL:300,SUBS:400,
POLICY:500,APP:600,ACTION:700},k={QUEUE:"global-alert-queue",OLD:"global-error"},D={"global-maintenance-notice":l.MAINTENANCE,"notice-cookie-policy":l.POLICY,"notice-privacy":l.POLICY+1,"global-error":l.APP,"notice-review-email":l.EMAIL,"notice-subscription":l.SUBS},t={injectAlert:LI.injectAlert,removeAlert:LI.removeAlert},y=!!s,u=!!E,z=u?E.util.Event:null,p={},I=0,F,f;(function(){var a={};f={bind:function(d,b,c){d=a[d]=a[d]||{};b=d[b]=d[b]||[];b.push(c)},fire:function(d,b){if(!f.paused)for(var c=
(a[d]||{})[b]||[],m=0,e=c.length;m<e;m++)c[m]()},pause:function(){f.paused=!0},resume:function(a){f.paused=!1;a&&a()}}})();var v;(function(){function a(b){var c=0,a,e=d.length;for(b&&(y?c=b?s(b).outerHeight():0:u&&(c=YDom.getRegion(b).height||0,a=parseInt(YDom.getStyle(b,"margin-top"),10)||0,b=parseInt(YDom.getStyle(b,"margin-bottom"),10)||0,c=c+a+b));e--;)if((b=d[e])&&"style"in b.node){a=b.node.style;var f=b.offset;isNaN(f)&&(y?f=s(b.node).css("margin-top"):u&&(f=YDom.getStyle(b.node,"margin-top")),
f=parseInt(f,10)||0,b.offset=f);a.marginTop=f+c+"px"}}var d=[];v={shift:function(b){a(b)},restore:function(){a(null)},register:function(b){if(b){b="length"in b?b:[b];b=n(b);for(var a=b.length;a--;)b[a]&&d.push({node:b[a]})}}}})();LI.define("GlobalAlertManager");LI.GlobalAlertManager=new L;LI.injectAlert=G("inject");LI.removeAlert=G("remove")}})(window.jQuery,window.YAHOO);