// Temperatur-Rechner
// geschrieben am 19.11.2001 von Alfred Müller
// Hinweise, Fragen etc. bitte per E-Mail an alfred.mueller@dagmar-mueller.de

var wert1;
var wert2;
var wert3;
var wert4;

function tempRechner(was) {
  if (was <= 0 || was >= 9) {
    alert("Ungültige Umrechnungsroutine");
   }
  else {
    wert2=document.temp1.tempera1.value;
    if (was == 1) wert1 = (wert2 - 32) / 1.8;
    if (was == 2) wert1 = (wert2 * 1.8) + 32;
    if (was == 3) wert1 = ((wert2 * 1) + 459.67) / 1.8;
    if (was == 4) wert1 = (wert2 * 1) + 273.16;
    if (was == 5) wert1 = (wert2 * 1.25) + 273.16;
    if (was == 6) wert1 = wert2 / 1.8;
    if (was == 7) wert1 = (wert2 * 1.8) - 459.67;
    if (was == 8) wert1 = wert2 - 273.16;
    wert3 = wert1 * 100;
    wert4 = Math.round(wert3);
    wert1 = wert4 / 100;
    if (was == 1) alert(wert2 + " Grad Fahrenheit sind " + wert1 + " Grad Celsius.");
    if (was == 2) alert(wert2 + " Grad Celsius sind " + wert1 + " Grad Fahrenheit.");
    if (was == 3) alert(wert2 + " Grad Fahrenheit sind " + wert1 + " Grad Kelvin.");
    if (was == 4) alert(wert2 + " Grad Celsius sind " + wert1 + " Grad Kelvin.");
    if (was == 5) alert(wert2 + " Grad Réaumur sind " + wert1 + " Grad Kelvin.");
    if (was == 6) alert(wert2 + " Grad Rankine sind " + wert1 + " Grad Kelvin.");
    if (was == 7) alert(wert2 + " Grad Kelvin sind " + wert1 + " Grad Fahrenheit.");
    if (was == 8) alert(wert2 + " Grad Kelvin sind " + wert1 + " Grad Celsius.");
  }
}
