function checkNum(thisChar) {

	if((thisChar != '0') &&
		(thisChar != '1') &&
		(thisChar != '2') &&
		(thisChar != '3') &&
		(thisChar != '4') &&
		(thisChar != '5') &&
		(thisChar != '6') &&
		(thisChar != '7') &&
		(thisChar != '8') &&
		(thisChar != '9')) {
		
		return false;
		
	} else {
	
		return true;
		
	}
}
		

function checkValue(thisString) {

	var isNum = true;
	var stringLen = thisString.length;
	
	if(stringLen == 0) {
	
		isNum = false;
		
	} else {
	
		for(count = 0; count < stringLen; count++) {
	
			if(!(checkNum(thisString.charAt(count)))) {
		
				isNum = false;
				break;
		
			}	
		}
	}
	
	return isNum;
	
}



function Figurecalneeds() {

form = document.IronPointForm;
feetIndex = form.Feet.selectedIndex;
feet = form.Feet.options[feetIndex].value;
inchesIndex = form.Inches.selectedIndex;
inches = form.Inches.options[inchesIndex].value;
pounds = form.Weight.value;
if (form.Weight.value=="")
{
	pounds = form.WeightKg.value;
	if (form.WeightKg.value != "")
		pounds = pounds * 2.2;
}
years = form.Age.value;
activityIndex = form.activity.selectedIndex;
activity = form.activity.options[activityIndex].value;

if((!(checkValue(pounds))) ||
	(!(checkValue(years)))) {
	
	alert('Please enter numbers for weight and age.');
	
} else {

TotalInches = eval(feet*12) + eval(inches);
Centis      = TotalInches * 2.54;
Kilos       = pounds/2.2;
Age         = years;

	if(form.Gender[0].checked) {

	<!--Male calculations-->
	Weight      = 66 + (13.7 * Kilos)
	Height      = 5 * Centis
	Ages        = 6.8 * Age

	} else {

	<!--Female calculations-->
	Weight      = 655 + (9.6 * Kilos)
	Height      = 1.7 * Centis
	Ages        = 4.7 * Age

	}

form.Calories.value = Math.ceil((Weight + Height - Ages) * activity)

}

}




function openNutrition() {

	caloricNeeds = document.IronPointForm.Calories.value;
	URL = 'nutritionalneeds_calc.cfm?calories=' + caloricNeeds;
	popup=window.open(URL, '', 'width=456,height=293');

}