// BMI Calculator
function bmi()
{
	var bmi;
	var height;
	var weight;
	height = document.BMIForm.bmiheight.value;
	height = eval(height / 100);
	weight = document.BMIForm.bmiweight.value;
	bmi = eval(weight / (height * height));
	bmi = Math.round(bmi);
	if(bmi < 19)
		document.BMIForm.bmiresult.value = "Score: " + bmi + " - Danger please see a doctor.";
	else if (bmi >18 && bmi < 26)
		document.BMIForm.bmiresult.value = "Score: " + bmi + " - You are in great health.";
	else if (bmi > 25 && bmi < 31)
		document.BMIForm.bmiresult.value = "Score: " + bmi + " - You are beginning to retain fat.";
	else if (bmi > 30 && bmi < 41)
		document.BMIForm.bmiresult.value = "Score: " + bmi + " - You need to reduce your body fat";
	else if (bmi > 40 && bmi < 51)
		document.BMIForm.bmiresult.value = "Score: " + bmi + " - You are out of shape.";
	else if (bmi > 51)
		document.BMIForm.bmiresult.value = "Score: " + bmi + " - Danger please see a doctor.";
}

//Waist To Hip Calculator
function whr()
{
	var whr;
	var waist;
	var hip;
	var sex;
	waist = document.WHRForm.whrwaist.value;
	hip = document.WHRForm.whrhip.value;
	for (i=0; i < document.WHRForm.whrsex.length; i++) {
      if (document.WHRForm.whrsex[i].checked) {
	  	sex = document.WHRForm.whrsex[i].value;
      }
  	}
	whr = waist / hip;
	if (sex = "Female") {
		if (whr <= 0.8)
			document.WHRForm.whrresults.value = "Score: " + whr.toFixed(2) + " - Your body fat is in a healthy range!";
		else if (whr > 0.8)
			document.WHRForm.whrresults.value = "Score: " + whr.toFixed(2) + " - Please address exercise & eating habits!";
	}
	if (sex = "Male") {
		if (whr <= 0.9)
			document.WHRForm.whrresults.value = "Score: " + whr.toFixed(2) + " - Your body fat is in a healthy range!";
		else if (whr > 0.9)
			document.WHRForm.whrresults.value = "Score: " + whr.toFixed(2) + " - Please address exercise & eating habits!";
	}
}