(function($) {
	
	$.fn.rotate = function(options) {
		var defaults = {
	    	interval : 6000,
	    	fadeIn : 500,
	    	fadeOut : 500
	  	};
	  	
  		// Extend our default options with those provided.
  		var o = $.extend(defaults, options);
  		
  		// Set-up targeted elements
  		var elements = $(this).children();
   		
  		elements.hide();
  		
  		var first = $(elements[0])
  		var current = first;
  		
  		current.show();
  		
  		// Begin rotation
  		setInterval(function(){  			
  			current.fadeOut(o.fadeIn, function() {			
				var next = current.next().length ? current.next() : first;
				
				next.fadeIn(o.fadeOut, function() {
					current = next;
				});
			});
  		}, o.interval);
	}
})(jQuery);
