
function showWindow(strURL,strTitle,iWidth,iHeight) {
    var win =window.open(strURL,null,"height=" + iHeight + ",width=" + iWidth + ",status=no,toolbar=no,menubar=no,location=no,xfullscreen=1,scrollbars=yes");

	var sw = window.screen.availWidth;
	var sh = window.screen.availHeight;

/*
	var w = 400;
	var h = iHeight;
	win.resizeTo(w, h);
	win.moveTo((sw - w) / 2, (sh - h) / 2);
*/
    }
    
function show(ID,strMimeType)   {



}

function ClearForm(form)
{
 form.weight.value = "";
 form.height.value = "";
 form.bmi.value = "";
 form.my_comment.value = "";
}

function round(val)
{
 return(Math.round(val*10000000)/10000000);
}

function bmi(weight, height)
{
 bmindx=weight/eval(height*height);
 return bmindx;
}

function checkform(form)
{

 if (form.weight.value==null||form.weight.value.length==0 || form.height.value==null||form.height.value.length==0){
      alert("\nBitte geben Sie Gewicht und Körpergrösse ein !");
      return false;
 }

 else if (parseFloat(form.height.value) <= 0||
          parseFloat(form.height.value) >=500||
          parseFloat(form.weight.value) <= 0||
          parseFloat(form.weight.value) >=500){
          alert("\nDie eingegebene Werte sind nicht schlüssig.\nBitte geben Sie die Werte neu ein, \ndas Gewicht in Kilogramm und \ndie Größe in cm");
          ClearForm(form);
          return false;
 }
 return true;

}

function computeform(form)
{
 if (checkform(form))
 {
  varBMI=(Math.round(10.0*bmi(form.weight.value,
form.height.value/100))*0.1);
  form.bmi.value=round(varBMI);

  if (varBMI >40) {
     form.my_comment.value="behandlungsbedürftige Fettsucht (Adipositas)";
  }

  else if (varBMI >30 && varBMI <=40) {
     form.my_comment.value="starkes Übergewicht";
  }

  else if (varBMI >25 && varBMI <=30) {
     form.my_comment.value="leichtes Übergewicht";
  }

  else if (varBMI >=20 && varBMI <=25) {
     form.my_comment.value="Normalgewicht";
  }

  else if (varBMI >=18 && varBMI <21) {
     form.my_comment.value="leichtes Untergewicht";
  }

  else if (varBMI >=16 && varBMI <18) {
     form.my_comment.value="deutliches Untergewicht";
  }

  else if (varBMI <16) {
     form.my_comment.value="kritisches Untergewicht";
  }
 }
 return;
}

