﻿    var cou;
    var rolldirection;
    var divSmallImgpan;
    var coui=0;
    //小图片面板开始移动
    function SmallImgRoll(direction)
    {
        divSmallImgpan=document.getElementById("testDiv");
        rolldirection=direction;
        if(cou==null)
        {
            coui=0;
            cou=setInterval(deltamove,1);
        }
    }
    
    //小图片面板差量移动
    function deltamove()
    {
        coui++;
        if(rolldirection=="left")
        { 
            if((0-divSmallImgpan.offsetLeft+320)<divSmallImgpan.offsetWidth)
            {
                if(coui<10&&coui==1)
                {
                    divSmallImgpan.style.left=divSmallImgpan.offsetLeft-320+'px';
                    divSmallImgpan.style.left=divSmallImgpan.offsetLeft+(0-divSmallImgpan.offsetLeft)%64+'px';
                } 
                if(coui>10)
                {
                    
                    divSmallImgpan.style.left=divSmallImgpan.offsetLeft-8+'px';
                }
            }
            else
            {
                clearInterval(cou);
                cou=null;
                coui=0;
            }
        }
        if(rolldirection=="right")
        {
            if(divSmallImgpan.offsetLeft<0)
            {
                if(coui<10&&coui==1)
                {
                    divSmallImgpan.style.left=divSmallImgpan.offsetLeft+320+'px';
                    divSmallImgpan.style.left=divSmallImgpan.offsetLeft+(0-divSmallImgpan.offsetLeft)%64+'px';
                }
                if(coui>10)
                {
                    divSmallImgpan.style.left=divSmallImgpan.offsetLeft+8+'px';
                }
            }
            else
            {
                clearInterval(cou);
                cou=null;
                divSmallImgpan.style.left=0+'px';
                coui=0;
            }
        }
    }
    
    //结束滚动
    function finishedRoll()
    {
         clearInterval(cou);
         cou=null;
         coui=0;
    }
