/*********************************************************

ULTicker
 by AGT of Toucan Internet LLP
 andrew@toucanweb.co.uk

A simple jQuery plugin to vertically 
 scroll LIs inside a given UL.
 
Options:
 - items: 	the number of items to show at a time
 			Default: 3
 - speed: 	the frequency of changing items
 			Default: 5000

************************************************************/

(function($){
	$.fn.ULTicker = function(options){
	
		var defaults = {
			items:3,
			speed:5000
		};
		
		var options = $.extend(defaults, options);
		
		return this.each(function(){
			var ul = $(this);
			var LIs = ul.children();
			
			if(LIs.length<=options.items) {
				options.items = LIs.length-1;
			}
			
			if(options.items > 0) {
				LIs.not('li:lt(' + options.items + ')').hide(0);
				
				setInterval(function(){
					$('li:first', ul).fadeOut('slow', function(e) {	
						$('li:last', ul).hide(0);
						$(this).remove().appendTo(ul);
						$('li:eq(' + (options.items-1) + ')', ul).fadeIn('slow');
					});	
				}, options.speed);
			}
		});
	};
})(jQuery);

