(function($){
	$.fn.ticker = function(options){
		var defaults = {
			speed: 1
		};
		
		var options = $.extend(defaults, options);
		
		var el, firstHeight, intervalId;
		
		var rollCurrent = function(){
			var ul = el.children("ul");
			var top = parseInt(ul.css("top")) - options.speed;
			if (firstHeight + top > 0){
				ul.css("top", top + "px");
			} else {
				ul.css({top: 0}).children("li:first").remove();
				nextOne();
			}
			intervalId = setTimeout(rollCurrent, 50);
		};
		
		var nextOne = function(){
			var firstli = el.children("ul").children("li:first");
			firstHeight = firstli.height();
			firstli.clone(true).appendTo(el.children("ul"));
		}
		
		return this.each(function(){
			el = $(this);
			el.css("position", "relative").children("ul").css("position", "absolute");
			if ( el.height() < el.children("ul").height() ){
				el.children("ul").hover(
					function(){
						clearInterval(intervalId);
					},
					rollCurrent
				);
				nextOne();
				rollCurrent();
			}
		});
	};
})(jQuery);
