function getValue(varname) {

	var url = window.location.href;
	var qparts = url.split("?");
	if (qparts.length == 0) { return ""; }
	var query = qparts[1];
	var vars = query.split("&");
	var value = "";

	for (i=0;i<vars.length;i++) {
		var parts = vars[i].split("=");
		if (parts[0] == varname) {
			value = parts[1];
			break;
		}
	}
  
	value = unescape(value);
	value.replace(/\+/g," ");
	value = value.replace(/\<script/g," ");
	value = value.replace(/\.js/g," ");
	value = value.replace(/\<\/script\>/g," ");
	return value;

}

function popURL(opt) {

	if ( opt == 1 ) { url = url + '&option=1' }
	if ( opt == 2 ) { url = url1 }

	window.opener.location.href=url;
	self.close();

}

function navPage(url) {
	window.open(url,'_parent');
}

function goalsPop() {
//	var el = document.getElementById(id);
//	el.style.display = opt;
	var InputName = getValue("name"); // text
	var InputAge = getValue("age");	// 2-80
	var InputSex = getValue("gender");	// male, female
	var InputWgtN = getValue("weight");	// # pounds
	var InputHtfN = getValue("heightfeet");	// # inches
	var InputHtiN = getValue("heightinch");	// # inches
	var InputAct = getValue("activity");	// sed, low, active
	var InputOpt = getValue("option");	// # pounds
	var validwgt = getValue("validweight");	// # validweight
	var validhgt = getValue("validheight");	// # validheight
	var url = 'pop.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgtN+'&heightfeet='+InputHtfN+'&heightinch='+InputHtiN+'&activity='+InputAct+'&option='+InputOpt+'&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&';
	window.open(url,"popUpWindow2","width=400, height=300, toopbar=0, location=0, status=0, menubar=0, scrollbar=0, resizable=0");
}

	// April 20, 2005 - TC - IDOBI

	var InputName = getValue("name"); // text
	var InputAge = getValue("age");	// 2-80
	var InputSex = getValue("gender");	// male, female
	var InputAct = getValue("activity");	// sed, low, active
	var InputWgt = getValue("weight");	// # pounds
	if (InputAge < 9) { InputWgt = 0 }
	var InputHtf = getValue("heightfeet");	// # inches
	var InputHti = getValue("heightinch");	// # inches
	var InputWgtN = getValue("weightN");	// # pounds
	var InputHtfN = getValue("heightfeetN");	// # inches
	var InputHtiN = getValue("heightinchN");	// # inches
	var InputHgt = Math.round((getValue("heightfeet") * 12)) + Math.round(getValue("heightinch"));	// # inches
	var InputOpt = getValue("option");	// # pounds
	var validwgt = getValue("validweight");	// # validweight
	var validhgt = getValue("validheight");	// # validheight
	var InputCalories = getValue("inputCal");	// # compare calories
	var BMI = 0;
	var url = 'results.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgt+'&heightfeet='+InputHtf+'&heightinch='+InputHti+'&activity='+InputAct+'&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var url1 = 'results.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgtN+'&heightfeet='+InputHtfN+'&heightinch='+InputHtiN+'&activity='+InputAct+'&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var url2 = 'warn.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgt+'&heightfeet='+InputHtf+'&heightinch='+InputHti+'&activity='+InputAct+'&option=99&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var urlEdit = 'planner_edit_profile_confirm.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgt+'&heightfeet='+InputHtf+'&heightinch='+InputHti+'&activity='+InputAct+'&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var urlEdit1 = 'planner_edit_profile_confirm.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgtN+'&heightfeet='+InputHtfN+'&heightinch='+InputHtiN+'&activity='+InputAct+'&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var urlEdit2 = 'planner_editTransition.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgt+'&heightfeet='+InputHtf+'&heightinch='+InputHti+'&activity='+InputAct+'&option=99&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var urlAdd = 'planner_add_family_confirm.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgt+'&heightfeet='+InputHtf+'&heightinch='+InputHti+'&activity='+InputAct+'&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var urlAdd1 = 'planner_add_family_confirm.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgtN+'&heightfeet='+InputHtfN+'&heightinch='+InputHtiN+'&activity='+InputAct+'&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var urlAdd2 = 'planner_addTransition.html?name='+InputName+'&age='+InputAge+'&gender='+InputSex+'&weight='+InputWgt+'&heightfeet='+InputHtf+'&heightinch='+InputHti+'&activity='+InputAct+'&option=99&originalweight='+InputWgt+'&validweight='+validwgt+'&validheight='+validhgt+'&weightN='+InputWgtN+'&heightfeetN='+InputHtfN+'&heightinchN='+InputHtiN+'&';
	var OutputCalories = 0;

	if (validwgt > 0) {
		CInputWgt = InputWgt;
		// <b>'+InputWgt+'</b> pounds
		weighttext = ', <b>'+InputWgt+'</b> pounds';
	} else {
		CInputWgt = InputWgtN;
		weighttext = ', of average weight';
//		weighttext = '';
		if (CInputWgt < 1) { CInputWgt = InputWgt }
	}

	if (validhgt > 0) {
		CInputHgt = InputHgt;
		CInputHtf = InputHtf;
		CInputHti = InputHti;
		// <b>'+InputHtf+'</b> feet <b>'+InputHti+'</b> inches tall
		heighttext = ', <b>'+InputHtf+'</b> feet <b>'+InputHti+'</b> inches tall';
	} else {
		CInputHgt = Math.round(InputHtfN * 12) + Math.round(InputHtiN);	
		CInputHtf = InputHtfN;
		CInputHti = InputHtiN;
		heighttext = ', of average height';
//		heighttext = '';
		if (CInputHtf < 1) { 
			CInputHtf = InputHtf;
			CInputHti = InputHti;
		}
	}

	if (InputOpt == "1" || InputOpt == "2" || InputOpt == "3" || InputOpt == "4") {
		weighttext = ', of average weight';
	}

	if ( CInputWgt > 0 && CInputHgt > 0) {
		BMI = Math.round(((CInputWgt / (CInputHgt * CInputHgt)) * 703) * 100) / 100;
		if (BMI != 18.5) { Math.round(BMI) }
	}

