var Popup = function(id) {
    this.__init__(id);
};
update(Popup.prototype, {

    duration: 1.0,
    effect: "slide",

    __init__: function(id) {
        this.id = id;
    },

    show: function(duration) {
        var d = new Deferred();
        toggle(this.id, this.effect, {
            "duration": duration || this.duration,
            "afterFinish": bind(function() {
                d.callback();
                signal(this.id, "shown");
            }, this)
        });
        return d;
    },

    hide: function(duration) {
        var d = new Deferred();
        toggle(this.id, this.effect, {
            "duration": duration || this.duration,
            "afterFinish": bind(function() {
                d.callback();
                signal(this.id, "hidden");
            }, this)
        });
        return d;
    }
});


