﻿// scroll content to the left, right, top, and bottom
// these functions are used in the text and image sliders and provide the
// movement functionality of the slider

// the regular expression helps to find the html element
// timer is a global variable on the containing page into which this file is included
// it is global so that it maintains value between function calls
// clear timeout clears the queue of old waiting scrolls before the function starts
// so that the new movement will be carried out immediately

function scrollL()
{
    var i;
    var divArr = document.getElementsByTagName('div');
    var regexpDiv = /SliderDiv/;

    clearTimeout(timer);
    for (i = 0; i < divArr.length; i++)
    {
        if (regexpDiv.test(divArr[i].getAttribute("ID")))
        {
            divArr[i].scrollLeft += -3;
        }
    }
    timer = setTimeout("scrollL()", 7);
}

function scrollR()
{
    var i;
    var divArr = document.getElementsByTagName('div');
    var regexpDiv = /SliderDiv/;

    clearTimeout(timer);
    for (i = 0; i < divArr.length; i++)
    {
        if (regexpDiv.test(divArr[i].getAttribute("ID")))
        {
            divArr[i].scrollLeft += 3;
        }
    }
    timer = setTimeout("scrollR()", 14);
}
function scrollUp()
{
    var i;
    var divArr = document.getElementsByTagName('div');
    var regexpDiv = /textHider/;

    clearTimeout(timer);
    for (i = 0; i < divArr.length; i++) 
    {
        if (regexpDiv.test(divArr[i].getAttribute("ID"))) 
        {
            divArr[i].scrollTop += -6;
        }
    }
    timer = setTimeout("scrollUp()", 7);
}

function scrollDown()
{
    var i;
    var divArr = document.getElementsByTagName('div');
    var regexpDiv = /textHider/;

    clearTimeout(timer);
    for (i = 0; i < divArr.length; i++)
    {
        if (regexpDiv.test(divArr[i].getAttribute("ID")))
        {
            divArr[i].scrollTop += 6;
        }
    }
    timer = setTimeout("scrollDown()", 7);
}


