var indexFader=new Class({Implements:[Options],options:{id:'inDex',divclass:'r',duration:1000,fadeduration:1000},initialize:function(options){this.setOptions(options);var op=this.options;var c=this;if($type($(op.id))=='element')op.delayid=c.startloop.periodical(op.duration,c)},startloop:function(){var op=this.options;var c=this;var children=$(op.id).getChildren('div');if(children[children.length-1].hasClass(op.divclass)){var tofade=children[children.length-1];var F=new Fx.Morph(tofade,{duration:op.fadeduration,onComplete:function(){tofade.inject(op.id,'top').setStyle('opacity',1)}}).start({'opacity':[1,0]})}}});


var ClickRotate=new Class({Implements:[Options],options:{stage:'slider-stage',sliders:'slider-list',next:'next',previous:'previous',autorotate:true,waittime:2000,returnrotate:true,returnafter:5000,returnid:null,intervalID:null},initialize:function(options){this.setOptions(options);var op=this.options;var f=this;if(op.autorotate)op.intervalID=this.autorotate.periodical(op.waittime,this);if($type($(op.next))=='element'){$(op.next).addEvent("click",function(e){e.stop();if($type(op.returnid)=='number')$clear(op.returnid);if($type(op.intervalID)=='number'){$clear(op.intervalID);if(op.returnrotate)op.returnid=f.autorotate.delay(op.returnafter,f)}var children=$(op.sliders).getChildren('li');children[0].set('tween',{onComplete:function(){children[0].inject($(op.sliders)).set('style','')}});children[0].tween('margin-left',-children[0].getSize().x)})}if($type($(op.previous))=='element'){$(op.previous).addEvent("click",function(e){e.stop();if($type(op.returnid)=='number')$clear(op.returnid);if($type(op.intervalID)=='number'){$clear(op.intervalID);if(op.returnrotate)op.returnid=f.autorotate.delay(op.returnafter,f)}var children=$(op.sliders).getChildren('li');var last=children.length-1;children[last].set('tween',{onComplete:function(){children[last].set('style','')}});children[last].setStyle('margin-left',-children[last].getSize().x).inject($(op.sliders),'top');children[last].tween('margin-left',0)})}},autorotate:function(){var op=this.options;if($type(op.returnid)=='number'){$clear(op.returnid);op.returnid=null;op.intervalID=this.autorotate.periodical(op.waittime,this)}var children=$(op.sliders).getChildren('li');children[0].set('tween',{onComplete:function(){children[0].inject($(op.sliders)).set('style','')}});children[0].tween('margin-left',-children[0].getSize().x)}});
window.addEvent("domready",function(){
	var c= new indexFader({id:'inDex',divclass:'r2',duration:20000});
	var d= new indexFader({id:'inDex',divclass:'r',duration:6000});
	var c= new indexFader({id:'inDex',divclass:'r3',duration:3000});
});
