
var productsScrollTimer;

function autoScrollProducts(scroll, delay)
{
//alert("autoScrollProducts() called\nscroll="+scroll+"\ndelay="+delay);

    var containerId = "productlistcontainer";
    var contentId = "productlist";
    var containerObj = document.getElementById(containerId);
    var contentObj = document.getElementById(contentId);

    if ((contentObj.offsetHeight - containerObj.offsetHeight) <
        autoScrollThreshold)
        autoScrollEnable = 0;

    if (!delay)
        delay = 0;

    if (scroll && autoScrollEnable)
    {
        productsScrollTimer = window.setTimeout(
            "scrollY('" + containerId + "','" + contentId + "',10,10,0,1)",
            delay);
    }
    else
    {
        if (productsScrollTimer)
            window.clearTimeout(productsScrollTimer);
        scrollY(containerId, contentId, 0, 0, 0);
    }
}

function scrollToProduct(i)
{
    var productHeight = 131;

    moveToY('productlistcontainer', 'productlist', - productHeight * i);
}

var autoScrollEnable = 1;
var autoScrollThreshold = 20;
var autoScrollRestartTime = 5000;

