var Banners = new Class({

	options: {
		interval: 10
	},
	
	initialize: function()
	{
		this.container = $('banners');
		//this.wrapper = $('banners').getElement('wrapper');
		this.items = this.container.getElements('.item');
		this.current = 0;
		
		this.items.each(function(el){
			el.setStyle('opacity', 0).set('tween', {transition: Fx.Transitions.Cubic.easeOut});
		});
		
		this.items[0].tween('opacity', 1);
		
		this.rotate.periodical(this.options.interval * 1000, this);
	},
	
	rotate: function()
	{
		var current = this.items[this.current];
		if(this.current == this.items.length - 1) this.current = -1;
		this.current++;
		var next = this.items[this.current].setStyles({'top': -464, 'opacity': 1});
		next.getElement('.info').setStyles({'right': 150, 'opacity': 0}).morph.delay(400, next.getElement('.info'), [{'right': 0, 'opacity': 1}]);
		
		current.tween('top', 464);
		next.tween('top', 0);
	}
	
});
