var indiceTmp=0;

window.addEvent('domready', function () {
		
		var duration = 300,
		
			links = $$('div.tabs a'),
			
			tab = new Carousel({
				container: 'slide',
				scroll: 1,
				circular: true,
				current: 2,
				/* mode: 'horizontal', */
				onChange: function (index) {
					tmp = document.getElementById("thumb"+(index+1));
					selectThumb(tmp);
					links.each(function (el, off) {
						el[off == index ? 'addClass' : 'removeClass']('selected')
					})
				},
				fx: {
					duration: duration
				}
			}),
			
			pe = new PeriodicalExecuter(function () {
				tab.move((tab.first() + 1) % 5)
			}, duration / 1000 + 5);
			
			[links.shift(), links.pop()].map(function (el, index) {
				el.addEvent('click', function (e) {
				
					e.stop();
					pe.stop();
					
					tab.move(tab.first() + (index == 0 ? -1 : 1) * tab.options.scroll);
					(function () { pe.registerCallback() }).delay(2 * duration)
				})
			});
		
		links.each(function (el, index) {
			el.addEvent('click', function (e) {
				
				e.stop();
				pe.stop();
				
				tab.move(index);
				(function () { pe.registerCallback() }).delay(2 * duration)
			})
		})
		
		<!-- -->
		var contenedor = $('slide');
		contenedor.addEvents({'mouseover': function(){
				<!--pe.stop();-->
			},'mouseout': function(){
				<!--tab.move(indiceTmp);-->
				<!--(function () { pe.registerCallback() }).delay(2 * duration)-->
			}
		});
		<!-- -->
		
	})
