var ImageMenu=new Class({getOptions:function(){return{onOpen:false,onClose:Class.empty,openWidth:160,transition:Fx.Transitions.quadOut,duration:400,open:null,border:0}},initialize:function(b,a){this.setOptions(this.getOptions(),a);this.elements=$$(b);this.widths={};this.widths.closed=this.elements[0].getStyle("height").toInt();this.widths.openSelected=this.options.openWidth;this.widths.openOthers=Math.round(((this.widths.closed*this.elements.length)-(this.widths.openSelected+this.options.border))/(this.elements.length-1));this.fx=new Fx.Elements(this.elements,{wait:false,duration:this.options.duration,transition:this.options.transition});this.elements.each(function(d,c){d.addEvent("mouseenter",function(f){new Event(f).stop();this.reset(c)}.bind(this));d.addEvent("mouseleave",function(f){new Event(f).stop();this.reset(this.options.open)}.bind(this));var e=this;d.addEvent("click",function(f){if(e.options.onOpen){new Event(f).stop();if(e.options.open==c){e.options.open=null;e.options.onClose(this.href,c)}else{e.options.open=c;e.options.onOpen(this.href,c)}}})}.bind(this));if(this.options.open){if($type(this.options.open)=="number"){this.reset(this.options.open)}else{this.elements.each(function(d,c){if(d.id==this.options.open){this.reset(c)}},this)}}},reset:function(a){if($type(a)=="number"){var b=this.widths.openOthers;if(a+1==this.elements.length){b+=this.options.border}}else{var b=this.widths.closed}var c={};this.elements.each(function(f,e){var d=b;if(e==this.elements.length-1){d=b+5}c[e]={height:d}}.bind(this));if($type(a)=="number"){c[a]={height:this.widths.openSelected}}this.fx.start(c)}});ImageMenu.implement(new Options);ImageMenu.implement(new Events);