var scrollSpeed=2.5;

 

var isIE = document.all?true:false;

var left=-467;

var loop=null;

var mouseX=0;

 

function scrollImg()

{

            // get image width

            var imgWidth=document.getElementById('scrollingImg').offsetWidth;

 

            // get needed container dimensions

            var container=document.getElementById('scrollingImgContainer');

            var containerX=0;

            var containerWidth=container.offsetWidth;

            if (container.offsetParent)

                        do

                        {

                                    containerX += container.offsetLeft;

                        }

                        while (container = container.offsetParent);

            

            left+=scrollSpeed*(2*mouseX-2*containerX-containerWidth)/containerWidth;                        

            // bound checking

            if(left<-imgWidth+containerWidth)left=-imgWidth+containerWidth;

            if(left>0)left=0;    

            

            document.getElementById('scrollingImg').style.left=left+'px';

}

 

function getMouseX(e)

{

            mouseX=isIE?event.clientX + document.body.scrollLeft:e.pageX;

}

 

function startScroll()

{

            document.onmousemove = getMouseX;

            loop=setInterval(scrollImg,1);

}

 

function stopScroll()

{

            document.onmousemove = null;

            clearInterval(loop);

}

