jQuery(document).ready(function(){
    var moveStep=1;
    //滚动初始值
    var step=0;
    //是否需要滚动
    var canScroll=true;
    var $scroll=$("#scroll");
    //滚动框高度
    var containerHeight=$("#scroll").height();
    var actualHeight=0;
    var $li=$("#scroll div:first");
    var totalItems=$li.length;    
    var itemHeight=$li.eq(0).height();
    //滚动内容总高
    var actualHeight=totalItems*itemHeight;
    //内容框高度和滚动框高度的差值，用于重定位滚动内容
    var diff=actualHeight-containerHeight;
    //不需要滚动
    if(diff<=0){
       // canScroll=false;
    }

    function scroll(){
        if(step>actualHeight){
          step=1;    
        }
        step+=moveStep;    
        if(step<=0){
          step=actualHeight;
        }    
        $scroll.scrollTop(step);//jQuery1.2以上才支持scrollTop方法
    }
    var interval;
    if(canScroll){
        $("#scroll div").clone().appendTo("#scroll");
		  $("<br/>").appendTo("#scroll");
        interval=setInterval(scroll,100);
    }
    $scroll.hover(function(){
        clearInterval(interval);
    },function(){
        interval=setInterval(scroll,100);
    });

});