var ompScroller = new Class({
    Extends: Fx.Scroll,
    options: {
        nextButton: new Element("a"),
        previousButton: new Element("a")
    },
    initialize: function(element, options) {
        this.parent(element, options)
        this.children = $(element).getFirst().getChildren()
        this.current = this.children[0]
        this.scrollTo(this.current)
        return this
    },
    scrollTo: function(where, event) {
        this.current = where
        this.toElement(this.current)
        if(!where.getNext())
            this.disable("next")
        else
            this.enable("next")
        if(!where.getPrevious())
            this.disable("previous")
        else
            this.enable("previous")
        if(event) this.fireEvent("on" + event)
    },
    next: function() {
        if(this.timer) return false
        var next = this.current.getNext()
        if(next) {
            this.scrollTo(next, "Next")
        }
    },
    previous: function() {
        if(this.timer) return false
        var previous = this.current.getPrevious()
        if(previous) {
            this.scrollTo(previous, "Previous")
        }
    },
    disable: function(button) {
        this.options[button + "Button"].removeEvents("click").addEvent("click", function(e) {
            new Event(e).preventDefault()
        })
        this.options[button + "Button"].addClass("disabled");
    },
    enable: function(button) {
        var self = this
        this.options[button + "Button"].removeEvents("click").addEvent("click", function(e) {
            new Event(e).preventDefault()
            self[button]()
        })
        this.options[button + "Button"].removeClass("disabled");
    }
})