function success(that)
{
  document.getElementById('success_'+that).style.display="block";
  return false;
}

function save_bat(that,type)
{
  var valeur = 'bat'+that.options[that.selectedIndex].value;
  if (valeur=='batDefault'){
    document.getElementById('room_'+type).disabled=true;
  };

  for (var i = 1; i<=(that.length-1) ; i++) {
    if ((i == that.selectedIndex) && (valeur != "batDefault")) {
      document.getElementById('room_'+type).disabled=false;
      document.getElementById('bat_'+type+that.options[i].value).style.display="block";
    };
    if ((i != that.selectedIndex) && (valeur != "batDefault")) {
      document.getElementById('room_'+type).disabled=false;
      document.getElementById('bat_'+type+that.options[i].value).style.display="none";
    };

  }
  return false;
}

function show_rad_options()
{
  var elem = document.getElementById('device_type');
  if (elem.options[elem.selectedIndex].value == 'radiator') document.getElementById('radiator_options').style.display="block";
  else document.getElementById('radiator_options').style.display="none";
  return false;
}