/// class ProspectDirector.Modules.Explorer.Contents.CustomUrlContent 
/// using ProspectDirector.Modules.Explorer.Contents.ExplorerContent

ProspectDirector.Modules.Explorer.Contents.CustomUrlContent = ProspectDirector.Modules.Explorer.Contents.ExplorerContent.extend({

    init: function (options) {
        this._super(options);

        this.init_splitter();
        this.init_menu();

    },

    //---------------------------
    //--- PROPERTIES
    //---------------------------

    get_splitter: function () {
        return this.get_container().find("[data-id=explorer-content-splitter]");
    },

    get_menu: function () {
        return this.get_container().find("[data-id=menu]");
    },

    get_iFrame: function () {
        return this.get_container().find("[data-id=custom-content-iframe]");
    },

    //---------------------------
    //--- INITIALIZERS
    //---------------------------

    init_splitter: function () {

        new ProspectDirector.Types.Core.ViewportSplitter({
            selector: this.get_splitter().selector
        });

    },

    init_menu: function () {
        this.get_menu().kendoMenu({
            select: $.proxy(this.menu_onSelect, this)
        });
    },

    //---------------------------
    //--- EVENT HANDLERS
    //---------------------------

    menu_onSelect: function (e) {

        window.open(this.get_iFrame()[0].src);

    },

    //---------------------------
    //--- METHODS
    //---------------------------

    unload: function () {

        var splitter = this.get_splitter().data("viewportSplitter"),
            menu = this.get_menu().data("kendoMenu");

        if (menu) {
            menu.destroy();
        }

        if (splitter) {
            splitter.destroy();
        }

    }

});