function isEmpty (strValue){
return ((strValue == null) || (strValue.length == 0))
}

function calcBmi() {

var h1selectedItem = document.bmi.h1.selectedIndex;
var inth1 = document.bmi.h1.options[h1selectedItem].value;
var h2selectedItem = document.bmi.h2.selectedIndex;
var inth2 = document.bmi.h2.options[h2selectedItem].value;
var intw = document.bmi.w.value;
var strMessage1 = " ";
var strMessage2 = " ";

if (isEmpty(inth1) 

|| isEmpty(inth2) 

|| isEmpty(document.bmi.w.value)) {

alert("One or more questions left blank: please answer all questions.");

}

else {

var w = document.bmi.w.value * 1;
var HeightFeetInt = document.bmi.h1.value * 1;
var HeightInchesInt = document.bmi.h2.value * 1;
HeightFeetConvert = HeightFeetInt * 12;
h = HeightFeetConvert + HeightInchesInt;
displaybmi = (Math.round((w * 703) / (h * h)));
var rvalue = true;
if ( (w <= 35) || (w >= 500)  || (h <= 48) || (h >= 120) ) {
alert ("Invalid data.  Please check and re-enter!");
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 <19) 
strMessage2 = "Your category is: "+"Underweight";
if (displaybmi >=18.5 && displaybmi <=24.9) 
strMessage2 = "Your category is: "+"Normal";
if (displaybmi >=25 && displaybmi <=29.9) 
strMessage2 = "Your category is: "+"Overweight";
if (displaybmi >=30 && displaybmi <=34.9) 
strMessage2 = "Your category is: "+"Obesity";
if (displaybmi >=35 && displaybmi <=39.9) 
strMessage2 = "Your category is: "+"Severe Obesity";
if (displaybmi >=40)
strMessage2 = "Your category is: "+"Morbid Obesity";
if (displaybmi >=50)
strMessage2 = "Your category is: "+"Super Obesity";
strMessage1 = "Your Body Mass Index is: "+displaybmi;

change("content_right","setTEXT","","<div class='title_bar'><div class='title_text'>Body Mass Index Result</div></div><div class='text_section'><div class='text_normal'>"+strMessage1+"<br /><br />"+strMessage2+"<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /></div></div>");
}
}
