var Quotes = {
	
	init: function(){
		var quotes = $$('#testimonial > div').shuffle().hide();
		
		if (quotes.length == 0) return;
		
		quotes.set('tween', {
			duration: 500,
			transition: Fx.Transitions.Sine.easeOut
		}).each(function(el, i){
			if (i > 0) el.setStyle('top', -200).show();
		});
			
		quotes[window.testimonial = 0].show();

		var interval = window.setInterval(function(){
			Quotes.hide(quotes[window.testimonial]);
			Quotes.show(Quotes.getNext(quotes));
		}, 5000);
	},
	
	show: function(el){
		el.tween('top', [-200, 0]);
	},
	
	hide: function(el){
		el.tween('top', [0, 200]);
	},
	
	getNext: function(quotes){
		if (window.testimonial < (quotes.length - 1)) window.testimonial++; else window.testimonial = 0;
		
		return quotes[window.testimonial];
	}
	
}

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