Dialog = new function()
{
    var buttonList = {}
    
    this.Open = function(Input, okButton)
    {
        if (okButton == null || okButton == true)
        {
            this.addButton('OK', true, function(){});   
        }
        
        var params = { 
            disabled: false,
            autoOpen: true,
            closeOnEscape: false,
            closeText: 'Sluiten',
            draggable: false,
            height: 300,
            width: 400,
            modal: true,
            resizable: false,
            title: Input.Title,
            close: this.onClose,
            buttons: buttonList
        }; 
        
        $('#Dialog').html(Input.Text).dialog(params);
        buttonList = {};
    }
    
    this.Close = function()
    {
        $('#Dialog').dialog('close');   
    }
    
    this.addButton = function(caption, closing, eventFunction)
    {
        if (closing)
            buttonList[caption] = function(){ if (eventFunction != null) { eventFunction();} $(this).dialog("close"); };  
        else
            buttonList[caption] = eventFunction;  
    }

    this.onClose = function(){};
}
