(function(){
	var tiempo_fade=2000;
	var tiempo_intervalo=7000;
	var elementos=[];
	var k=0;
	var num_elementos=0;
	function init(){
		$$('.fade div').each(function(el){
			el.fade=new Fx.Style(el, 'opacity',{duration:tiempo_fade});
			if(num_elementos>0){
				el.fade.set(0);
				el.style.display='none';
			}
			elementos.push(el);
			num_elementos++;
		});
		if(num_elementos<2) return;
		setInterval(function(){
			elementos[k].fade.start(1,0);
			k=(k+1)%num_elementos;
			setTimeout(function(){
				elementos[(k+num_elementos-1)%num_elementos].style.display='none';
				elementos[k].style.display='block';
				elementos[k].fade.start(0,1);
			},tiempo_fade);
		},tiempo_intervalo);

	}
	window.addEvent('domready',init);
})();