///	alert('BMI = ' + BMI + ': Weight = ' + CInputWgt+': Height = ' + CInputHgt + ': InputHtfN = ' + InputHtfN + ': validhgt = ' + validhgt);

	var minBMIb = new Array(15,14,14,14,14,14,13.86747174,14.07936677,14.37920031,14.75988661,15.2111263,15.71971118,16.26979755,16.84323264,17.41995236,17.97833773,18.49520062);
	var maxBMIb = new Array(19,18,18,18,18,19,20.56933216,21.61938426,22.68718928,23.72897155,24.71352325,25.62255542,26.45091448,27.20682538,27.91225209,28.60329919,29.33030127);
	var minBMIg = new Array(14,14,14,14,13,13,13.63077388,13.87942647,14.21040706,14.61099007,15.06558978,15.55572457,16.05992392,16.55358366,17.00880162,17.39427286,17.67537444);
	var maxBMIg = new Array(19,18,18,18,19,20,21.24727049,22.39788709,23.56546313,24.70603086,25.78730634,26.78861781,27.70078892,28.52601678,29.27780966,29.98109225,30.67259539);

	var medianBMIb = new Array(0,0,0,0,0,0,15.96169481,16.39605916,16.91512487,17.50138161,18.1387275,18.81201584,19.50672885,20.20858236,20.90294449,21.57417053,22.20541249);
	var medianBMIg = new Array(0,0,0,0,0,0,16.05516984,16.57626713,17.16096656,17.78355575,18.42002284,19.04811118,19.64746266,20.19980767,20.6891237,21.10163241,21.42548351);

	if (InputSex == "male") {

		if (InputAct == "sed") {
			if (InputAge >= 2 	&& InputAge <= 3)	{ OutputCalories = 1000; }
			if (InputAge >= 4 	&& InputAge <= 5)	{ OutputCalories = 1200; }
			if (InputAge >= 6 	&& InputAge <= 8)	{ OutputCalories = 1400; }
			if (InputAge >= 9 	&& InputAge <= 10)	{ OutputCalories = 1600; }
			if (InputAge >= 11 	&& InputAge <= 12)	{ OutputCalories = 1800; }
			if (InputAge >= 13 	&& InputAge <= 14)	{ OutputCalories = 2000; }
			if (InputAge == 15)						{ OutputCalories = 2200; }
			if (InputAge >= 16 	&& InputAge <= 18)	{ OutputCalories = 2400; }
			if (InputAge >= 19 	&& InputAge <= 20)	{ OutputCalories = 2600; }
			if (InputAge >= 21 	&& InputAge <= 40)	{ OutputCalories = 2400; }
			if (InputAge >= 41 	&& InputAge <= 60)	{ OutputCalories = 2200; }
			if (InputAge >= 61 	&& InputAge <= 110)	{ OutputCalories = 2000; }
			OutputAct = "less than 30 minutes";
		}

		if (InputAct == "low") {
			if (InputAge == 2 )						{ OutputCalories = 1000; }
			if (InputAge >= 3 	&& InputAge <= 5)	{ OutputCalories = 1400; }
			if (InputAge >= 6 	&& InputAge <= 8)	{ OutputCalories = 1600; }
			if (InputAge >= 9 	&& InputAge <= 10)	{ OutputCalories = 1800; }
			if (InputAge == 11)						{ OutputCalories = 2000; }
			if (InputAge >= 12 	&& InputAge <= 13)	{ OutputCalories = 2200; }
			if (InputAge == 14)						{ OutputCalories = 2400; }
			if (InputAge == 15)						{ OutputCalories = 2600; }
			if (InputAge >= 16 	&& InputAge <= 25)	{ OutputCalories = 2800; }
			if (InputAge >= 26 	&& InputAge <= 45)	{ OutputCalories = 2600; }
			if (InputAge >= 46 	&& InputAge <= 65)	{ OutputCalories = 2400; }
			if (InputAge >= 66 	&& InputAge <= 110)	{ OutputCalories = 2200; }
			OutputAct = "30 to 60 minutes";
		}

		if (InputAct == "active") {
			if (InputAge == 2 )						{ OutputCalories = 1000; }
			if (InputAge == 3 )						{ OutputCalories = 1400; }
			if (InputAge >= 4 	&& InputAge <= 5)	{ OutputCalories = 1600; }
			if (InputAge >= 6 	&& InputAge <= 7)	{ OutputCalories = 1800; }
			if (InputAge >= 8 	&& InputAge <= 9)	{ OutputCalories = 2000; }
			if (InputAge >= 10 	&& InputAge <= 11)	{ OutputCalories = 2200; }
			if (InputAge == 12)						{ OutputCalories = 2400; }
			if (InputAge == 13)						{ OutputCalories = 2600; }
			if (InputAge == 14)						{ OutputCalories = 2800; }
			if (InputAge == 15)						{ OutputCalories = 3000; }
			if (InputAge >= 16 	&& InputAge <= 18)	{ OutputCalories = 3200; }
			if (InputAge >= 19 	&& InputAge <= 35)	{ OutputCalories = 3000; }
			if (InputAge >= 36 	&& InputAge <= 55)	{ OutputCalories = 2800; }
			if (InputAge >= 56 	&& InputAge <= 75)	{ OutputCalories = 2600; }
			if (InputAge >= 76 	&& InputAge <= 110)	{ OutputCalories = 2400; }
			OutputAct = "more than 60 minutes";
		}

	}

	if (InputSex == "female") {

		if (InputAct == "sed") {
			if (InputAge >= 2 	&& InputAge <= 3)	{ OutputCalories = 1000; }
			if (InputAge >= 4 	&& InputAge <= 7)	{ OutputCalories = 1200; }
			if (InputAge >= 8 	&& InputAge <= 10)	{ OutputCalories = 1400; }
			if (InputAge >= 11 	&& InputAge <= 13)	{ OutputCalories = 1600; }
			if (InputAge >= 14 	&& InputAge <= 18)	{ OutputCalories = 1800; }
			if (InputAge >= 19 	&& InputAge <= 25)	{ OutputCalories = 2000; }
			if (InputAge >= 26 	&& InputAge <= 50)	{ OutputCalories = 1800; }
			if (InputAge >= 51 	&& InputAge <= 110)	{ OutputCalories = 1600; }
			OutputAct = "less than 30 minutes";
		}

		if (InputAct == "low") {
			if (InputAge == 2 )						{ OutputCalories = 1000; }
			if (InputAge == 3 )						{ OutputCalories = 1200; }
			if (InputAge >= 4 	&& InputAge <= 6)	{ OutputCalories = 1400; }
			if (InputAge >= 7 	&& InputAge <= 9)	{ OutputCalories = 1600; }
			if (InputAge >= 10 	&& InputAge <= 11)	{ OutputCalories = 1800; }
			if (InputAge >= 12 	&& InputAge <= 18)	{ OutputCalories = 2000; }
			if (InputAge >= 19 	&& InputAge <= 25)	{ OutputCalories = 2200; }
			if (InputAge >= 26 	&& InputAge <= 50)	{ OutputCalories = 2000; }
			if (InputAge >= 51 	&& InputAge <= 110)	{ OutputCalories = 1800; }
			OutputAct = "30 to 60 minutes";
		}

		if (InputAct == "active") {
			if (InputAge == 2 )						{ OutputCalories = 1000; }
			if (InputAge >= 3 	&& InputAge <= 4)	{ OutputCalories = 1400; }
			if (InputAge >= 5 	&& InputAge <= 6)	{ OutputCalories = 1600; }
			if (InputAge >= 7 	&& InputAge <= 9)	{ OutputCalories = 1800; }
			if (InputAge >= 10 	&& InputAge <= 11)	{ OutputCalories = 2000; }
			if (InputAge >= 12 	&& InputAge <= 13)	{ OutputCalories = 2200; }
			if (InputAge >= 14 	&& InputAge <= 30)	{ OutputCalories = 2400; }
			if (InputAge >= 31 	&& InputAge <= 60)	{ OutputCalories = 2200; }
			if (InputAge >= 61 	&& InputAge <= 110)	{ OutputCalories = 2000; }
			OutputAct = "more than 60 minutes";
		}

	}

// TEE Calculations

//	var BMI_WeightW = new Array(100,104,107,111,115,118,122,126,130,134,138,142,146,150,154,159,163,168,172);
//	var BMI_WeightM = new Array(105,109,112,116,120,124,128,132,136,140,144,149,153,157,162,166,171,176,180);

//	var tempHeightInchesMod = Math.round(InputHtf * 12) + Math.round(InputHti) - 57;
//	if (tempHeightInchesMod < 0) { tempHeightInchesMod = 0 }

