var hoverAccordion = Class.create({

    initialize: function(element, options){
        this.options = {
              restrictMultiple: true
        }
        Object.extend(this.options, options || {});

        this.element = $(element);
        this.currentDt = null;

        this.initObservers();
    },

    initObservers: function() {
        this.element.select('dt').each(function(elt){
            if(elt.down('.openNav') && elt.next('dd')) {
                elt.down('.openNav').observe('click', function(event) {
                    event.stop();

                    if(this.options.restrictMultiple && this.currentDt && this.currentDt != elt)
                        this.toggle(this.currentDt);

                    this.toggle(elt);
                }.bind(this));
            }
        }.bind(this));
    },

    toggle: function(elt) {
        if(elt.down('.openNav').hasClassName('plus')) {
            elt.down('.openNav').addClassName('minus');
            elt.down('.openNav').removeClassName('plus');
            this.currentDt = elt;
        } else {
            elt.down('.openNav').addClassName('plus');
            elt.down('.openNav').removeClassName('minus');
            this.currentDt = null;
        }
        elt.next('dd').toggle();
    }
});
