// jquery.creeping.js

(function($) {

	$.fn.creeping = function(o){
		var defaults = {
			delay	: 25000
		};
		var options = $.extend(defaults, o || {});
		return this.each(function(){
			var $this = $(this), $cont = $this.find('.js-container');
			var $width = $cont.find('.js-width'), w = $width.size() ? $width.width() : $cont.width();
			
			function _start(reset){
				if (!reset) reset = false;
				if (reset) $cont.css({'left':$this.width()+'px'});
				$cont.animate({'left':'-'+w+'px'}, options.delay, 'linear', function(){
					_start(true);
				});
			}
			
			$this.hover(function(){
				$cont.clearQueue().stop();
			},function(){
				_start();
			});
			
			_start(true);
		});
	}

})(jQuery);

