function bmiCalc()
{
	err = 0;
	height = (parseInt(document.aspnetForm.feet.value) *12) + parseInt(document.aspnetForm.inches.value);
	iweight = parseInt(document.aspnetForm.weight.value);
	if (isNaN(height) || isNaN(iweight))
		{alert("All fields must be filled in with a number.");
			err = 1;}
	h2 = height * height;
	ibmi = (705 * iweight)/h2;
	bmiString = ibmi.toString();
	if (err == 0)
		{document.aspnetForm.bmi.value = (bmiString.substring(0,4));}
	return false;
}

function inchCheck()
{
	if(document.aspnetForm.inches.value > 12)
	{
		alert("No more than 12 inches to the foot please.");
		document.aspnetForm.inches.value = "";
	}
	if(document.aspnetForm.inches.value == 12)
	{
		newFeet = parseInt(document.aspnetForm.feet.value) + 1;
		document.aspnetForm.feet.value = newFeet;
	document.aspnetForm.inches.value = 0;
		if (isNaN(newFeet))
		{
			alert("All fields must be filled in with a number.");
			document.aspnetForm.feet.value = "";
			document.aspnetForm.inches.value = "";


		}
	}
}

function falseSub()
{
return false;
}
function totalHours()
{
	document.aspnetForm.totHrs.value = 0;
	for(i=0; i < 9; i++){
		temp = parseFloat(document.aspnetForm.elements[i].value);
		if(isNaN(temp))
		{}
		else{
			document.aspnetForm.totHrs.value = parseFloat(document.aspnetForm.totHrs.value) + temp;
		}
	}
}

multiplier = new Array();

multiplier[0] = 1.00;
multiplier[1] = 1.35;
multiplier[2] = 2.00;
multiplier[3] = 2.50;
multiplier[4] = 3.00;
multiplier[5] = 4.25;
multiplier[6] = 5.00;
multiplier[7] = 6.00;
multiplier[8] = 8.00;


function metricWeight()
{
	var kgWeight = parseFloat(document.aspnetForm.weight.value);
	if(document.aspnetForm.units[0].checked)
	{kgWeight /= 2.205}
	return kgWeight;
}

function dayCalCalc()
{
	dayCal = 0;
	weight = metricWeight();
	if (isNaN(weight))
	{alert("Please enter a weight,\nand select whether it's in lbs. or kg.");}
	if (document.aspnetForm.totHrs.value != 24)
	{
		alert("You must have 24 \"Total Hours\" in your day.");
		document.aspnetForm.calTotal.value = "";
	}
	else{
		for(i=0; i < 9; i++){
			temp = parseFloat(document.aspnetForm.elements[i].value);
			if(isNaN(temp))
			{} 
			else{
				dayCal += (temp * multiplier[i]);
			}
		}
		dayCal *= weight;
		dayCalString = dayCal.toString();
		document.aspnetForm.calTotal.value = (dayCalString.substring(0,4));
	}
}

function falseSub ()
{
return false;
}

