function initForm(){
	
	/*
		// Disable Results fields
		document.maxFluidCalculator.maxFluid.disabled=true;
		//document.maxFluidCalculator.maxFluidUnits.disabled=true;
		document.minFluidCalculator.minFluid.disabled=true;
	*/	
	};

	function clearMaxFluidCalculator(){
		document.maxFluidCalculator.preWWeight.value = "";
		document.maxFluidCalculator.fIngested.value = "";
		document.maxFluidCalculator.postWWeight.value = "";
		document.maxFluidCalculator.lHour1.value ="";
		document.maxFluidCalculator.lMin1.value = "";
		document.maxFluidCalculator.maxFluid.value = "";
	};


	function validateMaxFluidFields(){
		
		var errMsg = "";
		var vMaxFluid = "";

		if (document.maxFluidCalculator.preWWeight.value == ""){
			errMsg = "Please enter a pre-event weight.";
			alert (errMsg);
			return;
		};

		if (document.maxFluidCalculator.preWWeightUnit.options[document.maxFluidCalculator.preWWeightUnit.selectedIndex].value 	!= document.maxFluidCalculator.postWWeightUnit.options[document.maxFluidCalculator.postWWeightUnit.selectedIndex].value){
			errMsg = "Your pre-weight units and post-weight units must be the same.";
			alert (errMsg);
			return;
		};

		if (document.maxFluidCalculator.fIngested.value == ""){
			errMsg = "Please enter the fluids ingested.";
			alert (errMsg);
			return;
		};

		if (document.maxFluidCalculator.postWWeight.value == ""){
			errMsg = "Please enter a post-event weight.";
			alert (errMsg);
			return;
		};
	
		if ((document.maxFluidCalculator.lHour1.value == "") && (document.maxFluidCalculator.lMin1.value == "")){
			errMsg = "Please enter your length of workout in hours and minutes."
			alert (errMsg);
			return;				
		};

		// Calculate max fluid level
		vMaxFluid = cMaxFluid(document.maxFluidCalculator.preWWeight.value, document.maxFluidCalculator.preWWeightUnit.options[document.maxFluidCalculator.preWWeightUnit.selectedIndex].value, document.maxFluidCalculator.fIngested.value, document.maxFluidCalculator.fIngestedUnit.options[document.maxFluidCalculator.fIngestedUnit.selectedIndex].value, document.maxFluidCalculator.postWWeight.value, document.maxFluidCalculator.postWWeightUnit.options[document.maxFluidCalculator.postWWeightUnit.selectedIndex].value, document.maxFluidCalculator.lHour1.value, document.maxFluidCalculator.lMin1.value); 

		//alert (vMaxFluid);


		if (vMaxFluid == "ERROR"){
			alert("The numbers entered do not appear to be accurate, as the sum of your pre-workout weight + the weight of your ingested fluids must be greater than or equal to your post workout weight.\nPlease try again after another trial.")
		}

		else if (vMaxFluid.substr(0,1) == '-'){

			// Display result
			document.maxFluidCalculator.maxFluid.value = vMaxFluid;
			alert ("If your numbers are accurate, it appears that you were either sweating heavily, and failed to replace sodium and potassium at adequate rates, or that you were sweating very little, meaning that you would have lost very little fluid.  It would be worth doing another trial to obtain more numbers and be sure.\n\nHowever, if you feel the numbers are accurate, and you were sweating heavily, you may need to increase your hourly intake of sodium and potassium.  If you were sweating very little, you could have reduced your sports drink intake by up to " + vMaxFluid.substring(1) +".  This will reduce your chances of overhydration and hyponatremia.\n\nAdditionally, you do not need to use the Minimum Calculator in this example.");
		}


		else {

			// Display result
			document.maxFluidCalculator.maxFluid.value = vMaxFluid;


			// Populate min calculator

			document.minFluidCalculator.preRWeight.value = document.maxFluidCalculator.preWWeight.value;
			document.minFluidCalculator.preRWeightUnit.value = document.maxFluidCalculator.preWWeightUnit.value;
			document.minFluidCalculator.maxFluid1.value=document.maxFluidCalculator.maxFluid.value;
			document.minFluidCalculator.lHour2.value = document.maxFluidCalculator.lHour1.value;
			document.minFluidCalculator.lMin2.value = document.maxFluidCalculator.lMin1.value;

			// Strip units from returning result
			for (i=0; i <= vMaxFluid.length; i++)
				{ 
					if (vMaxFluid.substr(i,1) == ' '){			
						//alert (vMaxFluid.substr(0,i));
						document.minFluidCalculator.maxFluid1.value = vMaxFluid.substr(0,i)
					};

					if (vMaxFluid.substr(i,1) == 'L'){
						document.minFluidCalculator.maxFluid1Unit.value = "L";
						i = vMaxFluid.length;
					};

					if (vMaxFluid.substr(i,1) == 'o'){			
						document.minFluidCalculator.maxFluid1Unit.value = "oz";
						i = vMaxFluid.length;
					};

					if (vMaxFluid.substr(i,1) == 'm'){
						document.minFluidCalculator.maxFluid1Unit.value = "mL";
						i = vMaxFluid.length;
					};
				};

			// Report Summary
			document.SumInfo.summary1.value = "Your maximum fluid requirement is " + document.maxFluidCalculator.maxFluid.value + ".";
		};

	};

	function clearMinFluidCalculator(){
		document.minFluidCalculator.preRWeight.value = "";
		document.minFluidCalculator.maxFluid1.value = "";
		document.minFluidCalculator.lHour2.value ="";
		document.minFluidCalculator.lMin2.value = "";
		document.minFluidCalculator.minFluid.value = "";
	};

	function validateMinFluidFields(){
		
		var errMsg = "";
		var vMaxFluid = "";

		if (document.minFluidCalculator.preRWeight.value == ""){
			errMsg = "Please enter a pre-event weight.";
			alert (errMsg);
			return;
		};

		if ((document.minFluidCalculator.lHour2.value == "") && (document.minFluidCalculator.lMin2.value == "")){
			errMsg = "Please enter your event length in hours and minutes."
			alert (errMsg);
			return;				
		};

		if (document.minFluidCalculator.maxFluid1.value == ""){
			errMsg = "Please enter your maximum fluid needs.";
			alert (errMsg);
			return;
		};

		// Display result
		document.minFluidCalculator.minFluid.value = cMinFluid(document.minFluidCalculator.preRWeight.value, document.minFluidCalculator.preRWeightUnit.options[document.minFluidCalculator.preRWeightUnit.selectedIndex].value, document.minFluidCalculator.lHour2.value, document.minFluidCalculator.lMin2.value, document.minFluidCalculator.maxFluid1.value, document.minFluidCalculator.maxFluid1Unit.options[document.minFluidCalculator.maxFluid1Unit.selectedIndex].value);

		// Report Summary
		document.SumInfo.summary2.value = "Your minimum fluid requirement is " + document.minFluidCalculator.minFluid.value  + ".";

	};


	function checkNumeric(objName,minval, maxval,comma,period,hyphen){
		var numberfield = objName;
		if (chkNumeric(objName,minval,maxval,comma,period,hyphen) == false)	{
			numberfield.select();
			numberfield.focus();
			return false;
		}

		else{
			return true;
		}
	}

	function chkNumeric(objName,minval,maxval,comma,period,hyphen){

		// only allow 0-9 be entered, plus any values passed
		// (can be in any order, and don't have to be comma, period, or hyphen)
		// if all numbers allow commas, periods, hyphens or whatever,
		// just hard code it here and take out the passed parameters
		var checkOK = "0123456789" + comma + period + hyphen;
		var checkStr = objName;
		var allValid = true;
		var decPoints = 0;
		var allNum = "";

		for (i = 0;  i < checkStr.value.length;  i++)
		{
		ch = checkStr.value.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		if (ch == checkOK.charAt(j))
		break;
		if (j == checkOK.length)
		{
		allValid = false;
		break;
		}
		if (ch != ",")
		allNum += ch;
		}
		if (!allValid)
		{	
		alertsay = "Please enter only these values \""
		alertsay = alertsay + checkOK + "\" in the \"" + checkStr.name + "\" field."
		alert(alertsay);
		return (false);
		}

		// set the minimum and maximum
		var chkVal = allNum;
		var prsVal = parseInt(allNum);
		if (chkVal != "" && !(prsVal >= minval && prsVal <= maxval))
		{
		alertsay = "Please enter a value greater than or "
		alertsay = alertsay + "equal to \"" + minval + "\" and less than or "
		alertsay = alertsay + "equal to \"" + maxval + "\" in the \"" + checkStr.name + "\" field."
		alert(alertsay);
		return (false);
		}
	}