//	m = ((feet * 30.48) + (inches * 2.54)) * 100
//	kg = lbs * 0.45359

	var EER = 0;

	var REF_WeightM = new Array(12.7,14.3,16.2,18.4,20.7,23.1,25.6,28.6,31.9,35.9,40.5,45.6,51.0,56.3,60.9,64.6,67.2,70.0);
	var REF_WeightW = new Array(12.1,13.9,15.8,17.9,20.2,22.8,25.6,29.0,32.9,37.2,41.6,45.8,49.4,52.0,53.9,55.1,56.2,57.0);

	var REF_HeightM = new Array(0,0.95,1.02,1.09,1.15,1.22,1.28,1.34,1.39,1.44,1.49,1.56,1.64,1.70,1.74,1.75,1.76,1.77);
	var REF_HeightW = new Array(0,0.94,1.01,1.08,1.15,1.21,1.28,1.33,1.38,1.44,1.51,1.57,1.60,1.62,1.63,1.63,1.63,1.63);

	var calculatedMetricHeight = (Math.round(CInputHtf * 12) + Math.round(CInputHti))/39.37;
	var calculatedMetricWeight = Math.round(Math.round(CInputWgt) / 2.2);

	var ref_ageMod = InputAge - 2;
	if (ref_ageMod > 17) { ref_ageMod = 17 }

	if (InputSex == "male") {

		var IdealWgt = REF_WeightM[ref_ageMod];
		if (InputAge >= 19) { 
			var IdealWgt = 22.5*(calculatedMetricHeight*calculatedMetricHeight);
		}

		if (InputAct == "sed") {
			if (InputAge == 2 ) { 
				PA = 1; 
				EER = ((89 * calculatedMetricWeight) - 100) + 20;
				EERIdeal = ((89 * IdealWgt) - 100) + 20;
			}
			if (InputAge >= 3 	&& InputAge <= 8)	{ 
				PA = 1; 
				EER = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * calculatedMetricWeight) + (903 * REF_HeightM[ref_ageMod]))) + 20;
				EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * REF_HeightM[ref_ageMod]))) + 20;
			}
			if (InputAge >= 9 	&& InputAge <= 18)	{ 
				PA = 1; 
				EER = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * calculatedMetricWeight) + (903 * calculatedMetricHeight))) + 20;
				EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * calculatedMetricHeight))) + 20;
				if (validhgt > 0 || validwgt > 0) {
					IdealWgt = medianBMIb[ref_ageMod] * calculatedMetricHeight * calculatedMetricHeight;
					EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * calculatedMetricHeight))) + 20;
				}
			}
			if (InputAge >= 19) { 
				PA = 1; 
				EER = 864 - ( 9.72 * Math.round(InputAge) ) + (PA * ((14.2 * calculatedMetricWeight) + (503 * calculatedMetricHeight)));
				EERIdeal = 864 - ( 9.72 * Math.round(InputAge) ) + (PA * ((14.2 * IdealWgt) + (503 * calculatedMetricHeight)));
			}
			OutputAct = "less than 30 minutes";
		}

		if (InputAct == "low") {
			if (InputAge == 2 ) { 
				PA = 1; 
				EER = ((89 * calculatedMetricWeight) - 100) + 20;
				EERIdeal = ((89 * IdealWgt) - 100) + 20;
			}
			if (InputAge >= 3 	&& InputAge <= 8)	{ 
				PA = 1.13; 
				EER = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * calculatedMetricWeight) + (903 * REF_HeightM[ref_ageMod]))) + 20;
				EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * REF_HeightM[ref_ageMod]))) + 20;
			}
			if (InputAge >= 9 	&& InputAge <= 18)	{ 
				PA = 1.13; 
				EER = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * calculatedMetricWeight) + (903 * calculatedMetricHeight))) + 20;
				EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * calculatedMetricHeight))) + 20;
				if (validhgt > 0 || validwgt > 0) {
					IdealWgt = medianBMIb[ref_ageMod] * calculatedMetricHeight * calculatedMetricHeight;
					EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * calculatedMetricHeight))) + 20;
				}
			}
			if (InputAge >= 19) { 
				PA = 1.12; 
				EER = 864 - ( 9.72 * Math.round(InputAge) ) + (PA * ((14.2 * calculatedMetricWeight) + (503 * calculatedMetricHeight)));
				EERIdeal = 864 - ( 9.72 * Math.round(InputAge) ) + (PA * ((14.2 * IdealWgt) + (503 * calculatedMetricHeight)));
			}
			OutputAct = "30 to 60 minutes";
		}

		if (InputAct == "active") {
			if (InputAge == 2 ) { 
				PA = 1; 
				EER = ((89 * calculatedMetricWeight) - 100) + 20;
				EERIdeal = ((89 * IdealWgt) - 100) + 20;
			}
			if (InputAge >= 3 	&& InputAge <= 8)	{ 
				PA = 1.26; 
				EER = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * calculatedMetricWeight) + (903 * REF_HeightM[ref_ageMod]))) + 20;
				EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * REF_HeightM[ref_ageMod]))) + 20;
			}
			if (InputAge >= 9 	&& InputAge <= 18)	{ 
				PA = 1.26; 
				EER = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * calculatedMetricWeight) + (903 * calculatedMetricHeight))) + 20;
				EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * calculatedMetricHeight))) + 20;
				if (validhgt > 0 || validwgt > 0) {
					IdealWgt = medianBMIb[ref_ageMod] * calculatedMetricHeight * calculatedMetricHeight;
					EERIdeal = 88.5 - ( 61.9 * Math.round(InputAge) ) + (PA * ((26.7 * IdealWgt) + (903 * calculatedMetricHeight))) + 20;
				}
			}
			if (InputAge >= 19) { 
				PA = 1.27; 
				EER = 864 - ( 9.72 * Math.round(InputAge) ) + (PA * ((14.2 * calculatedMetricWeight) + (503 * calculatedMetricHeight)));
				EERIdeal = 864 - ( 9.72 * Math.round(InputAge) ) + (PA * ((14.2 * IdealWgt) + (503 * calculatedMetricHeight)));
			}
			OutputAct = "more than 60 minutes";
		}

	}

	if (InputSex == "female") {

		var IdealWgt = Math.round(REF_WeightW[ref_ageMod]);
		if (InputAge >= 19) { 
			var IdealWgt = 21.5*(calculatedMetricHeight*calculatedMetricHeight);
		}

		if (InputAct == "sed") {
			if (InputAge == 2 ) { 
				PA = 1; 
				EER = ((89 * calculatedMetricWeight) - 100) + 20;
				EERIdeal = ((89 * IdealWgt) - 100) + 20;
			}
			if (InputAge >= 3 	&& InputAge <= 8)	{ 
				PA = 1; 
				EER = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * calculatedMetricWeight) + (934 * REF_HeightW[ref_ageMod]))) + 20;
				EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * REF_HeightW[ref_ageMod]))) + 20;
			}
			if (InputAge >= 9 	&& InputAge <= 18)	{ 
				PA = 1; 
				EER = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * calculatedMetricWeight) + (934 * calculatedMetricHeight))) + 25;
				EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * calculatedMetricHeight))) + 25;
				if (validhgt > 0 || validwgt > 0) {
					IdealWgt = medianBMIg[ref_ageMod] * calculatedMetricHeight * calculatedMetricHeight;
					EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * calculatedMetricHeight))) + 25;
				}
			}
			if (InputAge >= 19) { 
				PA = 1; 
				EER = 387 - ( 7.31 * InputAge ) + (PA * ((10.9 * calculatedMetricWeight) + (660.7 * calculatedMetricHeight)));
				EERIdeal = 387 - ( 7.31 * InputAge ) + (PA * ((10.9 * IdealWgt) + (660.7 * calculatedMetricHeight)));
			}
			OutputAct = "less than 30 minutes";
		}

		if (InputAct == "low") {
			if (InputAge == 2 ) { 
				PA = 1; 
				EER = ((89 * calculatedMetricWeight) - 100) + 20;
				EERIdeal = ((89 * IdealWgt) - 100) + 20;
			}
			if (InputAge >= 3 	&& InputAge <= 8)	{ 
				PA = 1.16; 
				EER = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * calculatedMetricWeight) + (934 * REF_HeightW[ref_ageMod]))) + 20;
				EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * REF_HeightW[ref_ageMod]))) + 20;
			}
			if (InputAge >= 9 	&& InputAge <= 18)	{ 
				PA = 1.16; 
				EER = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * calculatedMetricWeight) + (934 * calculatedMetricHeight))) + 25;
				EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * calculatedMetricHeight))) + 25;
				if (validhgt > 0 || validwgt > 0) {
					IdealWgt = medianBMIg[ref_ageMod] * calculatedMetricHeight * calculatedMetricHeight;
					EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * calculatedMetricHeight))) + 25;
				}
			}
			if (InputAge >= 19) { 
				PA = 1.14; 
				EER = 387 - ( 7.31 * InputAge ) + (PA * ((10.9 * calculatedMetricWeight) + (660.7 * calculatedMetricHeight)));
				EERIdeal = 387 - ( 7.31 * InputAge ) + (PA * ((10.9 * IdealWgt) + (660.7 * calculatedMetricHeight)));
			}
			OutputAct = "30 to 60 minutes";
		}

		if (InputAct == "active") {
			if (InputAge == 2 ) { 
				PA = 1; 
				EER = ((89 * calculatedMetricWeight) - 100) + 20;
				EERIdeal = ((89 * IdealWgt) - 100) + 20;
			}
			if (InputAge >= 3 	&& InputAge <= 8)	{ 
				PA = 1.31; 
				EER = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * calculatedMetricWeight) + (934 * REF_HeightW[ref_ageMod]))) + 20;
				EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * REF_HeightW[ref_ageMod]))) + 20;
			}
			if (InputAge >= 9 	&& InputAge <= 18)	{ 
				PA = 1.31; 
				EER = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * calculatedMetricWeight) + (934 * calculatedMetricHeight))) + 25;
				EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * calculatedMetricHeight))) + 25;
				if (validhgt > 0 || validwgt > 0) {
					IdealWgt = medianBMIg[ref_ageMod] * calculatedMetricHeight * calculatedMetricHeight;
					EERIdeal = 135.3 - ( 30.8 * InputAge ) + (PA * ((10 * IdealWgt) + (934 * calculatedMetricHeight))) + 25;
				}
			}
			if (InputAge >= 19) { 
				PA = 1.27; 
				EER = 387 - ( 7.31 * InputAge ) + (PA * ((10.9 * calculatedMetricWeight) + (660.7 * calculatedMetricHeight)));
				EERIdeal = 387 - ( 7.31 * InputAge ) + (PA * ((10.9 * IdealWgt) + (660.7 * calculatedMetricHeight)));
			}
			OutputAct = "more than 60 minutes";
		}

	}

	OutputAct = "<b>" + OutputAct + "</b>";

	EER = Math.round((EER / 100)/2)*200;
	EERIdeal = Math.round((EERIdeal / 100)/2)*200;

