var TAB_LIST_ITEM_ID_PREFIX = "ListItem";

function activateTab(activatedTabId) {
    // mark the tab itself as Active
    document.getElementById(activatedTabId + TAB_LIST_ITEM_ID_PREFIX).className = 'active';
    // show content pane
    var activatedTabContentDiv = document.getElementById(activatedTabId);
    if (activatedTabContentDiv) {
        activatedTabContentDiv.style.display = 'block';
        activatedTabContentDiv.style.margin = 0;
    }
}

function deactivateTabs(tabsIdsArray, activatedTabId) {
    var deactivatedTabContentDiv = null;
    for (var i = 0; i < tabsIdsArray.length; i++) {
        var deactivatedTabId = tabsIdsArray[i];
        if (activatedTabId == deactivatedTabId) {
            // skip this same tab
            continue;
        }
        // mark the tab itself as Inactive
        document.getElementById(deactivatedTabId + TAB_LIST_ITEM_ID_PREFIX).className = '';
        // hide div
        deactivatedTabContentDiv = document.getElementById(deactivatedTabId);
        if (deactivatedTabContentDiv) {
            deactivatedTabContentDiv.style.display = 'none';
        }
    }
}

function switchTab(activatedTabId, tabsIdsArray) {
    deactivateTabs(tabsIdsArray, activatedTabId);
    activateTab(activatedTabId);
}

