
(function($){$.jGrowl=function(message,o){this.defaults=$.jGrowl.defaults;var o=$.extend($.jGrowl.defaults,o||{});if($('div#jGrowl').size()==0)$.jGrowl.startup();var notification=$('<div class="jGrowl"><div class="close">&times;</div><div class="header">'+o.header+'</div><div class="message">'+message+'</div></div>').data("jGrowl",{sticky:o.sticky,life:o.life,speed:o.speed}).addClass(o.theme).children('div.close').bind("click.jGrowl",function(){$(this).unbind('click.jGrowl').parent().fadeOut(o.speed,function(){$(this).trigger('jGrowl.close').remove();});}).parent();if($('div#jGrowl').children('div.jGrowl').size()==0){$('div#jGrowl').append(notification);}else{$('div#jGrowl div.jGrowl:last').after(notification);}
if($.fn.corner!=undefined)$('div#jGrowl').children().corner('10px');$('div#jGrowl div.jGrowl:last').fadeIn(o.speed,function(){$(this).data("jGrowl").created=new Date();}).bind("mouseover.jGrowl",function(){$(this).data("jGrowl").pause=true;}).bind("mouseout.jGrowl",function(){$(this).data("jGrowl").pause=false;}).bind('jGrowl.open',function(){o.open.apply(this,[this,message]);}).bind('jGrowl.close',function(){o.close.apply(this,[this,message]);}).trigger('jGrowl.open');if($('div#jGrowl div.jGrowl').size()>1&&$('div#jGrowl div.closer').size()==0&&this.defaults.closer!=false){$('<div class="closer">[ close all ]</div>').addClass(this.defaults.theme).appendTo("div#jGrowl").fadeIn(this.defaults.speed).bind("click.jGrowl",function(){$(this).siblings().andSelf().fadeOut(o.speed,function(){$(this).children('div.close').trigger("click.jGrowl");});if($.isFunction($.jGrowl.defaults.closer))$.jGrowl.defaults.closer.apply($(this).parent()[0],[$(this).parent()[0]]);});};};$.extend($.jGrowl,{defaults:{header:'',sticky:false,theme:'default',check:1000,life:3000,speed:'slow',closer:true,open:function(e,m){},close:function(e,m){}},interval:null,update:function(){$('div#jGrowl div.jGrowl').each(function(key,value){if($(value).data("jGrowl").created!=undefined&&($(value).data("jGrowl").created.getTime()+$(value).data("jGrowl").life)<(new Date()).getTime()&&$(value).data("jGrowl").sticky!=true&&($(value).data("jGrowl").pause==undefined||$(value).data("jGrowl").pause!=true)){$(value).fadeOut($(this).data("jGrowl").speed,function(){$(this).children('div.close').trigger('click.jGrowl');});}});if($('div#jGrowl div.jGrowl').size()<2){$('div#jGrowl div.closer').fadeOut(this.defaults.speed,function(){$(this).remove();});};if($('div#jGrowl').children().size()==0)this.shutdown();},startup:function(){this.interval=setInterval("jQuery.jGrowl.update()",this.defaults.check);$('body').append('<div id="jGrowl"></div>');},shutdown:function(){clearInterval(this.interval);$('div#jGrowl').remove();}});})(jQuery);