		function checkNull(src){
			var result = document.getElementById("txtresult");
			if (!src) {
				result.value = "Please enter your height in inches and your weight in pounds first before clicking the calculate button."
				return false;
			}
			return true;
		} 
		
		function calcBMI(height, weight) {	
			return (weight/(Math.pow(height, 2)));
		}
		
		function converttocm(height) {	
			return (height * 0.025397);
		}
		
		function converttokg(weight) {
			return (weight * 0.4545);
		}
		
		function btncalcBMI() {	
		
			var height;
			var weight;
			var bmi;
			var result = document.getElementById("txtresult");
			var heightElement = document.getElementById("height");
			var weightElement = document.getElementById("weight");
			var bmiElement = document.getElementById("txtbmi");

			if (!(checkNull(heightElement.value))) {
				return false;
			}
			else {
				height = converttocm(heightElement.value);	
			}

			if (!(checkNull(weightElement.value))) {
				return false;
			}
			else {
				weight = converttokg(weightElement.value);	
			}

			bmi = calcBMI(height, weight);
			
			if (bmi < 18.5) {
				result.value = "Your weight is less than ideal for your height based on present height/weight tables and weight loss would not be appropriate for you at this time.";
			}
				
			if ((bmi > 18.4) && (bmi < 24.9)) {
				result.value = "Your weight is within a normal range for your height. Concentrate on getting regular exercise and making healthy food choices to prevent weight gain.";
			}
				
			if ((bmi > 24.8) && (bmi < 29.9)) {
				result.value = "Your BMI indicates you may be at an increased risk for developing health problems caused by being overweight. Weight loss could benefit your health. Other factors, such as your medical condition, need to be considered when selecting a treatment plan. Many OPTIFAST Programs offer options to treat people who have a BMI such as yours. Please select FIND AN OPTIFAST CLINIC to find an OPTIFAST program near you. An OPTIFAST Program physician can help you determine the best approach to treatment.";
			}	
			if ((bmi > 29.8) && (bmi < 100)) {
				result.value = "Your BMI indicates that you may be an appropriate candidate for OPTIFAST treatment. You may or may not have other medical conditions caused by your weight such as diabetes, hypertension, or heart disease. You are certainly at higher risk for developing these types of diseases. It may be very important that your weight loss is medically supervised. Please select FIND AN OPTIFAST CLINIC to find an OPTIFAST program near you. An OPTIFAST Program physician can discuss the best approach to treatment based on your medical condition.";
			}
				
			//b=Math.round(b);
			bmiElement.value = parseInt(bmi);

			return true;
		}