var ImageMenu=new Class({getOptions:function(){return{onOpen:false,onClose:Class.empty,openWidth:50,transition:Fx.Transitions.sine,duration:250,open:1,border:0}},initialize:function(c,b,a){this.setOptions(this.getOptions(),a);this.elements=$$(c);this.rollelements=$$(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.widths.openOthers=0;this.fx=new Fx.Elements(this.elements,{wait:false,duration:this.options.duration,transition:this.options.transition});this.elements.each(function(e,d){this.rollelements[d].addEvent("mouseenter",function(g){new Event(g).stop();this.reset(d)}.bind(this));e.addEvent("mouseenter",function(g){new Event(g).stop();this.reset(d)}.bind(this));this.rollelements[d].addEvent("mouseleave",function(g){new Event(g).stop();this.reset(0)}.bind(this));var f=this;e.addEvent("click",function(g){if(f.options.onOpen){new Event(g).stop();if(f.options.open==d){f.options.open=null;f.options.onClose(this.href,d)}else{f.options.open=d;f.options.onOpen(this.href,d)}}})}.bind(this));if(this.options.open){if($type(this.options.open)=="number"){this.reset(0)}else{this.elements.each(function(e,d){if(e.id==this.options.open){this.reset(0)}},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}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);
