(function(){var hideTheseOf=function(object){var hideThese=object.options.hideInputs;if(window.OverText){var otClasses=[null];OverText.each(function(ot){otClasses.include("."+ot.options.labelClass)});if(otClasses){hideThese+=otClasses.join(", ")}}return(hideThese)?object.element.getElements(hideThese):null};Fx.Reveal=new Class({Extends:Fx.Morph,options:{link:"cancel",styles:["padding","border","margin"],transitionOpacity:!Browser.ie6,mode:"vertical",display:function(){return this.element.get("tag")!="tr"?"block":"table-row"},opacity:1,hideInputs:Browser.ie?"select, input, textarea, object, embed":null},dissolve:function(){if(!this.hiding&&!this.showing){if(this.element.getStyle("display")!="none"){this.hiding=true;this.showing=false;this.hidden=true;this.cssText=this.element.style.cssText;var startStyles=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode});if(this.options.transitionOpacity){startStyles.opacity=this.options.opacity}var zero={};Object.each(startStyles,function(style,name){zero[name]=[style,0]});this.element.setStyles({display:Function.from(this.options.display).call(this),overflow:"hidden"});var hideThese=hideTheseOf(this);if(hideThese){hideThese.setStyle("visibility","hidden")}this.$chain.unshift(function(){if(this.hidden){this.hiding=false;this.element.style.cssText=this.cssText;this.element.setStyle("display","none");if(hideThese){hideThese.setStyle("visibility","visible")}}this.fireEvent("hide",this.element);this.callChain()}.bind(this));this.start(zero)}else{this.callChain.delay(10,this);this.fireEvent("complete",this.element);this.fireEvent("hide",this.element)}}else{if(this.options.link=="chain"){this.chain(this.dissolve.bind(this))}else{if(this.options.link=="cancel"&&!this.hiding){this.cancel();this.dissolve()}}}return this},reveal:function(){if(!this.showing&&!this.hiding){if(this.element.getStyle("display")=="none"){this.hiding=false;this.showing=true;this.hidden=false;this.cssText=this.element.style.cssText;var startStyles;this.element.measure(function(){startStyles=this.element.getComputedSize({styles:this.options.styles,mode:this.options.mode})}.bind(this));if(this.options.heightOverride!=null){startStyles.height=this.options.heightOverride.toInt()}if(this.options.widthOverride!=null){startStyles.width=this.options.widthOverride.toInt()}if(this.options.transitionOpacity){this.element.setStyle("opacity",0);startStyles.opacity=this.options.opacity}var zero={height:0,display:Function.from(this.options.display).call(this)};Object.each(startStyles,function(style,name){zero[name]=0});zero.overflow="hidden";this.element.setStyles(zero);var hideThese=hideTheseOf(this);if(hideThese){hideThese.setStyle("visibility","hidden")}this.$chain.unshift(function(){this.element.style.cssText=this.cssText;this.element.setStyle("display",Function.from(this.options.display).call(this));if(!this.hidden){this.showing=false}if(hideThese){hideThese.setStyle("visibility","visible")}this.callChain();this.fireEvent("show",this.element)}.bind(this));this.start(startStyles)}else{this.callChain();this.fireEvent("complete",this.element);this.fireEvent("show",this.element)}}else{if(this.options.link=="chain"){this.chain(this.reveal.bind(this))}else{if(this.options.link=="cancel"&&!this.showing){this.cancel();this.reveal()}}}return this},toggle:function(){if(this.element.getStyle("display")=="none"){this.reveal()}else{this.dissolve()}return this},cancel:function(){this.parent.apply(this,arguments);if(this.cssText!=null){this.element.style.cssText=this.cssText}this.hiding=false;this.showing=false;return this}});Element.Properties.reveal={set:function(options){this.get("reveal").cancel().setOptions(options);return this},get:function(){var reveal=this.retrieve("reveal");if(!reveal){reveal=new Fx.Reveal(this);this.store("reveal",reveal)}return reveal}};Element.Properties.dissolve=Element.Properties.reveal;Element.implement({reveal:function(options){this.get("reveal").setOptions(options).reveal();return this},dissolve:function(options){this.get("reveal").setOptions(options).dissolve();return this},nix:function(options){var params=Array.link(arguments,{destroy:Type.isBoolean,options:Type.isObject});this.get("reveal").setOptions(options).dissolve().chain(function(){this[params.destroy?"destroy":"dispose"]()}.bind(this));return this},wink:function(){var params=Array.link(arguments,{duration:Type.isNumber,options:Type.isObject});var reveal=this.get("reveal").setOptions(params.options);reveal.reveal().chain(function(){(function(){reveal.dissolve()}).delay(params.duration||2000)})}})})();