// JavaScript Document
/* 
  This function is called from inside the specific team pages only. 
  Task: Show or Hide the DIV areas used to display team member details.
*/
function ShowHide(id) {
    // we hide all divs still open (visible)

    if (document.getElementsByTagName ){ 
      var list = document.getElementsByTagName('div');
       for (var i = 0; i < list.length; i++ ) {
        if (list[i].className == 'popupvisible') {
          if (list[i].id != id) {
            list[i].className = 'popuphidden';
            break;
          }
        } 
      }  
    }

    var obj = document.all ? 
      document.all[id] : 
      document.getElementById(id);
    if (obj) {
      (obj.className == "popuphidden" ? obj.className = "popupvisible" : obj.className = "popuphidden");
    }
}	

/* Task: Marks the current language menu item 
   Notice: 
   1. The oHd hidden field value is the itemid, this link points to and is stored in the users session. 
   This means, whenever the menu items are linked to another item (menu item), this value will change 
   and must be adapted in this function accordingly.
   2. The className of the LI items has been generated by Joomla. By means of this className the LI items can
   be identified and than highlighted. Whenever the menu items change or additional menu items must be considered, 
   changes in the _Highlight function must be made.
*/
function HighlightCurrentLanguage() {
  var oHd = document.all ? document.all['lang'] : document.getElementById('lang');
  var oUl = document.all ? document.all['_lang'] : document.getElementById('_lang');
  var curr_lang;
  if (oHd) {
    curr_lang = oHd.value;
  }
  
  if (oUl) {
    for (i = 0; i < oUl.childNodes.length; i++) {
      var oLi = oUl.childNodes[i];
      if (oLi) {
        _Highlight(curr_lang, oLi);
      }
    }
  }
}

function _Highlight(id, oLi) {
  highlight = false;
  if ((id == 1  && oLi.className == 'item59') ||
      (id == 62 && oLi.className == 'item60') ||
      (id == 77 && oLi.className == 'item61') ){
    highlight = true; 
  }
  if (highlight) {
    oLi.id = "current_lang";
  }
}