﻿contentScroller = {

    event: YAHOO.util.Event,
    dom: YAHOO.util.Dom,

    obj: null,
    down: null,
    up: null,

    c_int: null,

    init: function(obj, up, down) {

        this.obj = this.dom.get(obj);
        this.down = this.dom.get(down);
        this.up = this.dom.get(up);

        this.event.on(this.down, 'mouseover', function(e) {
            if (contentScroller.c_int == null) {
                contentScroller.c_int
                            = setInterval(function() { contentScroller.s_down(contentScroller.obj); }, 30);
            }
        });

        this.event.on(this.down, 'mouseout', function(e) {
            if (contentScroller.c_int != null) {
                window.clearInterval(contentScroller.c_int);
                contentScroller.c_int = null;
            }
        });

        this.event.on(this.up, 'mouseover', function(e) {
            if (contentScroller.c_int == null) {
                contentScroller.c_int
                            = setInterval(function() { contentScroller.s_up(contentScroller.obj); }, 30);
            }
        });

        this.event.on(this.up, 'mouseout', function(e) {
            if (contentScroller.c_int != null) {
                window.clearInterval(contentScroller.c_int);
                contentScroller.c_int = null;
            }
        });

    },

    s_down: function(obj) {
        var el = this.dom.get(obj);
        el.scrollTop = (el.scrollTop + 4);
    },

    s_up: function(obj) {
        var el = this.dom.get(obj);
        el.scrollTop = (el.scrollTop - 4);
    }

};
