function calculateBMI(weight,height) {
	if (isValidInput(weight,height)) {
		var bmi=weight/(height*height);
		bmi=Math.round(bmi*10)/10;	//round to 1 decimal place
		return "Your BMI is " + bmi + ", which is officially classified as " + getClassification(bmi);
	} else {
		return "Cannot calculate BMI: Weight and Height must be numeric";
	}
}

function isValidInput(weight, height) {
	return weight!="" && !isNaN(weight)
		&& height!="" && !isNaN(height);
}

function getClassification(bmi) {
	if (bmi<15) {
		return "Starvation (less than 15)";
	} else if (bmi<18.5) {
		return "Underweight (between 15 and 18.5)";
	} else if (bmi<25) {
		return "Normal (between 18.5 and 25)";
	} else if (bmi<30) {
		return "Overweight (between 25 and 30)";
	} else if (bmi<40) {
		return "Obese (between 30 and 40)";
	} else {
		return "Morbidly obese (greater than 40)";
	}
}