var jezFxStyle={initialize:function(element,options,switcher){this.setOptions({addEventHandler:true,activateOn:'mouseenter',deactivateOn:'mouseleave',preset:'inactive',activeCss:{},inactiveCss:{},activeFx:{},inactiveFx:{}},options);this.element=$(element);if(this.element){this.switcher=$(switcher);if(!this.switcher)
this.switcher=this.element;this.construct();}},construct:function(){if(this.options.addEventHandler){if(this.options.activateOn==this.options.deactivateOn){this.active=this.options.preset=='active'?true:false;this.switcher.addEvent(this.options.activateOn,function(){if(this.active){this.deactivate();this.active=false;}else{this.activate();this.active=true;}}.bind(this));}else{this.switcher.addEvent(this.options.activateOn,function(){this.activate();}.bind(this));this.switcher.addEvent(this.options.deactivateOn,function(){this.deactivate();}.bind(this));}}
this.fxStyles=new Fx.Styles(this.element,{});this.set(this.options.preset);this.fxStyles.options.extend=$extend;},set:function(state){if(state=='active'){this.fireEvent('onActivate');this.fxStyles.set(this.options.activeCss);this.fireEvent('onActivated');}else{this.fireEvent('onDeactivate');this.fxStyles.set(this.options.inactiveCss);this.fireEvent('onDeactivated');}},activate:function(){this.fireEvent('onActivate');this.fxStyles.options.extend(this.options.activeFx);this.fxStyles.stop().start(this.options.activeCss);this.fireEvent('onActivated',null,this.fxStyles.options.duration);return this.fxStyles;},deactivate:function(){this.fireEvent('onDeactivate');this.fxStyles.options.extend(this.options.inactiveFx);this.fxStyles.stop().start(this.options.inactiveCss);this.fireEvent('onDeactivated',null,this.fxStyles.options.duration);return this.fxStyles;}}
jezFxStyle=new Class(jezFxStyle);jezFxStyle.implement(new Options,new Events);jezFxStyles=new Class({initialize:function(elements,options,separated,switchers){this.options=options;this.separated=separated?true:false;this.switchers=switchers;this.objects=[];this.last=0;elements.each(function(e,i){var option,switcher;if(this.separated){if($defined(this.options[i])){option=this.options[i];this.last=i;}else
option=this.options[this.last];if(!$defined(this.switchers[i])){option.addEventHandler=false;switcher=null;}else
switcher=this.switchers[i];this.objects.extend([new jezFxStyle(e,option,switcher)]);}else
this.objects.extend([new jezFxStyle(e,this.options)]);},this);},item:function(i){return this.objects[i];}});jezFxTransInit=new Abstract({fade:function(els,duration){var objs=new jezFxStyles(els,{addEventHandler:false,activateOn:null,deactivateOn:null,preset:'inactive',activeCss:{'opacity':1},inactiveCss:{'opacity':0},activeFx:{'transition':Fx.Transitions.linear,'duration':duration},inactiveFx:{'transition':Fx.Transitions.linear,'duration':duration},onActivate:function(){this.element.setStyle('display','block');},onDeactivated:function(){this.element.setStyle('display','none');}});return objs;},crossfade:function(els,duration){return jezFxTransInit.fade(els,duration);},fadebg:function(els,duration){return jezFxTransInit.fade(els,duration);},accordion:function(els,duration){var switchers=[],options=[];for(var i=0;i<els.length;i++){els[i].addClass('accordion');switchers[i]=els[i].getFirst();if(!(/h[1-6]/.test(switchers[i].getTag()))){while(switchers[i].getNext()){if(/h[1-6]/.test(switchers[i].getTag()))
break;}}
if(!(/h[1-6]/.test(switchers[i].getTag())))
switchers[i]=new Element('h3',{'class':'switcher'}).setHTML('&nbsp;').injectTop(els[i]);else
switchers[i].addClass('switcher');if(els[i].getStyle('position')=='absolute')
els[i].setStyle('position','relative');options[i]={addEventHandler:true,activateOn:'click',deactivateOn:'click',preset:'inactive',activeCss:{'height':els[i].offsetHeight},inactiveCss:{'height':switchers[i].offsetHeight},activeFx:{'transition':Fx.Transitions.expoIn,'duration':duration},inactiveFx:{'transition':Fx.Transitions.expoOut,'duration':duration},onActivated:function(){this.switcher.addClass('active');this.element.setStyle('opacity',1);},onDeactivated:function(){this.switcher.removeClass('active');this.element.setStyles({'opacity':1,'overflow':'hidden'});}}}
var objs=new jezFxStyles(els,options,true,switchers);return objs;}});jezFxTransProcess=new Abstract({fade:function(oldFx,newFx){newFx.set('active');return oldFx.deactivate();},crossfade:function(oldFx,newFx){oldFx.deactivate();return newFx.activate();},fadebg:function(oldFx,newFx){return oldFx.deactivate().chain(newFx.activate.bind(newFx));},accordion:function(oldFx,newFx){return jezFxTransProcess.crossfade(oldFx,newFx);}});