function TextScroll(scrollname, div_name, stop_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.step = 1;
    this.speed=20;
    this.stp=0;
    this.timeoutID = 0;
    this.div_obj = null;
    this.div_stop_obj = null;
    this.stp_name = stop_name;
    {
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
                div_obj.onmouseover = function() { eval(scrollname + ".scrollStop();") };
                div_obj.onmouseout = function() { eval(scrollname + ".continueScroll();") };
            }
            this.div_stop_obj = document.getElementById(this.stp_name);
            if (this.div_stop_obj) {
                this.div_stop_obj.onclick = function() { eval(scrollname + ".toogleScroll();") };
            }
        }
    }

    this.scrollStop = function() {
        clearTimeout(this.timeoutID);
    }

    this.toogleScroll = function() {
        if(this.stp == 1) {
            this.stp = 0;
            this.continueScroll();
            div_obj.onmouseover = function() { eval(scrollname + ".scrollStop();") };
            div_obj.onmouseout = function() { eval(scrollname + ".continueScroll();") };
        } else {
            this.stp = 1
            this.scrollStop();
            div_obj.onmouseover = null;
            div_obj.onmouseout = null;
        }
    }

    this.continueScroll = function() {
        if (this.sine == -1) {
            this.timeoutID = setTimeout(this.name + ".scrollDown()", this.speed);
        } else {
            this.timeoutID = setTimeout(this.name + ".scrollUp()", this.speed);
        }
    }

    this.scrollUp = function() {
        if (this.div_obj) {
            this.sine=1;
            this.stp = 0;
            this.scrollCursor = (this.scrollCursor - this.step) < 0 ? 0 : this.scrollCursor - this.step;
            this.div_obj.scrollTop = this.scrollCursor;
            if (this.scrollCursor == 0) {
                this.timeoutID = setTimeout(this.name + ".scrollDown()", this.speed);
            } else {
                this.timeoutID = setTimeout(this.name + ".scrollUp()", this.speed);
            }
        }
    }

    this.scrollDown = function() {
        if (this.div_obj) {
            this.sine=-1;
            this.stp = 0;
            this.scrollCursor += this.step;
            this.div_obj.scrollTop = this.scrollCursor;
            if (this.div_obj.scrollTop == this.scrollCursor) {
                this.timeoutID = setTimeout(this.name + ".scrollDown()", this.speed);
            } else {
                this.timeoutID = setTimeout(this.name + ".scrollUp()", this.speed);
            }
        }
    }

    this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
            this.timeoutID = setTimeout(this.name + ".scrollDown()", this.speed);

        }
    }
    this.resetScroll();
}