///	alert(BMI+' == '+InputAge+' == '+EER+' == '+EERIdeal);	

//	Normalize Results
	if (InputAge >= 9 && EER < 1600) { EER = 1600 }
	if (InputAge >= 9 && EERIdeal < 1600) { EERIdeal = 1600 }
	if (EER < 1000) { EER = 1000 }
	if (EERIdeal < 1000) { EERIdeal = 1000 }
	if (EER > 3200) { EER = 3200 }
	if (EERIdeal > 3200) { 
		EERIdeal = 3200;
		if (InputOpt != "9" && InputOpt != "10" && InputOpt != "11" && InputOpt != "" && EER == EERIdeal) { 
			EER = EER - 200;
		}
	}
	InputMod = 0;
	if (InputOpt == "4" || InputOpt == "3") {
		InputMod = 1;
	}
	if (InputOpt != "2" && InputOpt != "") { 
		if (EER == EERIdeal) { 
			EERIdeal = EERIdeal - 200 
			if (EERIdeal < 1600) { 
				EERIdeal = 1600; 
			}
			if (InputOpt == "10") {
				InputMod = 1;
			}
			if (InputOpt == "4" || InputOpt == "3") {
				InputMod = 0;
			}

		}
	}

//	-----------------

	OutputCalories = EERIdeal;
	if (InputOpt == "11" || InputOpt == "10" || InputOpt == "9" || InputOpt == "3" || InputOpt == "4" || InputOpt == "1" || InputOpt < 1) { 
		OutputCalories = EER;
		if (InputMod == "1") {
			OutputCalories = EERIdeal;
		}
	}
	if (InputAge < 9) {
		OutputCalories = EERIdeal;
	}

	if (InputOpt == "3" || InputOpt == "4") { 
		if (OutputCalories == InputCalories) {
			OutputCalories = OutputCalories - 200;
		}
	}
	
	if (InputOpt == "2") { 
		if (OutputCalories == InputCalories) {
			OutputCalories = OutputCalories + 200;
		}
	}
	
//	if (InputOpt == "5" && validhgt > 0 && validwgt > 0) { 
	if (InputOpt == "5") { 
		OutputCalories = EERIdeal;
	}
	

///	alert(BMI+' == '+InputAge+' == '+EER+' == '+EERIdeal+' == '+OutputCalories+' == Option #'+InputOpt);	

// End TEE Calculations
	

	// Keep these in the JavaScript as this is where the app pulls the goals and limits from.
	var CalculateGrains 		= 0;
	var CalculateVegetables 	= 0;
	var CalculateFruits 		= 0;
	var CalculateMilk 			= 0;
	var CalculateMeatBeans 		= 0;
	var CalculateGramsOils 		= 0;
	var CalculateCalories 		= 0;
	var CalculateDarkGreenVeg 	= 0;
	var CalculateOrangeVeg 		= 0;
	var CalculateBeansVeg 		= 0;
	var CalculateStarchyVeg 	= 0;
	var CalculateOtherVeg 		= 0;
	var CalculatedExtra			= 0;
	var CalculatedSaturatedFat	= 0;
	
	
	if (OutputCalories == 1000) {
		CalculateGrains 		= "3";
		CalculateVegetables 	= "1";
		CalculateFruits 		= "1";
		CalculateMilk 			= "2";
		CalculateMeatBeans 		= "2";
		CalculateGramsOils 		= "3";
		CalculateCalories 		= "165";
		CalculateDarkGreenVeg 	= "1";
		CalculateOrangeVeg 		= "1/2";
		CalculateBeansVeg 		= "1/2";
		CalculateStarchyVeg 	= "1 1/2";
		CalculateOtherVeg 		= "4";
		CalculatedExtra			= "165";
		CalculatedSaturatedFat	= "11";
	}
	if (OutputCalories == 1200) {
		CalculateGrains 		= "4";
		CalculateVegetables 	= "1.5";
		CalculateFruits 		= "1";
		CalculateMilk 			= "2";
		CalculateMeatBeans 		= "3";
		CalculateGramsOils 		= "4";
		CalculateCalories 		= "170";
		CalculateDarkGreenVeg 	= "1 1/2";
		CalculateOrangeVeg 		= "1";
		CalculateBeansVeg 		= "1";
		CalculateStarchyVeg 	= "2 1/2";
		CalculateOtherVeg 		= "4 1/2";
		CalculatedExtra			= "170";
		CalculatedSaturatedFat	= "13";
	}
	if (OutputCalories == 1400) {
		CalculateGrains 		= "5";
		CalculateVegetables 	= "1.5";
		CalculateFruits 		= "1.5";
		CalculateMilk 			= "2";
		CalculateMeatBeans 		= "4";
		CalculateGramsOils 		= "4";
		CalculateCalories 		= "170";
		CalculateDarkGreenVeg 	= "1 1/2";
		CalculateOrangeVeg 		= "1";
		CalculateBeansVeg 		= "1";
		CalculateStarchyVeg 	= "2 1/2";
		CalculateOtherVeg 		= "4 1/2";
		CalculatedExtra			= "170";
		CalculatedSaturatedFat	= "16";
	}
	if (OutputCalories == 1600) {
		CalculateGrains 		= "5";
		CalculateVegetables 	= "2";
		CalculateFruits 		= "1.5";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "5";
		CalculateGramsOils 		= "5";
		CalculateCalories 		= "130";
		CalculateDarkGreenVeg 	= "2";
		CalculateOrangeVeg 		= "1 1/2";
		CalculateBeansVeg 		= "2 1/2";
		CalculateStarchyVeg 	= "2 1/2";
		CalculateOtherVeg 		= "5 1/2";
		CalculatedExtra			= "130";
		CalculatedSaturatedFat	= "18";
	}
	if (OutputCalories == 1800) {
		CalculateGrains 		= "6";
		CalculateVegetables 	= "2.5";
		CalculateFruits 		= "1.5";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "5";
		CalculateGramsOils 		= "5";
		CalculateCalories 		= "195";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2";
		CalculateBeansVeg 		= "3";
		CalculateStarchyVeg 	= "3";
		CalculateOtherVeg 		= "6 1/2";
		CalculatedExtra			= "195";
		CalculatedSaturatedFat	= "20";
	}
	if (OutputCalories == 2000) {
		CalculateGrains 		= "6";
		CalculateVegetables 	= "2.5";
		CalculateFruits 		= "2";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "5.5";
		CalculateGramsOils 		= "6";
		CalculateCalories 		= "265";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2";
		CalculateBeansVeg 		= "3";
		CalculateStarchyVeg 	= "3";
		CalculateOtherVeg 		= "6 1/2";
		CalculatedExtra			= "265";
		CalculatedSaturatedFat	= "22";
	}
	if (OutputCalories == 2200) {
		CalculateGrains 		= "7";
		CalculateVegetables 	= "3";
		CalculateFruits 		= "2";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "6";
		CalculateGramsOils 		= "6";
		CalculateCalories 		= "290";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2";
		CalculateBeansVeg 		= "3";
		CalculateStarchyVeg 	= "6";
		CalculateOtherVeg 		= "7";
		CalculatedExtra			= "290";
		CalculatedSaturatedFat	= "24";
	}
	if (OutputCalories == 2400) {
		CalculateGrains 		= "8";
		CalculateVegetables 	= "3";
		CalculateFruits 		= "2";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "6.5";
		CalculateGramsOils 		= "7";
		CalculateCalories 		= "360";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2";
		CalculateBeansVeg 		= "3";
		CalculateStarchyVeg 	= "6";
		CalculateOtherVeg 		= "7";
		CalculatedExtra			= "360";
		CalculatedSaturatedFat	= "27";
	}
	if (OutputCalories == 2600) {
		CalculateGrains 		= "9";
		CalculateVegetables 	= "3.5";
		CalculateFruits 		= "2";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "6.5";
		CalculateGramsOils 		= "8";
		CalculateCalories 		= "410";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2 1/2";
		CalculateBeansVeg 		= "3 1/2";
		CalculateStarchyVeg 	= "7";
		CalculateOtherVeg 		= "8 1/2";
		CalculatedExtra			= "410";
		CalculatedSaturatedFat	= "29";
	}
	if (OutputCalories == 2800) {
		CalculateGrains 		= "10";
		CalculateVegetables 	= "3.5";
		CalculateFruits 		= "2.5";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "7";
		CalculateGramsOils 		= "8";
		CalculateCalories 		= "425";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2 1/2";
		CalculateBeansVeg 		= "3 1/2";
		CalculateStarchyVeg 	= "7";
		CalculateOtherVeg 		= "8 1/2";
		CalculatedExtra			= "425";
		CalculatedSaturatedFat	= "31";
	}
	if (OutputCalories == 3000) {
		CalculateGrains 		= "10";
		CalculateVegetables 	= "4";
		CalculateFruits 		= "2.5";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "7";
		CalculateGramsOils 		= "10";
		CalculateCalories 		= "510";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2 1/2";
		CalculateBeansVeg 		= "3 1/2";
		CalculateStarchyVeg 	= "9";
		CalculateOtherVeg 		= "10";
		CalculatedExtra			= "510";
		CalculatedSaturatedFat	= "33";
	}
	if (OutputCalories == 3200) {
		CalculateGrains 		= "10";
		CalculateVegetables 	= "4";
		CalculateFruits 		= "2.5";
		CalculateMilk 			= "3";
		CalculateMeatBeans 		= "7";
		CalculateGramsOils 		= "11";
		CalculateCalories 		= "650";
		CalculateDarkGreenVeg 	= "3";
		CalculateOrangeVeg 		= "2 1/2";
		CalculateBeansVeg 		= "3 1/2";
		CalculateStarchyVeg 	= "9";
		CalculateOtherVeg 		= "10";
		CalculatedExtra			= "650";
		CalculatedSaturatedFat	= "36";	
	}

