// JavaScript Document
//BMI
function Clear(form){
        form.w.value="";
        form.feet.value="";
        form.h.value="";
        form.bmi.value="";
        form.body1.value="";
}
function something(w,feet,h){
        width=w*.45359237;
        height=feet*12;
        height=height-(-h);
        height=height*.0254;
        height=height*height;
        index=width/height;
        return index;
}
function check(form){
        if (form.w.value==null || form.w.value.length==0 || form.feet.value==null || form.feet.value.length==0 || form.h.value==null){
        alert("You must enter a number.");
        return false;
}
else if (parseFloat(form.feet.value)<=0 ||
         parseFloat(form.feet.value)>=9 ||
         parseFloat(form.h.value)<0 ||
         parseFloat(form.h.value)>12 ||
         parseFloat(form.w.value)<=0 ||
         parseFloat(form.w.value)>=801){
        alert("Are you sure? Please enter values again.");
        Clear(form);
        return false;
        }
        return true;
}
function comp(form){
        if(check(form)){
        your=something(form.w.value,form.feet.value,form.h.value);
        }
if(your<19){
        alert("This BMI falls below the range for most people.  You may want to recheck your entries, or, for an individualized assessment, see your physician.");
        form.bmi.value=your;
        form.body1.value=your;
        }
else{
        form.bmi.value=your;
        form.body1.value=your;
        }
        return;
}