function WHR()
{
  spacebool = new Boolean(false)
   if(( spacebool =  validatespaces())== true)
     validateForm()
}

function validatespaces()
{
form1 = document.forms["whr"]
if(form1.waist.value =="" || form1.hips.value =="")
{
alert("You haven't filled in the Waist or Hips Measurement")
return false
}
return true
}

function validateForm()
{
 form1 = document.forms["whr"]
 w  = new Number(form1.waist.value) 
 h  = new Number(form1.hips.value)
 if((isNaN(w) || isNaN(h)))
 {
 alert("You haven't filled in the Waist or Hips in Digit")
 return false
 }
 else
 {
     j = new Number(w/h)
   form1.display.value = j;
    
     if(form1.SEX[0].checked)
   {
   form1.iratio.value = "0.95";
   if(j <= 0.95)
   form1.advice.value = "Normal - Keep It UP";
   
     if(j >0.95 && j <=1.2)
   form1.advice.value = "Obesity - Need TO Work";
   
   if(j >1.2)
   form1.advice.value =  "Grossly OverWeight";
   }
   else if(form1.SEX[1].checked)
   {
   form1.iratio.value = "0.8";
   if(j <= 0.8)
   form1.advice.value = "Normal - Keep It UP";
   
     if(j >0.8 && j <=1.2)
   form1.advice.value = "Obesity - Need TO Work";
   
   if(j >1.2)
   form1.advice.value =  "Grossly OverWeight";
   }
   
   }
}     

