
//Copyright (c) 2002-2003 Lexabean Consulting, LLC. All Rights Reserved.
//
// This computer software is owned by Lexabean Consulting, LLC and is
// protected by U.S. copyright laws and other laws and by international
// treaties. This computer software is furnished by Lexabean Consulting, LLC,
// pursuant to a written license agreement and may be used, copied,
//transmitted, and stored only in accordance with the terms of such
// license and with the inclusion of the above copyright notice. This
// computer software or any other copies thereof may not be provided or
// otherwise made available to any other person.
//


function calcBMIMet(form)
{
	var SelMeters= (form.MetersTF.value)
	var SelKGS = (form.KgsTF.value)

	//
	//BMI calculation for Metric units:
	// BMI= (Weight in Kilograms)/((Height in Meters)*(Height in Meters))
	//
	
	
	var BMI = (parseFloat(SelKGS)/(parseFloat(SelMeters) * parseFloat(SelMeters)))
	
	//
	//round value to 2 decimals
	//
	var rnded_BMI_int = parseInt(BMI)
	var rnded_BMI_dec = parseInt((BMI - parseFloat(rnded_BMI_int)) * 100)

	//document.write("BMI=" + rnded_BMI_int + "." + rnded_BMI_dec)
	form.BMIMeter.value= rnded_BMI_int + "." + rnded_BMI_dec

	return true
}

function calcBMIEng(form)
{
	var SelFeet= (form.Feet.options[form.Feet.selectedIndex].value)
	var SelInches = (form.Inches.options[form.Inches.selectedIndex].value)
	var SelLBS = (form.PoundsTF.value)

	var Hght_inches = (parseInt(SelFeet) * 12) + parseInt(SelInches)

	//
	//BMI calculation for english units:
	// BMI= (Weight in Pounds)/((Height in Inches)*(Height in Inches))
	//BMI = BMI*703
	//
	
	var BMI = (parseFloat(SelLBS)/(parseFloat(Hght_inches) * parseFloat(Hght_inches))) * 703
	
	//
	//round value to 2 decimals
	//
	var rnded_BMI_int = parseInt(BMI)
	var rnded_BMI_dec = parseInt((BMI - parseFloat(rnded_BMI_int)) * 100)

	//document.write("BMI=" + rnded_BMI_int + "." + rnded_BMI_dec)
	form.BMI.value= rnded_BMI_int + "." + rnded_BMI_dec

	return true
}
