(function($)
{
	$.fn.scroller = function(speed)
	{
		var el = $(this).get(0);
		var $el = $(el);
		$el.css('overflow', 'hidden');
		var view_width = $el.width();
		var content_width = el.scrollWidth;
		if (content_width <= view_width)
			return this;
		$el.append($el.html());
		var double_content_width = el.scrollWidth;
		var duration = content_width * 1000 / speed;
		function action()
		{
			$el.animate({scrollLeft: double_content_width/2}, duration, 'linear', function()
			{
				$el.scrollLeft(0);
				action();
			});
		}
		action();
	};
})(jQuery);

