// +---------------------------------------------------------------------------+
// | Copyright (C) 2003-2009 by the following authors:                         |
// | Version 1.1    Date: Apr 01, 2009                                         |
// | Authors:   Blaine Lang - blaine AT portalparts DOT com                    |
// | Authors:   Ivy         - komma AT ivywe DOT co DOT jp                     |
// | Authors:   hiroron     - hiroron AT hiroron DOT com                       |
// |                                                                           |
// | Javascript functions for Div Tab Selector                                 |
// |                                                                           |
// +---------------------------------------------------------------------------+
function showhideProfileEditorDiv(option,selindex) {
    var divarray = new Array('menu0','menu1','menu2','menu3','menu4','menu5','menu6','menu7','menu8','menu9'); 

    // Reset the current selected navbar tab
    var navbar = document.getElementById('current');
    if (navbar) navbar.id = '';
    // Cycle thru the navlist child elements - buiding an array of just the link items 
    var navbar = document.getElementById('navlist');
    var menuitems = new Array(10);
    var item = 0;
    for (var i=0 ;i < navbar.childNodes.length ; i++ ) {
        if (navbar.childNodes[i].nodeName.toLowerCase() == 'li') {
            menuitems[item] = navbar.childNodes[i];
            item++;
        }
    }
    // Now that I have just the link items I can set the selected tab using the passed selected Item number
    // Set the <a tag to have an id called 'current'
    var menuitem = menuitems[selindex];
    for (var j=0 ;j < menuitem.childNodes.length ; j++ ) {
        if (menuitem.childNodes[j].nodeName.toLowerCase() == 'a')  menuitem.childNodes[j].id = 'current';
    }

    // Reset or show all the main divs - editor tab sections
    for (i=0; i < divarray.length; i++) {
        var dividname = 'pe_' + divarray[i];
        var tab = document.getElementById(dividname);
        if (tab) {
            if (option != divarray[i]) {
                tab.style.display = 'none';
            } else {
                tab.style.display = '';
            }
        }
    }
}

