
// tab superclass
function Tab(id) {
    this.id = id;
}

function TabCabinet(id) {
    this.base = Tab;
    this.base(id);
    this.tabs = new function() {}; // holds all tab sections
    this.init = function(show_tab) {
        //hide all tab sections
        for (var i in this.tabs) {
            if (this.tabs[i].id != show_tab) {
                this.tabs[i].hide();
            }
        }
        //show selected tab section - double loop necessary to deselect old tabs
        for (var i in this.tabs) {
            if (this.tabs[i].id == show_tab) {
                this.tabs[i].show();
            }
        }
    }
}
TabCabinet.prototype = new Tab;

function TabDivider(id, onImg, offImg) {
    this.base = Tab;
    this.base(id);
    this.onImg = onImg;
    this.offImg = offImg;
}
TabDivider.prototype = new Tab;

function TabContent(id) {
    this.base = Tab;
    this.base(id);
}
TabCabinet.prototype = new Tab;

function TabSection(id, body, left_divider, right_divider, initialClassName) {
    this.base = Tab;
    this.base(id);
    this.body = body;
    this.left_divider = left_divider;
    this.right_divider = right_divider;
    this.className = initialClassName;
    this.show = function () {
        showObject(this.body.id);
        this.className = 'innerTabOn';
        setClassName(this.id, this.className);
        setClassName(this.left_divider.id, 'innerTabDividerOn');
        setClassName(this.right_divider.id, 'innerTabDividerOn');
    }
    this.hide = function () {
        hideObject(this.body.id);
        this.className = 'innerTabOff';
        setClassName(this.id, this.className);
        setClassName(this.left_divider.id, 'innerTabDividerOff');
        setClassName(this.right_divider.id, 'innerTabDividerOff');
    }
    this.hint = function (state) {
        if (this.className && this.className == 'innerTabOff') {
            if (state == true) {
                setClassName(this.id, 'innerTabOver');
            } else {
                setClassName(this.id, this.className);
            }
        }
    }
}
TabSection.prototype = new Tab;
