/// class ProspectDirector.Web.UI.SelectionDialogBase
/// using ProspectDirector.Web.UI.Dialog

/**
@constructor
@class SelectionDialogBase
@namespace Web.UI
@extends Web.UI.Dialog
**/
ProspectDirector.Web.UI.SelectionDialogBase = ProspectDirector.Web.UI.Dialog.extend({

    //================================
    // FIELDS
    //================================

    _DOM: null,

    //================================
    // CONSTRUCTOR
    //================================

    init: function (options) {

        options = $.extend({
            config: {
                modal: true,
                height: 400,
                width: 550,
                iframe: false,
                resizable: false,
                title: "Selection Dialog"
            }
        }, options);

        this._super(options);

    },

    //================================
    // PUBLIC METHODS
    //================================

    closeAndReturn: function () {

        this.hide({
            command: "ok",
            data: {
                selections: this.DOM().getSelections()
            }
        });

    },

    DOM: function () {

        if (!this._DOM) {
            this._DOM = new ProspectDirector.Web.UI.SelectionDialogBaseDOM({
                //TODO: Probably shouldn't be passing around references to the WindowDOM object.
                windowDOM: this.get_window().DOM(),
                close: $.proxy(this.close, this),
                closeAndReturn: $.proxy(this.closeAndReturn)
            });
        }

        return this._DOM;

    }

});