var ourInterval;
var scrollSpeed = 50;
var scrollHeight = 1;

function scrollStart(direction, divID, elementID)
{
    ourInterval = setInterval("scroll"+direction+"('"+divID+"')", scrollSpeed);
}
function scrollEnd(elementID)
{
    clearInterval(ourInterval);
    scrollSpeed = 50;
    scrollHeight = 1;
}
function scrollUp(elementID)
{
    document.getElementById(elementID).scrollTop = document.getElementById(elementID).scrollTop - scrollHeight;
    scrollSpeed--;
    scrollHeight++;
}
function scrollDown(elementID)
{
    document.getElementById(elementID).scrollTop = document.getElementById(elementID).scrollTop + scrollHeight;
    scrollSpeed--;
    scrollHeight++;
}
function showScrollButton(direction, divID, elementID, linkTitle )
{
    if ( document.getElementById( elementID ) )
    {
        var theScrollButton  = "<a href=\"javascript: void(0);\" title=\""+linkTitle+"\" ";
        theScrollButton += "onMouseOver=\"scrollStart('"+direction+"', '"+divID+"', '"+elementID+"');\" ";
        theScrollButton += "onMouseOut=\"scrollEnd('"+elementID+"');\">";
        theScrollButton += "<img src=\"gfx/1pixel.gif\" alt=\""+linkTitle+"\" />";
        theScrollButton += "</a>\n";
        document.getElementById( elementID ).style.visibility = "visible";
        document.getElementById(elementID).innerHTML = theScrollButton;
    }
}
function hideScrollButton(elementID)
{
    if ( document.getElementById( elementID ) )
    {
        document.getElementById(elementID).style.visibility = "hidden";
        document.getElementById(elementID).innerHTML = "";
    }
}

function initScrollButton()
{
    if ( page != "faq" && page != "contact" && page != "downloads" && page != "thanks" )
    {
        if ( document.styleSheets[0].disabled == false )
        {
            if ( navigator.appName != "Microsoft Internet Explorer" )
            {
                showScrollButton("Up", "content", "scroll_up", "Scroll Up");
                showScrollButton("Down", "content", "scroll_down", "Scroll Down");
            }
            else
            {
                /* should not be needed, but to be certain hide the scroll buttons */
                hideScrollButton("scroll_up");
                hideScrollButton("scroll_down");
            }
        }
    }
}

