

// LIST ALL SHOW/HIDE ELEMENT IDS HERE
menus_array = new Array ('sub1', 'sub2', 'sub3', 'sub4', 'sub5' , 'sub6');
menus_status_array = new Array ();// remembers state of switches

function showHideSwitch (theid) {
  if (document.getElementById) {
  ////turn other off first{
   for (var i=0; i<menus_array.length; i++) {
      var idname = menus_array[i];
      var switch_id = document.getElementById(idname);
      switch_id.className = 'hideSwitch';
      menus_status_array [idname] = 'hide';
      
    }
//
    var switch_id = document.getElementById(theid);
    if (menus_status_array[theid] != 'show') {
      switch_id.className = 'showSwitch';
	  menus_status_array[theid] = 'show';
	  document.cookie = theid+'=show';
    }else{
      switch_id.className = 'hideSwitch';
	  menus_status_array[theid] = 'hide';
	  document.cookie = theid+'=hide';
    }
  }
}

