function rotate(){

	// Hide the current screen (if any).
	if (current != null && current.css('display') == 'block'){
		$(current).fadeOut(function(){
			$('.stage1, .stage2, .stage3').hide();
		});
		setTimeout(rotate, 1500);
	}
	
	// Show the next screen.
	else {
		current = $('.screen:first').remove().appendTo('#rotator');
		
		// Reveal each stage in order after certain delays.
		current.show().find('.stage1').fadeIn();
		setTimeout(function(){current.find('.stage2').fadeIn();}, 2000);
		setTimeout(function(){current.find('.stage3').fadeIn();}, 3000);
		setTimeout(rotate, 15000);
	}
}

$(document).ready(function(){
	current = null;
	screens = $.makeArray($('.screen'));
	rotate();
});
