(function($) {
	
	$.fn.slideshow = function(options) {
	
		var defaults = {
	    	fadePause: 5000,
	    	fadeDuration: 1000
	  	};
	  	
  		// Extend our default options with those provided.
  		var o = $.extend(defaults, options);
				
		return $.each( this, function() {
			var first = $(this).children(':first')
			var current = first;
			var next = current.next();
			
			rotate = function () {
				current.fadeOut(o.fadeDuration, function() {
					next.fadeIn(o.fadeDuration, function() {
						current = next;
						next = next.next().length > 0 ? next.next() : first;
					});
				});
			}
			
			setInterval( 'rotate()', o.fadePause );
			
		});
		
	};

})(jQuery);
