var Dialog = new Class({
    initialize: function(title, content) {
        this.dimmer = new Element('div'); 
        this.dimmer.set('class', 'modal-dialog-dimmer'); 
        this.dimmer.inject($('body'), 'top');
        this.dimmer.fade(1);
        
        this.dimmer.addEvent('click', function(event) {
            this.dimmer.fade(0);
        }.bind(this));
        
        this.dialog = new Element('div'); 
        this.dialog.set('class', 'modal-dialog'); 
        this.dialog.inject(this.dimmer);
        
        this.dialog.addEvent('click', function(event) {
            event.stopPropagation();
        });
        
        this.title = new Element('h2');
        this.title.set('html', title);
        this.title.inject(this.dialog);
        
        this.content = content;
        this.content.inject(this.dialog);
    },

    show: function() {
        this.dimmer.fade(1);
    },
    
    hide: function(dispose) {
        this.dimmer.fade(0);
        if(dispose != false) {
            (function() {this.dimmer.dispose();}).bind(this).delay(1000);
        }
    }
})

