// LIST ALL SHOW/HIDE ELEMENT IDS HERE
menus_array = new Array ();
menus_status_array = new Array ();// remembers state of switches

function showHideSwitch(theid) {
  if (document.getElementById) {
    var switch_id = document.getElementById(theid);
    var imgid = theid+'Button';
    var button_id = document.getElementById(imgid);
    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';
    }
  }
}
function showHideSwitch1(theid, rate1, rate2) {    
    if (document.getElementById) {        
        var num = theid;
        num = num.replace("lst", "");        
        var switch_id = document.getElementById(theid);
        if (menus_status_array[theid] != 'show') {
            resetMenu();
            switch_id.className = 'showSwitch';
            menus_status_array[theid] = 'show';
            document.cookie = theid + '=show';            
            var argument = num + '-' + rate1 + '-' + rate2;
            loadRooms(argument);
        } else {
            switch_id.className = 'hideSwitch';
            menus_status_array[theid] = 'hide';
            document.cookie = theid + '=hide';
            $('roomsdisplay' + num).update('');
        }        
    }
}
function resetMenu() { // read cookies and set menus to last visited state
  if (document.getElementById) {
    for (var i=0; i<idswtch.length; i++) {
          var idname = idswtch[i];
          //alert(idname)          
          var switch_id = document.getElementById(idname);
          switch_id.className = 'hideSwitch';
	      menus_status_array [idname] = 'hide';
	  }
    }
 }

 function getCookie(c_name) {
     if (document.cookie.length > 0) {
         c_start = document.cookie.indexOf(c_name + "=");
         if (c_start != -1) {
             c_start = c_start + c_name.length + 1;
             c_end = document.cookie.indexOf(";", c_start);
             if (c_end == -1) c_end = document.cookie.length;
             return unescape(document.cookie.substring(c_start, c_end));
         }
     }
     return "";
 }

 function resetMenu1() { // read cookies and set menus to last visited state
     if (document.getElementById) {
         for (var i = 0; i < idswtch.length; i++) {
             var idname = idswtch[i];
             var switch_id = document.getElementById(idname);                          
             if (getCookie(idname) == 'show') {                 
                 switch_id.className = 'showSwitch';
                 menus_status_array[idname] = 'show';
             } else {                 
                 switch_id.className = 'hideSwitch';
                 menus_status_array[idname] = 'hide';
             }
         }
     }
 }


