(function($) {
	$.fn.liScroll = function(config) { // {{{
		config = $.extend({
			travelocity: 0.07
		}, config);
		return this.each(function() {
			var t = $(this);
			t.addClass("newsticker")
			var m = t.wrap("<div class='mask'></div>");
			var c = t.parent().wrap("<div class='tickercontainer'></div>");
			var containerWidth = c.width();
			var stripWidth = 0;
			t.find("li").hide().each(function(i, val) {
				var v = $(val).show();
				stripWidth += v.width();
				v.hide();
			});
			t.find("li").show()
			t.width(stripWidth);
			var defTiming = stripWidth / config.travelocity;
			var totalTravel = stripWidth + containerWidth;
			function scrollnews(spazio, tempo){
				t.animate({left: '-='+ spazio}, tempo, "linear", function() {
					t.css("left", containerWidth);
					scrollnews(totalTravel, defTiming);
				});
			}
			scrollnews(totalTravel, defTiming);
			t.hover(
				function() {
					$(this).stop();
				},
				function() {
					var offset = $(this).offset();
					var residualSpace = offset.left + stripWidth;
					var residualTime = residualSpace / config.travelocity;
					scrollnews(residualSpace, residualTime);
				}
			);
		});
	};
})(jQuery);