

var Carousel = new Class({	
	initialize:function(container,slides,interval){
		this.container = $(container);
		this.slides = $$(slides);
		this.interval = interval;
		this.currentIndex = this.slides.length-1;
		this.addEvents();
		this.show(this.currentIndex);
		this.timer = this.showNext.periodical(this.interval, this);
	},	
	addEvents:function(){
		this.container.addEvent('mouseenter', function(event) {
			$clear(this.timer);
		}.bind(this));
		
		this.container.addEvent('mouseleave', function(event) {
			this.timer = this.showNext.periodical(this.interval, this);
		}.bind(this));	
	},	
	show:function(index){
		this.slides[this.currentIndex].fade(0);
		this.currentIndex = index;
		this.slides[this.currentIndex].fade(1);

	},	
	showNext:function(){
		if(this.currentIndex < this.slides.length-1 )
		{
			this.show(this.currentIndex+1);
		}
		else
		{
			this.show(0);
		}
	}
});
/*
window.addEvent('domready', function(){
// BOF domready	
var setBodyClass = function(newClass) {
	var bodyTag = $$('body')[0];
	bodyTag.removeClass(bodyTag.get('class'));
	bodyTag.addClass(newClass);
}
$$('ul.tabs li').each(function(el){

	el.addEvent('click', function(){
		setBodyClass(el.get('class'));  
	});

});


// EOF domready
});
*/