﻿/// <reference name="MicrosoftAjax.js"/>

Type.registerNamespace("BOK");

BOK.assumptionsTab = function(element) {
    
    // Properties
    this._assumptionsTabElement = null;
    this._roiTabElement = null;
    this._defaultRightTab = null;
    this._roiHyperLinkElement = null;
    this._assumptionHyperLinkElement = null;

    BOK.assumptionsTab.initializeBase(this, [element]);
}

BOK.assumptionsTab.prototype = {
    // Init
    initialize: function() {
        BOK.assumptionsTab.callBaseMethod(this, 'initialize');

        $addHandlers(this._roiHyperLinkElement,
        {
            click: this.ToggleRightTab
        }, this);

        $addHandlers(this._assumptionHyperLinkElement,
        {
            click: this.ToggleRightTab
        }, this);

        $get(this._defaultRightTab).style.visibility = "visible";
        $get(this._defaultRightTab).style.display = "block";
    },

    // Dispose
    dispose: function() {
        $clearHandlers(this._roiHyperLinkElement);
        $clearHandlers(this._assumptionHyperLinkElement);

        BOK.assumptionsTab.callBaseMethod(this, 'dispose');
    },
    
    // Event Handlers
    ToggleRightTab: function(sender, e) {
        if (sender.target.id == this._roiHyperLinkElement.id) {
            this._roiTabElement.style.visibility = "visible";
            this._roiTabElement.style.display = "block";

            this._assumptionsTabElement.style.visibility = "hidden";
            this._assumptionsTabElement.style.display = "none";
        }
        else if (sender.target.id == this._assumptionHyperLinkElement.id) {
            this._assumptionsTabElement.style.visibility = "visible";
            this._assumptionsTabElement.style.display = "block";

            this._roiTabElement.style.visibility = "hidden";
            this._roiTabElement.style.display = "none";
        }
    },

    // Properties
    get_assumptionsTabElement: function() {
        return this._assumptionsTabElement;
    },
    set_assumptionsTabElement: function(value) {
        this._assumptionsTabElement = value;
    },

    get_roiTabElement: function() {
        return this._roiTabElement;
    },
    set_roiTabElement: function(value) {
        this._roiTabElement = value;
    },

    get_defaultRightTab: function() {
        return this._defaultRightTab;
    },
    set_defaultRightTab: function(value) {
        this._defaultRightTab = value;
    },

    get_roiHyperLinkElement: function() {
        return this._roiHyperLinkElement;
    },
    set_roiHyperLinkElement: function(value) {
        this._roiHyperLinkElement = value;
    },

    get_assumptionHyperLinkElement: function() {
        return this._assumptionHyperLinkElement;
    },
    set_assumptionHyperLinkElement: function(value) {
        this._assumptionHyperLinkElement = value;
    }
}
BOK.assumptionsTab.registerClass('BOK.assumptionsTab', Sys.UI.Control);

if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();