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 FigureBMI() {

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;
}

if(!(checkValue(pounds))) {
	
	alert('Please enter a number for your weight.');
	
} else {

 	 TotalInches = eval(feet*12) + eval(inches)
	if (form.Cms.value !="")
	{
		TotalInches = form.Cms.value;
		TotalInches = TotalInches / 2.54;
	}
	 Meters = TotalInches/39.36
	 Kilos = pounds/2.2
	 Square = Meters * Meters
	 
 	 form.BMI.value = Math.ceil(Kilos/Square);
	 
}
	
}
