// JavaScript Document

<!-- Begin
function mod(div,base) {
return Math.round(div - (Math.floor(div/base)*base));
}
function calcBmi() {
var w = document.bmi.weight.value * 1;
var HeightFeetInt = document.bmi.htf.value * 1;
var HeightInchesInt = document.bmi.hti.value * 1;
HeightFeetConvert = HeightFeetInt * 12;
h = HeightFeetConvert + HeightInchesInt;
displaybmi = (Math.round(((w * 703) / (h * h))*10)/10);
var rvalue = true;
if ( (w <= 34) || (w >= 1000)  || (h <= 48) || (h >= 120) ) {
alert ("Check your data!");
rvalue = false;
}
if (rvalue) {
if (HeightInchesInt > 11) {
reminderinches = mod(HeightInchesInt,12);
document.bmi.hti.value = reminderinches;
document.bmi.htf.value = HeightFeetInt + 
((HeightInchesInt - reminderinches)/12);
document.bmi.answer.value = displaybmi;
}
if (displaybmi <18.5) 
document.bmi.comment.value = "Underweight";
if (displaybmi >=18.5 && displaybmi <=24.9) 
document.bmi.comment.value = "Normal";
if (displaybmi >=25 && displaybmi <=29.9) 
document.bmi.comment.value = "Overweight";
if (displaybmi >=30 && displaybmi <=34.9) 
document.bmi.comment.value = "Class I obesity";
if (displaybmi >=35 && displaybmi <=39.9) 
document.bmi.comment.value = "Class II obesity";
if (displaybmi >40) 
document.bmi.comment.value = "Class III obesity ";
document.bmi.answer.value = displaybmi; }
return rvalue;
}
//  End -->

<!-- Begin
function mod2(div,base) {
return Math.round(div - (Math.floor(div/base)*base));
}
function calcBmi2() {
var w = document.bmi2.weight2.value * 1;
var height = document.bmi2.height.value * 1;
h = height * 0.01;
displaybmi = (Math.round(((w) / (h * h))*10)/10);
var rvalue = true;
if ( (w <= 15) || (w >= 454)  || (height <= 122) || (height >= 305) ) {
alert ("Check your data!");
rvalue = false;
}
if (rvalue) {
if (displaybmi <18.5) 
document.bmi2.comment.value = "Underweight";
if (displaybmi >=18.5 && displaybmi <=24.9) 
document.bmi2.comment.value = "Normal";
if (displaybmi >=25 && displaybmi <=29.9) 
document.bmi2.comment.value = "Overweight";
if (displaybmi >=30 && displaybmi <=34.9) 
document.bmi2.comment.value = "Class I obesity";
if (displaybmi >=35 && displaybmi <=39.9) 
document.bmi2.comment.value = "Class II obesity";
if (displaybmi >40) 
document.bmi2.comment.value = "Class III obesity ";
document.bmi2.answer2.value = displaybmi; }
return rvalue;
}
//  End -->