jQuery(document).ready(function() {
	
	var ali_quote_current = 0;
	var ali_quote_delay = 8000;
	var ali_quote_count = jQuery('#ali-quotes li').length;
	
	//APPEND PROPER HTML ENTITIES FOR QUOTES
	jQuery('#ali-quotes li').prepend("&ldquo;").append("&rdquo;");
	
	//CYCLE THROUGH ALL THE LI ELEMENTS, SETTING EACH ONE AS 'CURRENT' FOR ali_quote_delay MILLISECONDS
	var ali_quote_cycle = setInterval(function() {
		ali_quote_current = (ali_quote_current < ali_quote_count-1)
						? ali_quote_current + 1
						: 0;
		//console.log(ali_quote_current);
		jQuery('#ali-quotes li:eq('+ali_quote_current+')').trigger('ali-cycle');
	}, ali_quote_delay);
	
	//FADE OUT ALL LI ELEMENTS, FADE IN THE CURRENT LI ELEMENT
	jQuery('#ali-quotes li').bind('ali-cycle', function(event) {
		jQuery('#ali-quotes li').not(jQuery(this)).fadeOut('slow');
		jQuery(this).fadeIn('slow');
	});
	
	//FADE IN THE FIRST LI ELEMENT ON READY
	jQuery('#ali-quotes li:eq(0)').trigger('ali-cycle');

});
