var body_apt_loaded=true;

function switchCell(cell_id, mode){
  var cell = window.document.getElementById(cell_id);
  var curColor = cell.attributes['bgcolor'].value;
  if (mode == 1) { // occupied
    cell.style.backgroundImage = 'url("/template/default/images/res_1.png")';
    cell.style.backgroundRepeat = 'no-repeat';
  } else if (mode == 2) { // first day
    cell.style.backgroundImage = 'url("/template/default/images/res_2.png")';
    cell.style.backgroundRepeat = 'no-repeat';
  } else if (mode == 3) { // last day
    cell.style.backgroundImage = 'url("/template/default/images/res_3.png")';
    cell.style.backgroundRepeat = 'no-repeat';
  } else if (mode == 4) { // available
    cell.style.backgroundImage = 'url("/template/default/images/res_4.png")';
    cell.style.backgroundRepeat = 'no-repeat';
  } else { // unknown
    cell.style.backgroundImage = 'url("/template/default/images/res_5.png")';
    cell.style.backgroundRepeat = 'no-repeat';
  }
}

function showRates(){
  var season_selector = window.document.getElementById('season_selector').value;
  var seasonOn='n';
  var seasonOff='h';
  if ('high' == season_selector) {
    seasonOn='h';
    seasonOff='n';
  }
  for(var persons=1; persons<=6; persons++){
    for(var rooms=1; rooms<=2; rooms++){
      var elementOffId = persons.toString() + rooms.toString() + seasonOff;
      var elemetOff = window.document.getElementById(elementOffId);
      var elementOnId = persons.toString() + rooms.toString() + seasonOn;
      var elemetOn = window.document.getElementById(elementOnId);
      if (elemetOff && elemetOn) {
        elemetOff.style.display='none';
        elemetOn.style.display='';
      }
    }
  }
}

function switchHowToGet(){
  var howToGetArea = window.document.getElementById('howtoget');
  if (howToGetArea) {
    var curStyleDisplay = howToGetArea.style.display;
    if ("none" == curStyleDisplay) {
      howToGetArea.style.display = '';
      return;
    } else {
      howToGetArea.style['display'] = 'none';
      return;
    }
  }
}

function switchEquipment(){
  var equipmentArea = window.document.getElementById('equipment');
  if (equipmentArea) {
    var curStyleDisplay = equipmentArea.style.display;
    if ("none" == curStyleDisplay) {
      equipmentArea.style.display = '';
      return;
    } else {
      equipmentArea.style['display'] = 'none';
      return;
    }
  }
}
