if (!ScrollBox) {
    var ScrollBox = function(box, body, minCount, currentCount) {
        this.box = document.getElementById(box);
        this.body = document.getElementById(body);
        this.min = minCount;
        this.cur = currentCount;
        this.isLeft = false;
    }
    ScrollBox.prototype.speed = 50;
    ScrollBox.prototype.delay = 2000;
    ScrollBox.prototype.time1 = null;
    ScrollBox.prototype.init = function() {
        var s = this;
        if (this.cur > this.min) {
            var demo = document.createElement('div');
            demo.innerHTML = this.body.innerHTML;
            this.box.appendChild(demo);
            this.demo = demo;
            this.box.style.overflow = 'hidden';
            this.box.onmouseover = function() { window.clearInterval(s.time1); s.time1 = null; };
            this.box.onmouseout = function() { s.start(); }
            window.setTimeout(function() { s.start(); }, this.delay);
        }
    };
    ScrollBox.prototype.init2 = function() {
        var s = this;
        if (this.cur > this.min) {
            var demo = document.createElement('td');
            demo.innerHTML = this.body.innerHTML;
            this.body.parentNode.appendChild(demo);
            this.demo = demo;
            this.box.style.overflow = 'hidden';
            this.isLeft = true;
            this.box.onmouseover = function() { window.clearInterval(s.time1); s.time1 = null; };
            this.box.onmouseout = function() { s.start(); }
            window.setTimeout(function() { s.start(); }, this.delay);
        }
    };
    ScrollBox.prototype.start = function() {
        var s = this;
        if (this.time1 == null)
            this.time1 = window.setInterval(function() { s.play(); }, this.speed);
    };
    ScrollBox.prototype.play = function() {
        if (this.isLeft) {
            if (this.demo.offsetWidth - this.box.scrollLeft <= 0)
                this.box.scrollLeft -= this.body.offsetWidth
            else
                this.box.scrollLeft++
        }
        else {
            if (this.demo.offsetHeight < this.box.scrollTop)
                this.box.scrollTop -= this.body.offsetHeight
            else
                this.box.scrollTop++;
        }
    };
}

