// -----------------------------------------------------------------------------------
//
// HideThisMessage v1.2
// http://travisjbeck.com/blog/javascript/mootools-hidethismessage-plugin/
// by Travis Beck - http://travisjbeck.com
// Last Modification: 10/09/08
//
//
// Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
//    - Free for use in both personal and commercial projects
//    - Attribution requires leaving author name, author link, and the license info intact.
//	
// Requires MooTools v1.2 - with Hash.Cookie Plugin.(http://mootools.net/docs/Plugins/Hash.Cookie)
var HideThisMessage=new Class({Implements:[Options,Events],options:{elementClass:'hideWindow',hideBtnClass:'hideWindowBtn',animate:true},initialize:function(options){this.setOptions(options);this.options.els=$$('.'+this.options.elementClass);this.initCookie();var btn;var that=this;this.options.els.each(function(el){that.getState(el);btn=el.getElement('.'+that.options.hideBtnClass);btn.el=el;btn.addEvent('click',that.hideElement.bindWithEvent(that));});},initCookie:function(){this.options.cookieHash=new Hash.Cookie('cookieWindows',{duration:3600,path:'/'});},getState:function(el){var id=el.getProperty('id');if(this.options.cookieHash.get(id)){this.setClosed(el);}},setClosed:function(el){el.dispose();},hideElement:function(e){e.stop();var el=e.target.el;e.target.dispose();var id=el.getProperty('id');var ani;if(this.options.animate){el.style.overflow='hidden';ani=new Fx.Morph(el,{duration:300});ani.start({'height':0,'margin-top':0,'margin-bottom':0,'padding':0}).chain(function(){el.dispose();});}else{el.dispose();}
this.options.cookieHash.set(id,true);},reset:function(){this.options.cookieHash.empty();this.options.cookieHash.save();}});