npBlindEffectClass = Class.create({
    initialize: function() {
        this.duration = 0.2;
    },
    toggle: function(element)
    {
        if (Object.isString(element)) {
            element = $(element);
        }
        
        if (element.hasClassName('effect-down')) {
            this.up(element)
        }
        else {
            this.down(element);
        }
    },
    
    up: function(element) {
        this.clearEffects(element);
        element.removeClassName('effect-down');
        element.addClassName('effect-up');
        new Effect.BlindUp(element, { duration: this.duration, afterFinish: this.callback.bind(this), queue: { position: 'end', scope: element.identify(), limit: 1 } });
    },
    
    down: function(element) {
        this.clearEffects(element);
        element.removeClassName('effect-up');
        element.addClassName('effect-down');
        new Effect.BlindDown(element, { duration: this.duration, afterFinish: this.callback.bind(this), queue: { position: 'end', scope: element.identify(), limit: 1 } });
    },
    
    clearEffects: function(element)
    {
        Effect.Queues.get(element.identify()).invoke('cancel');
    },
    
    callback: function(effect)
    {
        if (effect.element.style.removeProperty) {
            effect.element.style.removeProperty('height');
        }
        else {
            if (effect.element.style.removeAttribute) {
                effect.element.style.removeAttribute('height');
            }
        }
    }
});

npBlindEffect = new npBlindEffectClass();