// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

Event.observe(window, 'load', function() {
	$('quotes').childElements().invoke('hide');
	new Effect.Appear($('quotes').down(), {queue: 'end'});
	new PeriodicalExecuter(next_quote, 12);
});

function next_quote() {
	var current_quote = $('quotes').down();
	var next_quote = current_quote.next();
	// hide first child
	new Effect.Fade(current_quote, {queue: 'end', afterFinish: function() {
		$('quotes').insert(current_quote.remove());
	}});
	// reveal next child
	new Effect.Appear(next_quote, {queue: 'end'});
}