
var bmiQuestions = new Array(
	"What is BMI ?",
	"Additional Risk Factors",
	"How to Lose Weight ?",
	"Waist to Hip Ratio",
	"Some of health risk associated with Obesity",
	"General Exclutions to BMI Measurements",
	"Exclutions For any Weight loss Programs",
"");

var bmiAnswers = new Array(
	"The Body Mass Index (BMI) is used to assess weight problems and associated health risks. Once overweight is determined, other assessments - like the Hip Ratio - should follow.",
	"Additional risk factors for an overweight person are:\n1. Distribution of fat! For example: Fat that is more concentrated around the hips is generally not as risky as fat in the belly area.\n2. Medical and certain physical conditions (check with your physician to see if your medication may interfere with weight reduction or even promote weight gain.",
	"Several approaches are possible: A change in diet from weight promoting to so-called fat-burning food; Exercise; Herbal assistance (for example: Green Tea and Kelp may increase the metabolic rate; Certain Herbs and Enzymes, like Bromelain, may help reduce fat; Garcinia cambogia and Hydroxycitric acid help to reduce appetite and fat; Pyruvate also reduces fat; There are a number of Thermogenic Herbs (which increases the metabolism and burns off fat); Samples of Thermogenic Herbs are: Ephedra, Garcinia cambogia, Fucus vesiculosis, Black and Green Tea, etc.; Minerals like chromium help regulate the blood sugar level. Recommended food items may include: Vegetables, Beans, Seeds, Grains, Nuts, cooked Chicken or Turkey with skin removed, and Fruit. Apples and unsweetend Pineapples may reduce fat directly. Barley, Beans and Olives will also reduce cholesterol. Rarely the real problem, there are also a number of herbs which may help to reduce water retention.",
	"Certain cancers, Hypertension, Cardiovascular disease (including: Coronary artery disease, Peripheral vascular disease, and Congestive heart failure), Dislipidemia (blood lipid levels usually change: Good cholesterol (HDL) may drop and Triglycerides may be higher), Adult-onset diabetes (Type II), Osteoarthritis, Sleep apnea, Hypoventilation syndrome, and a number of other conditions.",
	"When overweight is established, a waist-hip ratio may help to further assess a possible health risk. This ratio may be calculated but it easily observed as the difference beween a Pear-shape and an Apple-shape. Basically, a Pear-shape means fat is more stored in the area of thighs, hips and buttocks and means having a reduced risk. The Apple-shape means fat is stored in the abdominal area from where it can be more easily re-enter the blood stream.",
	"BMI is normally a good indication for weight problems. However, it should only be applied between the age of 19 - 70 years. BMI generally fails when applied to persons still growing or to asthletes where muscle build-up is extensive.",
	"BMI may not be useful for the following conditions: Pregnancies, Mental illnesses, Breast-feeding women, Anorexia nervosa, Osteoporosis and a number of other diseases and afflictions",
"");

function showAns(Q) {
	document.bmi.txtrAnswer.value = bmiAnswers[Q];
}

function mod(div,base) { return Math.round(div - (Math.floor(div/base)*base)); }

function calcBmi() {
	var w = document.bmi.weight.value * 1;
	var HeightFeetInt = document.bmi.htf.value * 1;
	var HeightInchesInt = document.bmi.hti.value * 1;
	HeightFeetConvert = HeightFeetInt * 12;
	h = HeightFeetConvert + HeightInchesInt;
	displaybmi = (Math.round((w * 703) / (h * h)));
	var rvalue = true;
	
	if ( (w <= 35) || (w >= 500)  || (h <= 48) || (h >= 120) ) {
		alert ("Invalid data.  Please check and re-enter!");
		rvalue = false;
	}
	
	if (rvalue) {
		if (HeightInchesInt > 11) {
			reminderinches = mod(HeightInchesInt,12);
			document.bmi.hti.value = reminderinches;
			document.bmi.htf.value = HeightFeetInt + 
			((HeightInchesInt - reminderinches)/12);
			document.bmi.answer.value = displaybmi;
		}
		if (displaybmi <19) document.bmi.comment.value = "Underweight";
		if (displaybmi >=19 && displaybmi <=25) document.bmi.comment.value = "Desirable";
		if (displaybmi >=26 && displaybmi <=29) document.bmi.comment.value = "prone to health risks";
		if (displaybmi >=30 && displaybmi <=40) document.bmi.comment.value = "Obese";
		if (displaybmi >40) document.bmi.comment.value = "Extremely obese";
		document.bmi.answer.value = displaybmi; 
	}
	//return rvalue;
}




document.write(''+
'<style type="text/css">'+
'.para {  font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; line-height: normal; font-weight: normal; color: #000000 }'+
'</style>'+
''+
'<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">'+
'	<form name=bmi>'+
'	<tr align="center" valign="top"><td><u><font face="Verdana, Arial, Helvetica, sans-serif" size="4" color="#DDFD60">Your Body Mass Index (BMI) Calculator</font></u></td></tr>'+
'	<tr><td>&nbsp;</td></tr>'+
'	<tr><td>'+
'		<table width="500" align="center" border="0" cellspacing="0" cellpadding="0">'+
'			<tr><td align="center" valign="middle">'+
'				<p class=MsoNormal style="margin-right:3pt;text-align:justify">'+
'				<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#FFFFCC"><u>Note:</u>The BMI Calculation is not always correct indication of obesity. All calcuations are approximations and may be wrong.</font>'+
'			</td></tr>'+
'			<tr><td>'+
'				<table border="0" align="center" width="450" cellspacing="0" cellpadding="4">'+
'					<tr><td align="right"><span class="para">Please enter your weight </span></td><td><span class="para"> :: <input type=text name=weight size=3 maxlength=3> lbs. (1 Kg = 2.20462 lbs)</span></td></tr>'+
'					<tr><td align="right"><span class="para">Please enter your height</span></td><td><span class="para"> :: <input type=text name=htf size=3 maxlength=1> Ft.&nbsp;<input type=text name=hti size=2 maxlength=2> In.</span></td></tr>'+
'					<tr><td colspan="2" align="center"><a href="javascript:calcBmi()"><img src="images/click.gif" border=0 alt=""></a></td></tr>'+
'					<tr><td align="right"><span class="para">Body Mass Index</span></td><td><span class="para"> :: <input type=text name=answer size=5></span></td></tr>'+
'					<tr><td colspan="2">'+
'						<span class="para">According to the Panel on Energy, Obesity, and Body Weight Standards published by American Journal of Clinical Nutrition, your category is <br>'+
'						<center><input type=text name=comment size=25></center>'+
'						</span>'+
'					</td></tr>'+
'				</table>'+
'			</td></tr>'+
'		</table>'+
'	</td></tr>'+
'	<tr><td>'+
'		<table border="0" align="center" cellspacing="0" cellpadding="2">');
for (i=0; i<bmiQuestions.length-1; i++) {
	document.write(''+
	'			<tr valign="top">'+
	'				<td width="3%" valign="middle"><img src="images/bullet.gif" width="9" height="10"></td>'+
	'				<td width="97%"><span class="para"><a href="javascript:showAns('+i+')">'+bmiQuestions[i]+'</a></span></td>'+
	'			</tr>');
}
document.write(''+
'			<tr><td colspan="2"><textarea name="txtrAnswer" rows="7" cols="65" readonly></textarea></td></tr>'+	
'		</table>'+
'	</td></tr>'+
'	</form>'+
'</table>'+
'');

