/*
 *
 */

(function($){
 
    //Attach this new method to jQuery
    $.fn.extend({ 
         
        //Defines plugin's name and functions
        scrollVert: function(options) {
     	 
    		//Initialization
	        var defaults = {
	            animation: "slow",
	            time: 4,
				size: $(this).children().size(),
				start: 1,
	        };
			
			var options = $.extend(defaults, options);
			
			return this.each(function() {
				var animationSpeed = options.animation;
	            var animationTime = options.time*1E3;
				
				var obj=$(this);
				var enitPos=obj.position().top-6;
				var movBy = obj.children(":first").height()+6;
				obj.children(":first").clone().appendTo(obj);
				//$(this).animate({top: '-='+movBy},1000,'linear');
				(function moveLi() {
					setTimeout(function(){
						if(obj.position().top>(24-obj.height())){
							obj.animate({top: '-='+movBy},animationSpeed,'linear');
							moveLi();
						}else{
							obj.css('top',enitPos);
							obj.animate({top: '-='+movBy},animationSpeed,'linear');
							moveLi();
						}
					}, animationTime );
					})();
			});
		}
	});
    
})(jQuery);
