﻿scrollStep = 3;
scrollStep2 = 6;

timerLeft = "";
timerRight = "";


function toLeft(id) {
    document.getElementById(id).scrollLeft = 0;
}
function scrollDivLeft(id) {
    clearTimeout(timerRight);
    document.getElementById(id).scrollLeft += scrollStep;
    timerRight = setTimeout("scrollDivLeft('" + id + "')", 10);
}
function slideDivLeft(id) {
    clearTimeout(timerRight);
    document.getElementById(id).scrollLeft += scrollStep;
    stopMe();
}
function scrollDivRight(id) {
    clearTimeout(timerLeft);
    document.getElementById(id).scrollLeft -= scrollStep;
    timerLeft = setTimeout("scrollDivRight('" + id + "')", 10);
}
function slideDivRight(id) {
    clearTimeout(timerLeft);
    document.getElementById(id).scrollLeft -= scrollStep;
    stopMe();
}
function toRight(id) {
    document.getElementById(id).scrollLeft = document.getElementById(id).scrollWidth;
}
function stopMe() {
    clearTimeout(timerRight);
    clearTimeout(timerLeft);
}

function customScrollLeft(id, Step) {
    clearTimeout(timerRight);

    var speed = scrollStep;

    if (Step == 2) { speed = scrollStep2; }

    document.getElementById(id).scrollLeft += speed;
    timerRight = setTimeout("customScrollLeft('" + id + "', '" + Step + "')", 10);
}

function customScrollRight(id, Step) {
    clearTimeout(timerRight);

    var speed = scrollStep;

    if (Step == 2) { speed = scrollStep2; }

    document.getElementById(id).scrollLeft -= speed;
    timerRight = setTimeout("customScrollRight('" + id + "', '" + Step + "')", 10);
}

// Vertical Sliding
function scrollDivUp(id) {
    clearTimeout(timerRight);
    document.getElementById(id).scrollTop += scrollStep;
    timerRight = setTimeout("scrollDivUp('" + id + "')", 10);
}
function slideDivUp(id) {
    clearTimeout(timerRight);
    document.getElementById(id).scrollTop += scrollStep;
    stopMe();
}
function scrollDivDown(id) {
    clearTimeout(timerLeft);
    document.getElementById(id).scrollTop -= scrollStep;
    timerLeft = setTimeout("scrollDivDown('" + id + "')", 10);
}
function slideDivDown(id) {
    clearTimeout(timerLeft);
    document.getElementById(id).scrollTop -= scrollStep;
    stopMe();
}
function customScrollUp(id, Step) {
    
    clearTimeout(timerRight);

    if (Step == 2) { speed = 4; }

    document.getElementById(id).scrollTop += speed;
    timerRight = setTimeout("customScrollUp('" + id + "', '" + Step + "')", 10);
}

function customScrollDown(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 4; }

    document.getElementById(id).scrollTop -= speed;
    timerRight = setTimeout("customScrollDown('" + id + "', '" + Step + "')", 10);
}

//Cross Sliding
function goUpLeft(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }

    document.getElementById(id).scrollTop -= speed;
    document.getElementById(id).scrollLeft -= speed;
    timerRight = setTimeout("goUpLeft('" + id + "', '" + Step + "')", 10);
}
function goUp(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }
    
    document.getElementById(id).scrollTop -= speed;
    timerRight = setTimeout("goUp('" + id + "', '" + Step + "')", 10);
}
function goUpRight(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }
    
    document.getElementById(id).scrollTop -= speed;
    document.getElementById(id).scrollLeft += speed;
    timerRight = setTimeout("goUpRight('" + id + "', '" + Step + "')", 10);
}
function goDownLeft(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }

    document.getElementById(id).scrollTop += speed;
    document.getElementById(id).scrollLeft -= speed;
    timerRight = setTimeout("goDownLeft('" + id + "', '" + Step + "')", 10);
}
function goDown(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }
    
    document.getElementById(id).scrollTop += speed;
    timerRight = setTimeout("goDown('" + id + "', '" + Step + "')", 10);
}
function goDownRight(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }

    document.getElementById(id).scrollTop += speed;
    document.getElementById(id).scrollLeft += speed;
    timerRight = setTimeout("goDownRight('" + id + "', '" + Step + "')", 10);
}
function goRight(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }
    
    document.getElementById(id).scrollLeft += speed;
    timerRight = setTimeout("goRight('" + id + "', '" + Step + "')", 10);
}
function goLeft(id, Step) {
    clearTimeout(timerRight);

    if (Step == 2) { speed = 3; }
    if (Step == 3) { speed = 5; }
    
    document.getElementById(id).scrollLeft -= speed;
    timerRight = setTimeout("goLeft('" + id + "', '" + Step + "')", 10);
}
