/* Copyright (C) 2007 - 2010 YOOtheme GmbH, YOOtheme License (http://www.yootheme.com/license) */

var Notifier={};
Notifier.Base=new Class({options:{type:null,title:"Title",text:null,duration:2,sticky:false,prefix:"notify-",suffix:null},initialize:function(a){this.setOptions(a);this.wrapper=new Element("div",{styles:{position:"absolute",display:"none",opacity:0},"class":this.options.prefix+this.options.type});a=(new Element("div",{"class":"panel"})).injectInside(this.wrapper);(new Element("div",{"class":"close"})).injectInside(a);(new Element("h3",{"class":"title"})).injectInside(a);(new Element("p",{"class":"text"})).injectInside(a);
return this.show.bind(this)},show:function(a){a=$merge(this.options,a);var b=this.wrapper.clone().injectInside(document.body).setStyles(a.position);a.suffix&&b.addClass(a.prefix+a.suffix);b.getElement(".title").setHTML(a.title);b.getElement(".text").setHTML(a.text);b.effects({duration:400}).start({opacity:1});b.addEvent("click",function(){$clear(b._timer);this.hide(b)}.bind(this));b._timer=a.sticky?null:this.hide.delay(a.duration*1E3,this,b)},hide:function(a,b){a.effects({duration:400,onComplete:function(){a.empty().remove()}}).start(b)}});
Notifier.Base.implement(new Options);Notifier.Smoke=Notifier.Base.extend({initialize:function(){this.queue=[];return this.parent({type:"smoke"})},show:function(a){var b=this.queue.getLast(),c=window.getScrollTop()+10+b*90;a.position={top:c+"px",right:"10px",display:"block"};this.queue.push(b+1);this.parent(a)},hide:function(a){this.queue.shift();this.parent(a,{opacity:0})}});
Notifier.Bezel=Notifier.Base.extend({initialize:function(){this.i=0;return this.parent({type:"bezel"})},show:function(a){var b=window.getScrollTop()+window.getHeight()/2-105,c=window.getScrollLeft()+window.getWidth()/2-103;a.position={top:b+"px",left:c+"px",display:"block"};this.i++;this.chain(this.parent.pass(a,this));this.i==1&&this.callChain()},hide:function(a){this.queue.delay(400,this);this.parent(a,{opacity:0,"margin-top":[0,50]})},queue:function(){this.i--;this.callChain()}});Notifier.Bezel.implement(new Chain);
var Notify=function(a){Notify[a.type]?Notify[a.type].call(a):Notify.Smoke(a)};window.addEvent("domready",function(){Notify.Bezel=new Notifier.Bezel;Notify.Smoke=new Notifier.Smoke}); 
