<!-- hide from old browsers


function ClearForm (form) {

	form.feet.value="";

	form.inches.value="";

	form.pounds.value="";

	form.years.value="";

	form.calcval.value="";

}


function Calmaintainlbs(form) {

	

	// Holds whether or not the form is correct

	var Correct = true;



	// Check for missing fields

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

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

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

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

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

		Correct = false;

	}

	

	// Check that only numbers are in the fields

	else {

		// Holds the floats representing the feet and waist

		var Testfeet;

		var Testinches;

		var Testpounds

		var Testyears

		// Parse the feet and waist values and put in the variables

		Testfeet = parseFloat(form.feet.value);

		Testinches = parseFloat(form.inches.value);

		Testpounds = parseFloat(form.pounds.value);

		Testyears = parseFloat(form.years.value);



		// Check to see that Testfeet is a number

		if (isNaN (Testfeet)) {

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

			Correct = false;

			form.feet.value="";

		}



		// Check to see that Testinches is a number

		if (isNaN (Testinches)) {

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

			Correct = false;

			form.inches.value="";

		}



		// Check to see that Testpounds is a number

		if (isNaN (Testpounds)) {

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

			Correct = false;

			form.pounds.value="";

		}



		// Check to see that Testyears is a number

		if (isNaN (Testyears)) {

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

			Correct = false;

			form.years.value="";

		}



		// Check that the Testfeet is greater than 0

		if (Testfeet <= 0) {

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

			Correct = false;

			form.feet.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 than 12

		if (Testinches >= 12) {

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

			Correct = false;

			form.inches.value="";

		}



		// Check that the Testpounds is greater than 0

		if (Testpounds <= 0) {

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

			Correct = false;

			form.pounds.value="";

		}



		// Check that the Testyears is greater than 0

		if (Testyears <= 0) {

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

			Correct = false;

			form.years.value="";

		}



	}



	// If the inputs are correct, calculate the calories

	if (Correct) {

		

		// Hold the calculation numbers

		var Totalinches;

		var Centis;

		var Kilos;

		var Age;

		var Weight;

		var Height;

		Totalinches = (Testfeet * 12) + Testinches;

		Centis = Totalinches * 2.54;

		Kilos = Testpounds / 2.2;

		var activity = document.calmaintain.activity.options[document.calmaintain.activity.selectedIndex].value

		// Make the male calculations	

			if (form.gender[0].checked) {

			Age = Testyears * 6.8;

			Weight = (Kilos * 13.7) + 66;

			Height = Centis * 5;

			calcval = (Math.round(Weight + Height - Age) * activity);

		}



		// Make the female calculations
		else {

			Age = Testyears * 4.7;

			Weight = (Kilos * 9.6) + 655;

			Height = Centis * 1.7;

			calcval = (Math.round(Weight + Height - Age) * activity);

		}


		// Send this number to the screen

		form.calcval.value = calcval;

	}

}

function Calmaintainkgs(form) {

	

	// Holds whether or not the form is correct

	var Correct = true;



	// Check for missing fields

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

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

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

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

		Correct = false;

	}

	

	// Check that only numbers are in the fields

	else {

		// Holds the floats representing the centimeters and waist

		var Testcentimeters;

		var Testkilograms

		var Testyears

		// Parse the centimeters and waist values and put in the variables

		Testcentimeters = parseFloat(form.centimeters.value);

		Testkilograms = parseFloat(form.kilograms.value);

		Testyears = parseFloat(form.years.value);



		// Check to see that Testcentimeters is a number

		if (isNaN (Testcentimeters)) {

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

			Correct = false;

			form.centimeters.value="";

		}



		// Check to see that Testkilograms is a number

		if (isNaN (Testkilograms)) {

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

			Correct = false;

			form.kilograms.value="";

		}



		// Check to see that Testyears is a number

		if (isNaN (Testyears)) {

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

			Correct = false;

			form.years.value="";

		}



		// Check that the Testcentimeters is greater than 0

		if (Testcentimeters <= 0) {

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

			Correct = false;

			form.centimeters.value="";

		}



		// Check that the Testkilograms is greater than 0

		if (Testkilograms <= 0) {

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

			Correct = false;

			form.kilograms.value="";

		}



		// Check that the Testyears is greater than 0

		if (Testyears <= 0) {

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

			Correct = false;

			form.years.value="";

		}



	}



	// If the inputs are correct, calculate the calories

	if (Correct) {

		

		// Hold the calculation numbers

		var Age;

		var Weight;

		var Height;


		var activity = document.calmaintain.activity.options[document.calmaintain.activity.selectedIndex].value

		// Make the male calculations	

			if (form.gender[0].checked) {

			Age = Testyears * 6.8;

			Weight = (Testkilograms * 13.7) + 66;

			Height = Testcentimeters * 5;

			calcval = (Math.round(Weight + Height - Age) * activity);

		}



		// Make the female calculations
		else {

			Age = Testyears * 4.7;

			Weight = (Testkilograms * 9.6) + 655;

			Height = Testcentimeters * 1.7;

			calcval = (Math.round(Weight + Height - Age) * activity);

		}


		// Send this number to the screen

		form.calcval.value = calcval;

	}

}


// finish hiding from old browsers -->