<!-- hide from old browsers

function ClearFormlbs (form) {

	form.weight.value="";

	form.height.value="";

	form.inches.value="";

	form.yourbmi.value="";

	form.my_comment.value="";

}


function BmiFormlbs(form) {

	

	// Holds whether or not the form is correct

	var Correct = true;



	// Check for missing fields

	if (form.weight.value == null || form.weight.value.length == 0 ||

	form.height.value == null || form.height.value.length == 0 ||

	form.inches.value == null || form.inches.value.length == 0) {

		alert ("\nPlease fill in all of the form elements");

		Correct = false;

	}

	

	// Check that only numbers are in the weight and height fields

	else {

		// Holds the floats representing the weight and height

		var TestWeight;

		var Testheight;

		var Testinches;



		// Parse the weight and height values and put in the variables

		TestWeight = parseFloat(form.weight.value);

		Testheight = parseFloat(form.height.value);

		Testinches = parseFloat(form.inches.value);



		// Check to see that TestWeight is a number

		if (isNaN (TestWeight)) {

			alert("\nMake sure to enter the weight\nas a number.");

			Correct = false;

			form.weight.value="";

		}



		// Check to see that Testheight is a number

		if (isNaN (Testheight)) {

			alert("\nMake sure to enter the feet \nas a number.");

			Correct = false;

			form.height.value="";

		}



		// Check to see that Testinches is a number

		if (isNaN (Testinches)) {

			alert("\nMake sure to enter the inches \nas a number.");

			Correct = false;

			form.inches.value="";

		}




		// Check that the TestWeight is greater than 0

		if (TestWeight <= 0) {

			alert("\nCome on.  Enter a real weight.");

			Correct = false;

			form.weight.value="";	

		}



		// Check that the Testheight is greater than 0

		if (Testheight <= 0) {

			alert("\nCome on.  Enter a real number of feet.");

			Correct = false;

			form.height.value="";

		}


		// Check that the Testinches is greater than 0

		if (Testinches < 0) {

			alert("\nCome on.  Enter a real number of inches.");

			Correct = false;

			form.inches.value="";

		}



		// Check that the Testinches is less than 12

		if (Testinches >= 12) {

			alert("\nCome on.  Enter a real number of inches.");

			Correct = false;

			form.inches.value="";

		}



	}



	// If the inputs are correct, calculate the bmi

	if (Correct) {

		// Hold the calculation numbers

		var Wt;

		var Height2;

		var Centis;

			Centis = (((Testheight * 12) + Testinches) * 2.54);

			Height2 = (Centis / 100) * (Centis / 100);

			Wt = TestWeight / 2.2;

		yourbmi = (Math.round(Wt / Height2));

		// Send this number to the screen

		form.yourbmi.value = yourbmi;

		if (yourbmi >40) {
		form.my_comment.value="You are dangerously obese, consult your physician!";
		}

		else if (yourbmi >30 && yourbmi <=40) {
		form.my_comment.value="You are obese! Consult a doctor or dietitian!";
		}

		else if (yourbmi >27 && yourbmi <=30) {
		form.my_comment.value="Corpulent - do something before it's too late!";
		}

		else if (yourbmi >24 && yourbmi <=27) {
		form.my_comment.value="You are overweight! Diet and exercise required!";
		}

		else if (yourbmi >23 && yourbmi <=24) {
		form.my_comment.value="Hmm..Marginal! Watch your diet - more exercise needed!";
		}

		else if (yourbmi >=20 && yourbmi <=23) {
		form.my_comment.value="Perfect score!!  Good Job!!  Stay like you are!!";
		}

		else if (yourbmi >=18 && yourbmi <20) {
		form.my_comment.value="You are marginally thin, eat more.";
		}

		else if (yourbmi >=16 && yourbmi <18) {
		form.my_comment.value="You are emaciated. Consult your doctor or dietitian!";
		}

		else if (yourbmi <16) {
		form.my_comment.value="You are radically undernourished! Panic!";
		}

	}

}






function ClearForm (form) {

	form.weight.value="";

	form.height.value="";

	form.yourbmi.value="";

	form.my_comment.value="";

}


function BmiForm(form) {

	

	// Holds whether or not the form is correct

	var Correct = true;



	// Check for missing fields

	if (form.weight.value == null || form.weight.value.length == 0 ||

	form.height.value == null || form.height.value.length == 0) {

		alert ("\nPlease fill in all of the form elements");

		Correct = false;

	}

	

	// Check that only numbers are in the weight and height fields

	else {

		// Holds the floats representing the weight and height

		var TestWeight;

		var Testheight;



		// Parse the weight and height values and put in the variables

		TestWeight = parseFloat(form.weight.value);

		Testheight = parseFloat(form.height.value);



		// Check to see that TestWeight is a number

		if (isNaN (TestWeight)) {

			alert("\nMake sure to enter the weight\nas a number.");

			Correct = false;

			form.weight.value="";

		}



		// Check to see that Testheight is a number

		if (isNaN (Testheight)) {

			alert("\nMake sure to enter the height \nas a number.");

			Correct = false;

			form.height.value="";

		}

	

		// Check that the TestWeight is greater than 0

		if (TestWeight <= 0) {

			alert("\nCome on.  Enter a real weight.");

			Correct = false;

			form.weight.value="";	

		}



		// Check that the Testheight is greater than 0

		if (Testheight <= 0) {

			alert("\nCome on.  Enter a real height size.");

			Correct = false;

			form.height.value="";	

		}



	}



	// If the inputs are correct, calculate the bmi

	if (Correct) {

		// Hold the calculation numbers

		var Wt;

		var Height2;

			Height2 = (Testheight/100) * (Testheight/100);

			Wt = TestWeight;

		yourbmi = (Math.round(Wt / Height2));

		// Send this number to the screen

		form.yourbmi.value = yourbmi;



		if (yourbmi >40) {
		form.my_comment.value="You are dangerously obese, consult your physician!";
		}

		else if (yourbmi >30 && yourbmi <=40) {
		form.my_comment.value="You are obese! Consult a doctor or dietitian!";
		}

		else if (yourbmi >27 && yourbmi <=30) {
		form.my_comment.value="Corpulent - do something before it's too late!";
		}

		else if (yourbmi >23 && yourbmi <=27) {
		form.my_comment.value="You are overweight! Diet and exercise required!";
		}

		else if (yourbmi >22 && yourbmi <=23) {
		form.my_comment.value="Hmm..Marginal! Watch your diet - more exercise needed!";
		}

		else if (yourbmi >=21 && yourbmi <=22) {
		form.my_comment.value="Perfect score!! Good Job!! Stay like you are!!";
		}

		else if (yourbmi >=18 && yourbmi <21) {
		form.my_comment.value="You are marginally thin, eat more.";
		}

		else if (yourbmi >=16 && yourbmi <18) {
		form.my_comment.value="You are emaciated. Consult a dietitian or doctor!";
		}

		else if (yourbmi <16) {
		form.my_comment.value="You are radically undernourished! Panic!";
		}


	}

}

// finish hiding from old browsers -->