// 	Milk exception for children <= 8
	if ( InputAge <= 8 && CalculateMilk > 2 ) { CalculateMilk = 2 }

	var CalculateWholeGrains	= CalculateGrains / 2;
	if (OutputCalories == 1600) { CalculateWholeGrains = 3 }

	var CalculateGrainsTxt			= "ounce";
	var CalculateVegetablesTxt 		= "cup";
	var CalculateFruitsTxt 			= "cup";
	var CalculateMilkTxt 			= "cup";
	var CalculateMeatBeansTxt 		= "ounce";

	var CalculateGramsOilsTxt 		= "teaspoon";

	var CalculateDarkGreenVegTxt	= "cups";
	var CalculateOrangeVegTxt 		= "cups";
	var CalculateBeansVegTxt 		= "cups";
	var CalculateStarchyVegTxt 		= "cups";
	var CalculateOtherVegTxt 		= "cups";

	if (CalculateGrains > 1) 		{ CalculateGrainsTxt		= "ounces"; }
	if (CalculateVegetables > 1) 	{ CalculateVegetablesTxt	= "cups"; }
	if (CalculateFruits > 1) 		{ CalculateFruitsTxt		= "cups"; }
	if (CalculateMilk > 1) 			{ CalculateMilkTxt			= "cups"; }
	if (CalculateMeatBeans > 1) 	{ CalculateMeatBeansTxt		= "ounces"; }

	if (CalculateGramsOils > 1) 	{ CalculateGramsOilsTxt		= "teaspoons"; }

	if (CalculateDarkGreenVeg == "1" || CalculateDarkGreenVeg == "1/2")	{ CalculateDarkGreenVegTxt	= "cup"; }
	if (CalculateOrangeVeg == "1" || CalculateOrangeVeg == "1/2") 		{ CalculateOrangeVegTxt		= "cup"; }
	if (CalculateBeansVeg == "1" || CalculateBeansVeg == "1/2") 		{ CalculateBeansVegTxt		= "cup"; }
	if (CalculateStarchyVeg == "1" || CalculateStarchyVeg == "1/2")		{ CalculateStarchyVegTxt	= "cup"; }
	if (CalculateOtherVeg == "1" || CalculateOtherVeg == "1/2") 		{ CalculateOtherVegTxt		= "cup"; }



	// Calculate PDF File
	var CalculatePDFResult = "";
	var CalculatePDFWorksheet = "";
	if (InputAge < 18) {
		CalculatePDFResult = 'results_' + OutputCalories + '_under18.pdf';
		CalculatePDFWorksheet = 'Worksheet_' + OutputCalories + '_under18.pdf';
		if (InputAge < 9) {
			CalculatePDFResult = 'results_' + OutputCalories + '_under9.pdf';
			CalculatePDFWorksheet = 'Worksheet_' + OutputCalories + '_under9.pdf';
		}
		if (InputAct == "active") {
			CalculatePDFWorksheet = 'Worksheet_' + OutputCalories + '_under18_60.pdf';
			if (InputAge < 9) {
				CalculatePDFWorksheet = 'Worksheet_' + OutputCalories + '_under9_60.pdf';
			}
		}
	} else {
		CalculatePDFResult = 'results_' + OutputCalories + '_18.pdf';
		CalculatePDFWorksheet = 'Worksheet_' + OutputCalories + '_18.pdf';
		if (InputAct == "active") {
			CalculatePDFWorksheet = 'Worksheet_' + OutputCalories + '_18_60.pdf';
		}
	}

	// HTML Friendly Output

	var HTMLPDFResults		= '<a href="../downloads/results/'+CalculatePDFResult+'" target="_blank">Click here to view and  print a PDF version of <b>your results</b>.</a>';
	var HTMLPDFWorksheet	= '<a href="../downloads/worksheets/'+CalculatePDFWorksheet+'" target="_blank">Click here to view and print a PDF of a helpful <b>Meal Tracking Worksheet</b>.</a>';

// January 26, 2007 - TC - IDOBI

