/**
 * Freeow!
 * Stylish, Growl-like message boxes
 * Copyright (c) 2011 PJ Dietz
 * Version: 1.0.0
 * Licensed under the MIT license:
 * http://www.opensource.org/licenses/mit-license.php
 * http://pjdietz.com/jquery-plugins/freeow/
 */
(function($){"use strict";var Freeow;Freeow=function(title,message,options){var startStyle,i,u;this.options=$.extend({},$.fn.freeow.defaults,options);this.element=$(this.options.template(title,message,this.options.icon));if(this.options.startStyle){startStyle=this.options.startStyle}else{startStyle=this.options.hideStyle}this.element.css(startStyle);this.element.data("freeow",this);for(i=0,u=this.options.classes.length;i<u;i+=1){this.element.addClass(this.options.classes[i])}this.element.click(this.options.onClick);this.element.hover(this.options.onHover);this.autoHide=false};Freeow.prototype={attach:function(container){$(container).prepend(this.element);this.show()},show:function(){var opts,self,fn,delay;opts={duration:this.showDuration};if(this.options.autoHide&&this.options.autoHideDelay>0){this.autoHide=true;self=this;delay=this.options.autoHideDelay;fn=function(){if(self.autoHide){self.hide()}};opts.complete=function(){setTimeout(fn,delay)}}this.element.animate(this.options.showStyle,opts)},hide:function(){var self=this;this.element.animate(this.options.hideStyle,{duration:this.options.hideDuration,complete:function(){self.destroy()}})},destroy:function(){this.element.data("freeow",undefined);this.element.remove()}};if(typeof $.fn.freeow==="undefined"){$.fn.extend({freeow:function(title,message,options){return this.each(function(){var f;f=new Freeow(title,message,options);f.attach(this)})}});$.fn.freeow.defaults={autoHide:true,autoHideDelay:3000,classes:[],startStyle:null,showStyle:{opacity:1.0},showDuration:250,hideStyle:{opacity:0.0},hideDuration:500,icon:null,onClick:function(event){$(this).data("freeow").hide()},onHover:function(event){$(this).data("freeow").autoHide=false},template:function(title,message,icon){var e;var img=icon==null?"xxx":"<td class='icon'><img src='"+icon+"' alt=''/></td>";e=['<div>','<div class="background">','<div class="content">','<table class="tableFullFlat"><tr>',img+'<td><div class="title">'+title+'</div><div class="message">'+message+'</div></td>','</tr></table>','</div>','</div>','</div>'].join("");return e}}}}(jQuery));
