<!--
function clearState()
                {
                document.BMIcalcForm.IntState.value = '';
                }

// start functions to calculate and display bmr
   function calculateBmr(cHeight,cWeight,age){

if (document.BMIcalcForm.SexID[0].checked){

IBMR = 66.5 + (13.5*cWeight)+(5.0*cHeight)-(6.75*age)
return IBMR
}
else{
IBMR = 655.0 + (9.56*cWeight)+(1.8*cHeight)-(4.68*age)
return IBMR
}
}             
function displayBmr(){

if (document.BMIcalcForm.Mtype[1].checked)

					{

					if ((document.BMIcalcForm.HeightFeet.value == "")||(document.BMIcalcForm.HeightInches.value == "" )){

						alert("You must enter a value in the US Height field")

						if (document.BMIcalcForm.Weight.value == ""){

						alert("You must enter a value in the weight field");
						}
					return;
					}
						if (document.BMIcalcForm.Weight.value == ""){

						alert("You must enter a value in the weight field");

						return;

						}

					xWeight =  ConvertWeight(document.BMIcalcForm.Weight.value)

					mHeight = ConvertHeight()

					age = document.BMIcalcForm.age.value
			}
	else
			{
				if (document.BMIcalcForm.HeightCM.value == ""){

					alert("You must enter a value in the Metric Height field")

						if (document.BMIcalcForm.Weight.value == ""){

						alert("You must enter a value in the weight field");

						}

					return;

					}

					if (document.BMIcalcForm.Weight.value == ""){
						alert("You must enter a value in the weight field");
						return;
						}
					xWeight =  document.BMIcalcForm.Weight.value
					mHeight = document.BMIcalcForm.HeightCM.value
					age = document.BMIcalcForm.age.value
					}
BMR = calculateBmr(mHeight, xWeight, age )
BMR = Math.round(BMR)
document.BMIcalcForm.BMR.value = BMR
}
// end functions to calculate and display bmi
// start weight and height conversion functions
function ConvertHeight(){
	  if (document.BMIcalcForm.Mtype[1].checked)
		{
 iHeight = parseInt(document.BMIcalcForm.HeightFeet.value)*12 + parseInt(document.BMIcalcForm.HeightInches.value);
 mHeight2 = iHeight * 2.54;
		}
else {
	iHeight = document.BMIcalcForm.HeightCM.value
	mHeight2 = iHeight
	}
return mHeight2
}
function ConvertWeight(cWeight){
kWeight=cWeight/2.2
return kWeight
}
// end weight and height conversion functions
// -->
