(function(A){A.jGrowl=function(B,C){if(A("#jGrowl").size()==0){A('<div id="jGrowl"></div>').addClass(A.jGrowl.defaults.position).appendTo("body")
}A("#jGrowl").jGrowl(B,C)
};
A.fn.jGrowl=function(B,D){if(A.isFunction(this.each)){var C=arguments;
return this.each(function(){var E=this;
if(A(this).data("jGrowl.instance")==undefined){A(this).data("jGrowl.instance",new A.fn.jGrowl());
A(this).data("jGrowl.instance").startup(this)
}if(A.isFunction(A(this).data("jGrowl.instance")[B])){A(this).data("jGrowl.instance")[B].apply(A(this).data("jGrowl.instance"),A.makeArray(C).slice(1))
}else{A(this).data("jGrowl.instance").notification(B,D)
}})
}};
A.extend(A.fn.jGrowl.prototype,{defaults:{header:"",sticky:false,position:"top-right",glue:"after",theme:"default",corners:"10px",check:500,life:3000,speed:"normal",easing:"swing",closer:true,closerTemplate:"<div>[ close all ]</div>",log:function(C,B,D){},beforeOpen:function(C,B,D){},open:function(C,B,D){},beforeClose:function(C,B,D){},close:function(C,B,D){},animateOpen:{opacity:"show"},animateClose:{opacity:"hide"}},element:null,interval:null,notification:function(C,E){var B=this;
var E=A.extend({},this.defaults,E);
E.log.apply(this.element,[this.element,C,E]);
var D=A('<div class="jGrowl-notification"><div class="close">&times;</div><div class="header">'+E.header+'</div><div class="message">'+C+"</div></div>").data("jGrowl",E).addClass(E.theme).children("div.close").bind("click.jGrowl",function(){A(this).unbind("click.jGrowl").parent().trigger("jGrowl.beforeClose").animate(E.animateClose,E.speed,E.easing,function(){A(this).trigger("jGrowl.close").remove()
})
}).parent();
(E.glue=="after")?A("div.jGrowl-notification:last",this.element).after(D):A("div.jGrowl-notification:first",this.element).before(D);
A(D).bind("mouseover.jGrowl",function(){A(this).data("jGrowl").pause=true
}).bind("mouseout.jGrowl",function(){A(this).data("jGrowl").pause=false
}).bind("jGrowl.beforeOpen",function(){E.beforeOpen.apply(B.element,[B.element,C,E])
}).bind("jGrowl.open",function(){E.open.apply(B.element,[B.element,C,E])
}).bind("jGrowl.beforeClose",function(){E.beforeClose.apply(B.element,[B.element,C,E])
}).bind("jGrowl.close",function(){E.close.apply(B.element,[B.element,C,E])
}).trigger("jGrowl.beforeOpen").animate(E.animateOpen,E.speed,E.easing,function(){A(this).data("jGrowl").created=new Date()
}).trigger("jGrowl.open");
if(A.fn.corner!=undefined){A(D).corner(E.corners)
}if(A("div.jGrowl-notification:parent",this.element).size()>1&&A("div.jGrowl-closer",this.element).size()==0&&this.defaults.closer!=false){A(this.defaults.closerTemplate).addClass("jGrowl-closer").addClass(this.defaults.theme).appendTo(this.element).animate(this.defaults.animateOpen,this.defaults.speed,this.defaults.easing).bind("click.jGrowl",function(){A(this).siblings().children("div.close").trigger("click.jGrowl");
if(A.isFunction(B.defaults.closer)){B.defaults.closer.apply(A(this).parent()[0],[A(this).parent()[0]])
}})
}},update:function(){A(this.element).find("div.jGrowl-notification:parent").each(function(){if(A(this).data("jGrowl")!=undefined&&A(this).data("jGrowl").created!=undefined&&(A(this).data("jGrowl").created.getTime()+A(this).data("jGrowl").life)<(new Date()).getTime()&&A(this).data("jGrowl").sticky!=true&&(A(this).data("jGrowl").pause==undefined||A(this).data("jGrowl").pause!=true)){A(this).children("div.close").trigger("click.jGrowl")
}});
if(A(this.element).find("div.jGrowl-notification:parent").size()<2){A(this.element).find("div.jGrowl-closer").animate(this.defaults.animateClose,this.defaults.speed,this.defaults.easing,function(){A(this).remove()
})
}},startup:function(B){this.element=A(B).addClass("jGrowl").append('<div class="jGrowl-notification"></div>');
this.interval=setInterval(function(){jQuery(B).data("jGrowl.instance").update()
},this.defaults.check);
if(A.browser.msie&&parseInt(A.browser.version)<7){A(this.element).addClass("ie6")
}},shutdown:function(){A(this.element).removeClass("jGrowl").find("div.jGrowl-notification").remove();
clearInterval(this.interval)
}});
A.jGrowl.defaults=A.fn.jGrowl.prototype.defaults
})(jQuery);