<!-- //
function makewin(targurl, width, height, winopts){if(window.sidebars == null){sidebars = new Object;sidebars.length = 1;}allopts ="width=" + width + ",height=" + height + "," + winopts;var tempref = window.open(targurl, "sidebar" + sidebars.length, allopts);sidebars[sidebars.length] = tempref;sidebars.length++;}
function killwins(){if(navigator.appName !="Microsoft Internet Explorer"){if(window.sidebars != null){for(i = 1; i < sidebars.length; i++){sidebars[i].close();}}}}
function MM_reloadPage(init){if(init==true) with(navigator){if((appName=="Netscape")&&(parseInt(appVersion)==4)){document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage;}} else if(innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();}MM_reloadPage(true);
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}function ClearForm(form){

    form.weight.value ="";
    form.height.value ="";
    form.bmi.value ="";
    form.my_comment.value ="";

}

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("\nPlease complete the form first");
            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("\nReally know what you're doing? \nPlease enter values again. \nWeight in kilos and \nheight in cm");
                ClearForm(form);
                return false;
       }
       return true;

}

function computeform(form) {

       if (checkform(form)) {

       yourbmi=Math.round(bmi(form.weight.value, form.height.value/100));
       form.bmi.value=yourbmi;

       if (yourbmi >40) {
          form.my_comment.value=" Grossly Obese";
       }

       else if (yourbmi >30 && yourbmi <=40) {
          form.my_comment.value="Obese";
       }

       else if (yourbmi >=26 && yourbmi <30) {
          form.my_comment.value="Between acceptable and obese";

       }

       else if (yourbmi >20 && yourbmi <=25) {
          form.my_comment.value="Acceptable";

       }

       else if (yourbmi >=18 && yourbmi <20) {
          form.my_comment.value="Mild Starvation";

       }

       else if (yourbmi >=16 && yourbmi <18) {
          form.my_comment.value="Between mild and severe starvation";

       }

       else if (yourbmi <16) {
          form.my_comment.value="Severe Starvation ";
       }

       }
       return;
}
//-->