﻿function ShowPanel(idOfPanel) {
    var panel = document.getElementById(idOfPanel);
    if (panel != null) {
        if (panel.className == "AccordionContentHidden") {
            panel.className = "AccordionContent";
        }
    }
}

function HideButton(idOfButton) {
    var button = document.getElementById(idOfButton);
    if (button != null) {
        if (button.className == "AccordionBtnExpColVisible") {
            button.className = "AccordionBtnExpColHidden";
        }
    }
}

function CloseAllPanes() {
    var strAllPanes = document.getElementById(idOfAllPanes);
    if (strAllPanes != null) {
        var allPanel = JSON.parse(strAllPanes.value);
        //here add a for loop
        for (i = 0; i < allPanel.length; i++) {
            var contPane = document.getElementById(allPanel[i]);

            if (contPane != null && contPane.className == "AccordionContent") {
                contPane.className = "AccordionContentHidden";
            }
        }
    }
}

function ShowAllButtons() {
    var strAllButtons = document.getElementById(idOfAllButtons);
    if (strAllButtons != null) {
        var allButtons = JSON.parse(strAllButtons.value);

        for (i = 0; i < allButtons.length; i++) {
            var button = document.getElementById(allButtons[i]);

            if (button != null && button.className == "AccordionBtnExpColHidden") {
                button.className = "AccordionBtnExpColVisible";
            }
        }

    }
}