/*
 * jQuery Alvaro's Slider Text 1.0
 *
 * Copyright (c) 2010 Alvaro Véliz Marín - yo@alvaroveliz.cl
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * More info in http://alvaroveliz.cl/aSliderText/
 */
(function($){
 	$.fn.extend({ 
 		aSliderText: function(options) {
			var defaults = {
				updateTime: 6000,
				height: 0,
				element: 'li'
			} 			
			var options = $.extend(defaults, options);

    	return this.each(function() {
				var o = options;  
				var obj = $(this);

				if (o.height > 0) {
					obj.css('height', o.height).css('overflow', 'hidden');
				}
				
	 			var updateSlider = function() {
					obj.prepend('<'+o.element+'>' + $(o.element+':last', obj).html() + '</'+o.element+'>');
					$(o.element + ':first-child', obj).hide().fadeIn('slow');
					$(o.element + ':last', obj).remove();
	 			};
	 			
				window.setInterval(updateSlider, options.updateTime);
    	});
    	
    }
	});
})(jQuery);

