(function( $ ){
	$.fn.myScroll = function( options ) {  
		var settings = {
			'speed': 1
		};
		var $list = this;
		var offset = 0;
		var listpos = $list.offset();
		listpos = listpos.left;
		return this.each(function() {        
			// If options exist, lets merge them
			// with our default settings
			if ( options ) { 
				$.extend( settings, options );
			}
			// Tooltip plugin code here
			doScroll = function(offset) {
				var $liFirst = $list.find('li:first');
				var $liClone = $liFirst.clone(true);
				var first_w = parseInt($liFirst.width()+(offset));
				var speedindex = parseInt(first_w*20);
				$list.animate({marginLeft: '-=' + first_w}, parseInt(speedindex * settings.speed), 'linear', function() {
					$liFirst.remove();
					$list.css('margin-left', '0px');
					$liClone.appendTo(this);
					doScroll(0);
				});
			};

			$list.bind("mouseenter",function(){
				$list.stop();
			}).bind("mouseleave",function(){
				var position = $list.offset();
				doScroll(parseInt(position.left-listpos));
			});
			doScroll(0);
		});
	};
})( jQuery );
