
    var productDivs = new Array();
    var allDivs = new Array();
    var visibleDivs = new Array();
    var currentDiv = 0;
    var divWidth = 170;
    var moveCount = 0;
    var direction = -1;
    var intervalId = 0;
    var speed = 26;
    var executing = false;
    var products = null;
    function load() {
        allDivs = document.getElementsByTagName("div");
        for (var i = 0; i < allDivs.length; i++) {
            var e = allDivs[i];
            if (e.className == "scrollingContent") {
                e.style.width = divWidth;
                e.style.left = -divWidth;
                e.onmouseover = "stopScroller();";
                e.onmouseout = "startScroller();";
            	productDivs.push(e);
	            if (visibleDivs.length < 3) {
                	visibleDivs.push(e);
	            }
            }
        }
        var left = 0;
        for (var i = 0; i < 3; i++) {
            var e = visibleDivs[i];
            e.style.left = left;
            left += divWidth;
            e.style.visibility = "visible";
        }
        
        currentDiv = 2;
        moveCount = divWidth;
        intervalId = setInterval("doNext()", speed );    
    }
    
    function slower() {
        speed+= 10;    
        if (speed > 100) {
            speed = 100;
        }
        clearInterval(intervalId);
        intervalId = setInterval("doNext()", speed );    
    }
    function faster() {
        speed-= 10;    
        if (speed <= 0) {
            speed = 1;
        }
        clearInterval(intervalId);
        intervalId = setInterval("doNext()", speed );    
    }
    
    function stopScroller() {
        clearInterval(intervalId);
    }
    
    function startScroller() {
        intervalId = setInterval("doNext()", speed );    
    }

    function doNext() {
        executing = true;
        if (moveCount >= divWidth) {
            currentDiv++;
            if (currentDiv >= productDivs.length) {
                currentDiv = 0;
            }
            visibleDivs.push(productDivs[currentDiv]);
            visibleDivs[3].style.left = divWidth * 3;
            visibleDivs[3].style.visibility = "visible";
        }
        var left =  -(divWidth - moveCount);
        if (visibleDivs[0] != null) {
        	visibleDivs[0].style.left = left;
        }
        if (visibleDivs[1] != null) {
        	visibleDivs[1].style.left = left + divWidth;
        }
        if (visibleDivs[2] != null) {
        	visibleDivs[2].style.left = left + divWidth + divWidth;
        }
        if (visibleDivs[3] != null) {
        	visibleDivs[3].style.left = left + divWidth + divWidth + divWidth;
        }
        moveCount--;
        if (moveCount < 1) {
            visibleDivs[0].style.visibility = "hidden";
            visibleDivs[0].style.left  = -divWidth;
            visibleDivs.splice(0, 1);
            moveCount = divWidth;
        }
        executing = false;
    }

