// JavaScript Document

<!--

	function calculate(form) {
	var height=0
	var bmi=0
	var feet=parseFloat(document.form1.feet.value)
	var inches=parseFloat(document.form1.inches.value)
	if(document.form1.inches.value=="") inches=0
	var weight=parseFloat(document.form1.weight.value)
	
	<!--------- Error messages --------->
	if(document.form1.feet.value=="") alert("You must type in the patient's height")
	if(document.form1.weight.value=="") alert("You must type in the patient's weight")
	
	<!-- ---------------------------- -->
	height=12*feet*2.54/100+2.54*inches/100
	weight=weight/2.2 // lbs
	
	bmi=Math.round(weight/Math.pow(height,2)*10)/10
	//bmi=weight/Math.pow(height,2)
	if (!bmi)
	{
		form.bmi.value=""
		form.DesWeight.value = "";
		form.Goal.value = "";
	} else {
		form.bmi.value = bmi;
		if (bmi > 30) {
			var desweight = Math.round(2.2*30*Math.pow(height,2))
			var reduceLbs = (document.form1.weight.value) - (desweight);
			form.DesWeight.value = reduceLbs;
			form.Goal.value = desweight;
		} else {
			form.DesWeight.value = 0;
			form.Goal.value = "";
		}
	}
}

// -->