(function($) {
	$.fn.carousel = function() {
		return this.each(function() {

			// grab all <li>s in the carousel and hide all but the first
			var $carousel = $('>li', this).hide();
			// set $current to the first li and fade it in
			var $current = $carousel.filter(':first').fadeIn();

			// the main function
			crossfade = function() {
				$current.fadeOut(1000);
				$current = ($current.next('li').length === 0) ? $carousel.filter(':first') : $current.next('li');
				$current.fadeIn(1000);
			};

			// start the carousel for the first time
			if ($carousel.length > 1) timer = setInterval(crossfade, 7500);
		});
	};
})(jQuery);

$(function() {
	$('#carousel ul').carousel();
});
