/** 
 *  Daily Calorie Needs Calculator :: JavaScript Version
 *  Copyright (c) 2002 Daniel Christer Krook
 */
 
// The main calculation function
function calcDCN (intWeight,intFeet,intInches,intAge,strGender,fltActivity) {

	// Gets Rate of Metabolism (BMR)
		// Step One: WeightSex
	var fltWM = intWeight * 6.2;
	var fltWW = intWeight * 4.4;
	
		// Step Two: Height, HeightSex
	var intHeight = intFeet * 12 + parseInt(intInches);
	var fltHM = intHeight * 12.7;
	var fltHW = intHeight * 4.7;
	
		// Step Three: AgeSex
	var fltAM = intAge * 6.8;
	var fltAW = intAge * 4.7;
	
		// Calculate: Basal Metabolic Rate
	var fltBMR;
	if (strGender == "male") {
		 fltBMR = ((fltWM + fltHM) - fltAM) + 666;
	} else {
		 fltBMR = ((fltWW + fltHW) - fltAW) + 655;
	}
	
	//  Gets Calories for Physical Activity, 
	//  Energy for Digestion and Absorption, 
	//  and Total Energy Needs               
	var fltCPA = fltBMR * fltActivity;
	var fltEDA = (fltBMR + fltCPA) * 0.10;
	var fltTEN = fltBMR + fltCPA + fltEDA;
	
	// Write the result to the text box
	document.dcn.Result.value = parseInt(fltTEN);
	
}
