jQuery(document).ready(function(a){Gritter={fade_speed:2e3,timer_stay:6e3,_custom_timer:0,_item_count:0,_tpl_close:'<div class="gritter-close"></div>',_tpl_item:'<div id="gritter-item-[[number]]" class="gritter-item-wrapper" style="display:none"><div class="gritter-top"></div><div class="gritter-item">[[image]]<div class="[[class_name]]"><span class="gritter-title">[[username]]</span><p>[[text]]</p></div><div style="clear:both"></div></div><div class="gritter-bottom"></div></div>',_tpl_wrap:'<div id="gritter-notice-wrapper"></div>',add:function(k,j,d,c,g){this.verifyWrapper();var f=this._tpl_item;this._item_count++;this._custom_timer=0;if(g)this._custom_timer=g;var i=d!=""?'<img src="'+d+'" class="gritter-image" />':"",h=d!=""?"gritter-with-image":"gritter-without-image";f=this.str_replace(["[[username]]","[[text]]","[[image]]","[[number]]","[[class_name]]"],[k,j,i,this._item_count,h],f);a("#gritter-notice-wrapper").append(f);var e=a("#gritter-item-"+this._item_count),b=this._item_count;e.fadeIn();!c&&this.setFadeTimer(e,b);a(e).hover(function(){!c&&Gritter.restoreItemIfFading(this,b);Gritter.hoveringItem(this)},function(){!c&&Gritter.setFadeTimer(this,b);Gritter.unhoveringItem(this)});return b},countRemoveWrapper:function(){a(".gritter-item-wrapper").length==0&&a("#gritter-notice-wrapper").remove()},fade:function(b){a(b).animate({opacity:0},Gritter.fade_speed,function(){a(b).animate({height:0},300,function(){a(b).remove();Gritter.countRemoveWrapper()})})},hoveringItem:function(b){a(b).addClass("hover");if(a(b).find("img").length)a(b).find("img").before(this._tpl_close);else a(b).find("span").before(this._tpl_close);a(b).find(".gritter-close").click(function(){Gritter.remove(this)})},remove:function(b){a(b).parents(".gritter-item-wrapper").fadeOut("medium",function(){a(this).remove()});this.countRemoveWrapper()},removeSpecific:function(e,b){var d=a("#gritter-item-"+e);if(typeof b==="object"){if(b.fade){var c=this.fade_speed;if(b.speed)c=b.speed;d.fadeOut(c)}}else d.remove();this.countRemoveWrapper()},restoreItemIfFading:function(c,b){window.clearTimeout(Gritter["_int_id_"+b]);a(c).stop().css({opacity:1})},setFadeTimer:function(c,b){var a=this._custom_timer?this._custom_timer:this.timer_stay;Gritter["_int_id_"+b]=window.setTimeout(function(){Gritter.fade(c)},a)},stop:function(){a("#gritter-notice-wrapper").fadeOut(function(){a(this).remove()})},str_replace:function(m,k,l,d){var b=0,c=0,e="",h="",j=0,i=0,g=[].concat(m),f=[].concat(k),a=l,n=f instanceof Array,o=a instanceof Array;a=[].concat(a);if(d)this.window[d]=0;for(b=0,j=a.length;b<j;b++){if(a[b]==="")continue;for(c=0,i=g.length;c<i;c++){e=a[b]+"";h=n?f[c]!==undefined?f[c]:"":f[0];a[b]=e.split(g[c]).join(h);if(d&&a[b]!==e)this.window[d]+=(e.length-a[b].length)/g[c].length}}return o?a:a[0]},unhoveringItem:function(b){a(b).removeClass("hover");a(b).find(".gritter-close").remove()},verifyWrapper:function(){a("#gritter-notice-wrapper").length==0&&a("body").append(this._tpl_wrap)}};a.gritter={};a.gritter.add=function(a){try{if(!a.title||!a.text)throw"Missing_Fields";}catch(c){c=="Missing_Fields"&&alert('Gritter Error: You need to fill out the first 2 params: "title" and "text"')}var b=Gritter.add(a.title,a.text,a.image||"",a.sticky||false,a.time||"");return b};a.gritter.remove=function(b,a){Gritter.removeSpecific(b,a||"")};a.gritter.removeAll=function(){Gritter.stop()}});
