var ImageMenu=new Class({getOptions:function(){
return {onOpen:false,onClose:Class.empty,openWidth:100,transition:Fx.Transitions.quadOut,duration:400,open:null,border:0};
},initialize:function(_1,_2){
this.setOptions(this.getOptions(),_2);
this.elements=$$(_1);
this.widths={};
this.widths.closed=this.elements[0].getStyle("width").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(el,i){
el.addEvent("mouseenter",function(e){
new Event(e).stop();
this.reset(i);
}.bind(this));
el.addEvent("mouseleave",function(e){
new Event(e).stop();
this.reset(this.options.open);
}.bind(this));
var _7=this;
el.addEvent("click",function(e){
if(_7.options.onOpen){
new Event(e).stop();
if(_7.options.open==i){
_7.options.open=null;
_7.options.onClose(this.href,this.rel,i);
}else{
_7.options.open=i;
_7.options.onOpen(this.href,this.rel,i);
}
}
});
}.bind(this));
if(this.options.open){
if($type(this.options.open)!="null"){
this.reset(this.options.open);
this.reset(i);
}else{
this.elements.each(function(el,i){
if(el.id==this.options.open){
this.reset(i);
}
},this);
}
}
},reset:function(_b){
if($type(_b)=="number"){
var _c=this.widths.openOthers;
if(_b+1==this.elements.length){
_c+=this.options.border;
}
}else{
var _c=this.widths.closed;
}
var _d={};
this.elements.each(function(el,i){
var w=_c;
if(i==this.elements.length-1){
w=_c+5;
}
_d[i]={"width":w};
}.bind(this));
if($type(_b)=="number"){
_d[_b]={"width":this.widths.openSelected};
}
this.fx.start(_d);
}});
ImageMenu.implement(new Options);
ImageMenu.implement(new Events);