// Pop Up and LaunchTransition Text
// 
// LaunchTransition Variables
// popText = left column
// popText2 = right column
// popTextComb = legacy variable
//
// Pop Up Variables
// introTextSmall = goals pop up text

	if (InputAge > 18 && CInputWgt > 0 && CInputHgt > 0) {

		if ((BMI >= 18.5 && BMI <= 25) || ( InputOpt == 1 ) || ( InputOpt == 2 ) || ( InputOpt == 3 ) || ( InputOpt == 4 ) || ( InputOpt == 9 ) ) {

			resultText = 'Eat these amounts from each food group daily. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. It is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day.)  Your calorie needs may be more or less than the average, so check your weight regularly. If you see unwanted weight gain or loss, <a class="mypyramid" href="adjust.html">adjust the amount you are eating</a>.';
			phyActText = 'Physical activity is also important for health. Adults should get at least 30 minutes of moderate level activity most days.  Longer or more vigorous activity can provide greater health benefits. <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity. <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for someone like you:  A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day.  Your calorie needs may be more or less than the average, so check your weight regularly. If you see unwanted weight gain or loss, <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			footerText = 'Physical activity is also important for health. Adults should get at least 30 minutes of moderate intensity physical activity most days. If you have any chronic health conditions, talk with a health care provider. They can help you plan a safe program.  Also check before starting a vigorous activity program if you are over 40 (men) or 50 (women).  Vigorous activities include such things as jogging and running. Click <a class="mypyramid" href="http://www.mypyramid.gov/pyramid/physical_activity.html">here</a> for more information about physical activity and health.';

			if ( InputOpt == 1 ) {

				resultText = 'This plan will meet the nutrient needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. Following this plan should lead to modest weight loss over time. It is not a therapeutic diet for any specific health problem. Talk with your health care provider about a diet and physical activity program that is right for you.  <a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Click here</a> for more information about weight loss diets.';
				phyActText = 'Physical activity is also important for health. About 60 minutes of moderate to vigorous activity most days can help you manage your body weight and prevent gradual gain. About 60 to 90 minutes daily can help you maintain weight loss. If you are inactive, work up to these amounts gradually. Check with a health care provider about increasing your level of physical activity.  They can help you plan a safe program. <a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm" target="_blank">Click here</a> (new window) for more information about physical activity for those who are very overweight.';

				introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Eating these amounts from each food group daily should lead to modest weight loss over time. It is not a therapeutic diet for any specific health problem. Talk with your health care provider about a diet and physical activity program that is right for you.';
				introTextSmall = introTextSmall + ' <a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Click here</a> for more information about weight loss diets.';
			}

			if ( InputOpt == 2 ) {

				resultText = 'Eating these amounts from each food group daily should help you gradually reach a healthier weight. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. It is based on average needs for a  <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Your calorie needs may be more or less than the average, so check your weight regularly. If you do not see gradual weight gain, <a class="mypyramid" href="adjust.html">adjust the amount you are eating</a>.';
				phyActText = 'Physical activity is also important for health. Adults should get at least 30 minutes of moderate intensity physical activity most days. Longer or more vigorous activity can provide greater health benefits. <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity. <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

				introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Eating these amounts from each food group daily may help you gradually reach a healthier weight. Your calorie needs may be more or less than the average, so check your weight regularly.';
				introTextSmall = introTextSmall + ' If you do not see gradual weight gain, <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			}

			if ( InputOpt == 3 ) {

				resultText = 'Eating these amounts from each food group daily may help you gradually reach a healthier weight. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. <a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Click here</a> for more information about weight loss diets.<br /><br />This plan is based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Your calorie needs may be more or less than the average, so check your weight regularly. If you do not see gradual weight loss, <a class="mypyramid" href="adjust.html">adjust the amount you are eating</a>.';
				phyActText = 'Physical activity is also important for health. About 60 minutes of moderate to vigorous activity most days can help you manage your body weight and prevent gradual gain. About 60 to 90 minutes daily can help you maintain weight loss. If you are inactive, work up to these amounts gradually. <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity.   <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

				introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Eating these amounts from each food group daily may help you gradually reach a healthier weight. Your calorie needs may be more or less than the average, so check your weight regularly.';
				introTextSmall = introTextSmall + ' If you do not see gradual weight loss, <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			}

			if ( InputOpt == 4 ) {

				resultText = 'Eating these amounts from each food group daily may help you gradually reach a healthier weight. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. <a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Click here</a> for more information about weight loss diets. <br /><br />This plan is based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Your calorie needs may be more or less than the average, so check your weight regularly. If you do not see gradual weight loss, <a class="mypyramid" href="adjust.html">adjust the amount you are eating</a>.';
				phyActText = 'Physical activity is also important for health. About 60 minutes of moderate to vigorous activity most days can help you manage your body weight and prevent gradual gain. About 60 to 90 minutes daily can help you maintain weight loss. If you are inactive, work up to these amounts gradually. <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity. <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

				introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Eating these amounts from each food group daily may help you gradually reach a healthier weight. Your calorie needs may be more or less than the average, so check your weight regularly.';
				introTextSmall = introTextSmall + ' If you do not see gradual weight loss, <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			}

			if ( InputOpt == 9 ) {
				resultText = 'Eat these amounts from each food group daily. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. These amounts should maintain your current weight, which is above the healthy range for your height. It is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' minutes a day.)  Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight gain, you may need to <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
//				resultText = 'Eat these amounts from each food group daily. These amounts should maintain your current weight, which is below the healthy range for your height. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. It is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' minutes a day.)  Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight loss, you may need to adjust the amount you are eating.';
				phyActText = 'Physical activity is also important for health. Adults should get at least 30 minutes of moderate intensity physical activity most days. Longer or more vigorous activity can provide greater health benefits.  <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity. <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

				introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Eating these amounts from each food group daily may help you gradually reach a healthier weight. Your calorie needs may be more or less than the average, so check your weight regularly.';
				introTextSmall = introTextSmall + ' If you do not see gradual weight loss, <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			}

		} else if ( BMI > 25 && BMI <= 30 ) {

			resultText = 'Eat these amounts from each food group daily. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. These amounts should maintain your current weight, which is above the healthy range for your height. It is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' minutes a day.)  Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight gain, you may need to <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			phyActText = 'Physical activity is also important for health. Adults should get at least 30 minutes of moderate intensity physical activity most days. Longer or more vigorous activity can provide greater health benefits.  <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity. <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for someone like you: A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day. These amounts should maintain your current weight, which is above the healthy range for your height. Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight gain, <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			footerText = 'Physical activity is also important for health. It can help you manage your body weight and prevent gradual gain. Get about 60 minutes of moderate to vigorous activity most days. If you have any chronic health conditions, talk with a health care provider. They can help you plan a safe program. Also check before starting a vigorous activity program, if you are over 40 (men) or 50 (women). Vigorous activities include such things as jogging and running.  If you are inactive, work up to these amounts gradually.  Click <a class="mypyramid" href="http://www.mypyramid.gov/pyramid/physical_activity.html">here</a> for more information about physical activity and health.';
			popText = 'The weight you entered is above the healthy range for your height. This may increase your risk for health problems. Some people who are overweight should consider weight loss.  <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">Click here</a> (new window) for more information about health risks and whether you should try to lose weight, or talk with your health care provider.';
			popText2 = '<b>Would you like a food plan:</b><br><br>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url+'option=11">For your current weight?</a><br><br>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url1+'&inputCal='+OutputCalories+'&option=3">To gradually move toward a healthier weight?</a>';
			popTextComb = popText + popText2;

			//Transition Text for Adding a New Family Member
			popTextAdd = 'The weight you entered is above the healthy range for your height. This may increase your risk for health problems. Some people who are overweight should consider weight loss. For more information about health risks and whether you should try to lose weight <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">click here</a> (new window), or talk with your health care provider.';
			popTextAdd2 = '<b>Would you like to plan menus:</b><br><br>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd+'option=11">For your current weight?</a><br><br>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd1+'&inputCal='+OutputCalories+'&option=3">To gradually move toward a healthier weight?</a>';

			//Transition Text for Editing Profile
			popTextEdit = 'The weight you entered is above the healthy range for your height. This may increase your risk for health problems. Some people who are overweight should consider weight loss. For more information about health risks and whether you should try to lose weight <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">click here</a> (new window), or talk with your health care provider.';
			popTextEdit2 = '<b>Would you like to plan menus:</b><br><br>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit+'option=11">For your current weight?</a><br><br>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit1+'&inputCal='+OutputCalories+'&option=3">To gradually move toward a healthier weight?</a>';

		} else if ( BMI > 30 && BMI <= 35 ) {
 
			resultText = 'Eat these amounts from each food group daily. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. These amounts should maintain your current weight, which is above the healthy range for your height.  This plan is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day.)  Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight gain, you may need to <a class="mypyramid" href="adjust.html">adjust the amount you are eating</a>.';
			phyActText = 'Physical activity is also important for health. About 60 minutes of moderate to vigorous activity most days can help you manage your body weight and prevent gradual gain. If you are inactive, work up to these amounts gradually. <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity. <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for someone like you: A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day. These amounts should maintain your current weight, which is above the healthy range for your height. Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight gain, you may need to <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			footerText = 'Physical activity is also important for health. About 60 minutes of moderate to vigorous activity most days can help you manage your body weight and prevent gradual gain. About 60 to 90 minutes daily can help you maintain weight loss. If you are inactive, work up to these amounts gradually. Check with a health care provider about increasing your level of physical activity.  They can help you plan a safe program. Click <a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm">here</a> for more information about physical activity for those who are very overweight.';
			popText = 'The weight you entered is above the healthy range for your height. Extra weight can put you at a higher risk for many health problems including type 2 diabetes, high blood pressure, and heart disease.  Weight loss is recommended for people with weights similar to yours. <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">Click here</a> (new window) for more information about health risks and whether you should try to lose weight, or talk with your health care provider.';
			popText2 = '<b>Would you like a food plan:</b><br><br>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url+'option=9">For your current weight?</a><br><br>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url1+'&inputCal='+OutputCalories+'&option=4">To gradually move toward a healthier weight?</a>';
			popTextComb = popText + popText2;

			//Transition Text for Adding a New Family Member
			popTextAdd = 'The weight you entered is above the healthy range for your height. Extra weight can put you at a higher risk for many health problems including type 2 diabetes, high blood pressure, and heart disease. Weight loss is recommended for people with weights similar to yours. For more information about health risks and whether you should try to lose weight <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">click here</a> (new window), or talk with your health care provider.';
			popTextAdd2 = '<b>Would you like to plan menus:</b><br><br>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd+'option=9">For your current weight?</a><br><br>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd1+'&inputCal='+OutputCalories+'&option=4">To gradually move toward a healthier weight?</a>';

			//Transition Text for Editing Profile
			popTextEdit = 'The weight you entered is above the healthy range for your height. Extra weight can put you at a higher risk for many health problems including type 2 diabetes, high blood pressure, and heart disease. Weight loss is recommended for people with weights similar to yours. For more information about health risks and whether you should try to lose weight <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">click here</a> (new window), or talk with your health care provider.';
			popTextEdit2 = '<b>Would you like to plan menus:</b><br><br>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit+'option=9">For your current weight?</a><br><br>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit1+'&inputCal='+OutputCalories+'&option=4">To gradually move toward a healthier weight?</a>';

		} else if ( BMI > 35 ) {

			resultText = 'This plan will meet the nutrient needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. Following this plan should lead to modest weight loss over time. It is not a therapeutic diet for any specific health problem.<br /><br />Talk with your health care provider about a diet and physical activity program that is right for you. <a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Click here</a> for more information about weight loss diets.';
			phyActText = 'Physical activity is also important for health. About 60 minutes of moderate to vigorous activity most days can help you manage your body weight and prevent gradual gain. About 60 to 90 minutes daily can help you maintain weight loss. If you are inactive, work up to these amounts gradually. Check with a health care provider about increasing your level of physical activity.  They can help you plan a safe program. <a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm" target="_blank">Click here</a> (new window) for more information about physical activity for those who are very overweight.';

			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Eating these amounts from each food group daily should lead to modest weight loss over time. It is not a therapeutic diet for any specific health problem. Talk with your health care provider about a diet and physical activity program that is right for you.';
			introTextSmall = introTextSmall + '<br><br><a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Click here</a> for more information about weight loss diets.';
			footerText = 'Physical activity is also important for health. About 60 minutes of moderate to vigorous activity most days can help you manage your body weight and prevent gradual gain. About 60 to 90 minutes daily can help you maintain weight loss. If you are inactive, work up to these amounts gradually. Check with a health care provider about increasing your level of physical activity.  They can help you plan a safe program. Click <a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm">here</a> for more information about physical activity for those who are very overweight.';

			popText = 'The weight you entered is above the healthy range for your height. Extra weight can put you at a higher risk for many health problems including type 2 diabetes, high blood pressure, and heart disease.  <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">Click here</a> for more information about health risks you may have.  Talk with a health care provider about a diet and physical activity program that is right for you.  To learn more about diet and physical activity for those who are very overweight, check these websites:<br /><br />';
			popText = popText + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Choosing a safe and successful weight loss program</a><br><br>';
			popText = popText + '<a class="mypyramid" href="http://www.nhlbi.nih.gov/health/public/heart/obesity/aim_hwt.pdf" target="_blank">Aim for a Healthy Weight</a><br><br>';
			popText = popText + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm" target="_blank">Active at Any Size</a><br><br>';

			popText2 = '<div style="padding: 0px 10px 0px 10px;">Would you like to see a food plan that will meet nutrient needs for a <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range?</div><br><br>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url1+'option=1"><img src="../images/button_yes.gif" alt="" width="27" height="18" hspace="0" vspace="0" border="0"></a>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url2+'"><img src="../images/button_no.gif" alt="" width="27" height="18" hspace="15" vspace="0" border="0"></a></div>';
			popTextComb = popText + popText2;

			//Transition Text for Adding a New Family Member
			popTextAdd = 'The weight you entered is above the healthy range for your height. Extra weight can put you at a higher risk for many health problems including type 2 diabetes, high blood pressure, and heart disease. For more information about health risks you may have, <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">click here</a>. Talk with a health care provider about a diet and physical activity program that is right for you.<br><br>';
			popTextAdd2 = '<div style="padding: 0px 10px 0px 10px;"><b align="center">Would you like to plan menus that will meet nutrient needs for:</b></div><div class="cpi-Info-red"><ul><li>A <b>'+InputAge+'</b> year old '+InputSex+'</li><li>'+heighttext+'</li><li>physically active '+OutputAct+' a day</li></ul></div><div style="padding: 0px 10px 0px 10px;">in the healthy weight range?<br><br>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd1+'option=1"><img src="../images/button_yes.gif" alt="" width="27" height="18" hspace="0" vspace="0" border="0"></a>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd2+'"><img src="../images/button_no.gif" alt="" width="27" height="18" hspace="15" vspace="0" border="0"></a></div>';

			//Transition Text for Editing Profile
			popTextEdit = 'The weight you entered is above the healthy range for your height. Extra weight can put you at a higher risk for many health problems including type 2 diabetes, high blood pressure, and heart disease. For more information about health risks you may have, <a class="mypyramid" href="http://win.niddk.nih.gov/publications/tools.htm" target="_blank">click here</a>. Talk with a health care provider about a diet and physical activity program that is right for you.<br><br>';
			popTextEdit2 = '<div style="padding: 0px 10px 0px 10px;"><b align="center">Would you like to plan menus that will meet nutrient needs for:</b></div><div class="cpi-Info-red"><ul><li>A <b>'+InputAge+'</b> year old '+InputSex+'</li><li>'+heighttext+'</li><li>physically active '+OutputAct+' a day</li></ul></div><div style="padding: 0px 10px 0px 10px;">in the healthy weight range?<br><br>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit1+'option=1"><img src="../images/button_yes.gif" alt="" width="27" height="18" hspace="0" vspace="0" border="0"></a>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit2+'"><img src="../images/button_no.gif" alt="" width="27" height="18" hspace="15" vspace="0" border="0"></a></div>';

			if ( InputOpt == 99 ) {
				popText = 'Talk with a health care provider about a diet and physical activity program that is right for you. To learn more about diet and physical activity for those who are very overweight, check these websites:<br><br>';
				popText = popText + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Choosing a safe and successful weight loss program</a>.<br><br>';
				popText = popText + '<a class="mypyramid" href="http://www.nhlbi.nih.gov/health/public/heart/obesity/aim_hwt.pdf" target="_blank">Aim for a Healthy Weight</a><br><br>';
				popText = popText + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm" target="_blank">Active at Any Size</a>';

				//Transition Text for Adding a New Family Member (Form Buttons)
				popTextAdd = 'Talk with a health care provider about a diet and physical activity program that is right for you. To learn more about diet and physical activity for those who are very overweight, check these websites:<br><br>';
				popTextAdd = popTextAdd + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Choosing a safe and successful weight loss program</a>.<br><br>';
				popTextAdd = popTextAdd + '<a class="mypyramid" href="http://www.nhlbi.nih.gov/health/public/heart/obesity/aim_hwt.pdf" target="_blank">Aim for a Healthy Weight</a><br><br>';
				popTextAdd = popTextAdd + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm" target="_blank">Active at Any Size</a>';

				//Transition Text for Editing Profile (Form Buttons)
				popTextEdit = 'Talk with a health care provider about a diet and physical activity program that is right for you. To learn more about diet and physical activity for those who are very overweight, check these websites:<br><br>';
				popTextEdit = popTextEdit + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/choosing.htm" target="_blank">Choosing a safe and successful weight loss program</a>.<br><br>';
				popTextEdit = popTextEdit + '<a class="mypyramid" href="http://www.nhlbi.nih.gov/health/public/heart/obesity/aim_hwt.pdf" target="_blank">Aim for a Healthy Weight</a><br><br>';
				popTextEdit = popTextEdit + '<a class="mypyramid" href="http://win.niddk.nih.gov/publications/active.htm" target="_blank">Active at Any Size</a>';

				popText2 = '';
				popTextAdd2 = '';
				popTextEdit2 = '';

			}

		} else {

			resultText = 'Eat these amounts from each food group daily. These amounts should maintain your current weight, which is below the healthy range for your height. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. It is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day.)  Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight loss, you may need to <a class="mypyramid" href="adjust.html">adjust the amount you are eating</a>.';
			phyActText = 'Physical activity is also important for health. Adults should get at least 30 minutes of moderate intensity physical activity most days. Longer or more vigorous activity can provide greater health benefits. <a class="mypyramid" href="../pyramid/physical_activity_amount.html">Click here</a> to find out if you should talk with a health care provider before starting or increasing physical activity. <a class="mypyramid" href="../pyramid/physical_activity_why.html">Click here</a> for more information about physical activity and health.';

			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for someone like you: A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day. These amounts should maintain your current weight, which is below the healthy range for your height. Your calorie needs may be more or less than the average, so check your weight regularly. To prevent weight loss, you may need to <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
			footerText = 'Physical activity is also important for health. Adults should get at least 30 minutes of moderate intensity physical activity most days. If you have any chronic health conditions, talk with a health care provider. They can help you plan a safe program.  Also check before starting a vigorous activity program if you are over 40 (men) or 50 (women).  Vigorous activities include such things as jogging and running. Click <a class="mypyramid" href="http://www.mypyramid.gov/pyramid/physical_activity.html">here</a> for more information about physical activity and health.';

			popText = 'The weight you entered is below the healthy range for your height. This may increase your risk for health problems. Some people with a very lean body build or young adults who are still growing may not be at a higher risk. Check with your health care provider to see if you should try to gain weight.  If you have recently lost weight, have health problems, or have difficulties with eating, speak with your health care provider.<br><br>';
			popText2 = '<b>Would you like a plan:</b><br><br>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url+'option=10">For your current weight?</a><br><br>';
			popText2 = popText2 + '<a class="mypyramid" href="'+url1+'&inputCal='+OutputCalories+'&option=2">To gradually move toward a healthier weight?</a>';
			popTextComb = popText + popText2;

			//Transition Text for Adding a New Family Member
			popTextAdd = 'The weight you entered is below the healthy range for your height. This may increase your risk for health problems. Some people with a very lean body build or young adults who are still growing may not have a higher risk. Check with your health care provider to see if you should try to gain weight. If you have recently lost weight, have health problems, or have difficulties with eating, speak with your health care provider.<br><br>';
			popTextAdd2 = '<b>Would you like a food plan:</b><br><br>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd+'option=10">For your current weight?</a><br><br>';
			popTextAdd2 = popTextAdd2 + '<a class="mypyramid" href="'+urlAdd1+'&inputCal='+OutputCalories+'&option=2">To gradually move toward a healthier weight?</a>';

			//Transition Text for Editing Profile
			popTextEdit = 'The weight you entered is below the healthy range for your height. This may increase your risk for health problems. Some people with a very lean body build or young adults who are still growing may not have a higher risk. Check with your health care provider to see if you should try to gain weight. If you have recently lost weight, have health problems, or have difficulties with eating, speak with your health care provider.<br><br>';
			popTextEdit2 = '<b>Would you like a food plan:</b><br><br>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit+'option=10">For your current weight?</a><br><br>';
			popTextEdit2 = popTextEdit2 + '<a class="mypyramid" href="'+urlEdit1+'&inputCal='+OutputCalories+'&option=2">To gradually move toward a healthier weight?</a>';

		}

	} else if (InputAge >= 9 && CInputWgt > 0 && CInputHgt > 0) {

		resultText = 'Eat these amounts from each food group daily. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. It is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day.)  Your food needs also depend on your rate of growth and other factors.  See a health care provider who can track your height and weight over time to identify your specific needs.';
		phyActText = 'Physical activity is also important for health.  You should get at least 60 minutes of physical activity most or all days. Click <a class="mypyramid" href="http://www.mypyramid.gov/pyramid/physical_activity.html">here</a> to learn more about physical activity and health.';

		introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day.)  Your food needs also depend on your rate of growth and other factors.  See a health care provider who can track your height and weight over time to identify your specific needs.';
		introText = introTextSmall;
		footerText = 'Physical activity is also important for health.  You should get at least 60 minutes of physical activity most or all days. Click <a class="mypyramid" href="http://www.mypyramid.gov/pyramid/physical_activity.html">here</a> to learn more about physical activity and health.';

		minBMI = new Array(17);
		maxBMI = new Array(17);

		if (InputSex == 'male') {
			minBMI = minBMIb;
			maxBMI = maxBMIb;
		} else {
			minBMI = minBMIg;
			maxBMI = maxBMIg;
		}

		ageMod = InputAge - 2;

		if ( BMI >= minBMI[ageMod] && BMI <= maxBMI[ageMod]) {

		} else if (BMI >= maxBMI[ageMod]) {
			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day, in a healthy weight range.  The weight you entered is higher than may be healthy for your age and height.';
			introTextSmall = introTextSmall + '<br><br>Ask a health care provider about your weight and a food plan that is right for you.  They may ask about the foods you eat, your level of physical activity, and your family history.  They can also determine your rate of growth and check for other health problems.';
			footerText = 'Physical activity is also important for health.  You should get at least 60 minutes of physical activity most or all days. Click <a class="mypyramid" href="http://www.mypyramid.gov/pyramid/physical_activity.html">here</a> to learn more about physical activity and health.';

			popText = 'The weight you entered is higher than may be healthy for your age and height.  Ask a health care provider about your weight.  They may ask about the foods you eat, your level of physical activity, and your family history.  They can also determine your rate of growth and check for other health problems.';

			popText2 = 'To see a food plan for someone your age, sex, and activity level, click <a class="mypyramid" href="'+url+'&option=5">here</a>.';

		} else if (BMI <= maxBMI[ageMod]) {
			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day, in a healthy weight range.  The weight you entered is lower than may be healthy for your age and height.';
			introTextSmall = introTextSmall + '<br><br>Ask a health care provider about your weight and a food plan that is right for you.  They may ask about the foods you eat, your level of physical activity, and your family history.  They can also determine your rate of growth and check for other health problems.';

			popText = 'The weight you entered is lower than may be healthy for your age and height.  Ask a health care provider about your weight.  They may ask about the foods you eat, your level of physical activity, and your family history.  They can also determine your rate of growth and check for other health problems.';

			popText2 = 'To see a food plan for someone your age, sex, and activity level, click <a class="mypyramid" href="'+url+'&option=5">here</a>.';

		} else {
			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+' a day.)  Your food needs also depend on your rate of growth and other factors.  See a health care provider who can track your height and weight over time to identify your specific needs.';

		}

		if ( InputOpt == 5 ) {

			resultText = 'This plan will meet the nutrient needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in a healthy weight range. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. <br /><br />Check with your health care provider about a food plan that is right for you.';

			introTextSmall = 'Your Menu Planner goals and estimated calorie needs are based on average needs for a <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+', physically active '+OutputAct+' a day, in the healthy weight range. Eating these amounts from each food group daily may help you gradually reach a healthier weight. Your calorie needs may be more or less than the average, so check your weight regularly.';
			introTextSmall = introTextSmall + ' If you do not see gradual weight loss, <a class="mypyramid" href="#" onclick="navPage(\'adjust.html\')">adjust the amount you are eating</a>.';
		}


	} else {

			resultText = 'Eat these amounts from each food group daily. This plan is a <b>'+OutputCalories+'</b> calorie food pattern. It is based on average needs for someone like you. (A <b>'+InputAge+'</b> year old <b>'+InputSex+'</b>'+heighttext+weighttext+', physically active '+OutputAct+'.)  Your food needs also depend on your rate of growth and other factors.  See a health care provider who can track your height and weight over time to identify your specific needs.';

			phyActText = 'Physical activity is also important for health.  You should get at least 60 minutes of physical activity most or all days. <a href="../pyramid/physical_activity.html">Click here</a> to learn more about physical activity and health. ';

	}

// Routines

function flashText() {
		if (InputAge < 9) {
			document.write('<p class="small">Your goals are based on a <b>'+OutputCalories+'</b> calorie pattern.</p>');
		} else {
			document.write('<p class="small"><a class="mypyramid" href="#" onClick="goalsPop()">Your goals are based on a <b>'+OutputCalories+'</b> calorie pattern.</a></p>');
		}
}

