var toggler=new Class({initialize:function(b,c,d){this.setOptions({open:'first',allowMultipleOpen:false,fade:false,fadeDuration:600,transition:Fx.Transitions.linear,duration:400},d);this.togglers=b;this.elements=c;this.elementFx=[];this.elementVisible=[];this.togglers.each(function(a,i){a.addEvent('click',function(){this.toggleSection(i)}.bind(this))},this);this.elements.each(function(a,i){this.elementFx[i]=new Fx.Slide(a,this.options);if(!(this.options.allowMultipleOpen&&this.options.open=='all'))this.hide(i)},this);if(this.options.open=='first')(function(){this.slideIn(0)}).delay(1,this)},toggleSection:function(b){if(!this.options.allowMultipleOpen){this.elements.each(function(a,i){if(this.elementVisible[i]&&i!=b)this.slideOut(i)},this)}this.toggle(b)},toggle:function(i){this.elementFx[i].toggle().chain(function(){this.elementVisible[i]=(this.elementVisible[i]+1)%2}.bind(this));if(this.options.fade)this.fade(i)},slideIn:function(i){this.elementFx[i].slideIn().chain(function(){this.elementVisible[i]=1}.bind(this));if(this.options.fade)this.fade(i)},slideOut:function(i){this.elementFx[i].slideOut().chain(function(){this.elementVisible[i]=0}.bind(this));if(this.options.fade)this.fade(i)},show:function(i){this.elementVisible[i]=1;this.elementFx[i].show()},hide:function(i){this.elementVisible[i]=0;this.elementFx[i].hide()},fade:function(i){var a=new Fx.Styles(this.elements[i],{'duration':this.options.fadeDuration,'wait':false});a.start({'opacity':[this.elementVisible[i],(this.elementVisible[i]+1)%2]})}});toggler.implement(new Options);
