﻿//Scroll down
var repeatScrollDown = false;
function startScrollingDown(e) {
    repeatScrollDown = true;
    repeatScrollingDown(e);
}
function repeatScrollingDown(e) {
    document.getElementById(e).scrollTop += 5;
    setTimeout(function() {
        if (repeatScrollDown) repeatScrollingDown(e);
    }, 30);
}
function finishScrollingDown() {
    repeatScrollDown = false;
}

//Scroll up
var repeatScrollUp = false;
function startScrollingUp(e) {
    repeatScrollUp = true;
    repeatScrollingUp(e);
}
function repeatScrollingUp(e) {
    document.getElementById(e).scrollTop -= 5;
    setTimeout(function() {
        if (repeatScrollUp) repeatScrollingUp(e);
    }, 30);
}
function finishScrollingUp() {
    repeatScrollUp = false;
}

//Scroll left
var repeatScrollLeft = false;
function startScrollingLeft(e) {
    repeatScrollLeft = true;
    repeatScrollingLeft(e);
}
function repeatScrollingLeft(e) {
    document.getElementById(e).scrollLeft -= 5;
    setTimeout(function() {
        if (repeatScrollLeft) repeatScrollingLeft(e);
    }, 30);
}
function finishScrollingLeft() {
    repeatScrollLeft = false;
}

//Scroll right
var repeatScrollRight = false;
function startScrollingRight(e) {
    repeatScrollRight = true;
    repeatScrollingRight(e);
}
function repeatScrollingRight(e) {
    document.getElementById(e).scrollLeft += 5;
    setTimeout(function() {
        if (repeatScrollRight) repeatScrollingRight(e);
    }, 30);
}
function finishScrollingRight() {
    repeatScrollRight = false;
}
