function weightCalc()
{
	err = 0;
    var lMinWeight, lMaxWeight;
    var lMinBmi, lMaxBmi;
    var lMinDivBy705, lMaxDivBy705;
    var lHeightInInchesSquared;

	sSex = document.aspnetForm.sex.options[document.aspnetForm.sex.selectedIndex].value;
	lHeight = parseInt(document.aspnetForm.feet.value)*12 + parseInt(document.aspnetForm.inches.value);
	
	if (isNaN(lHeight) && lHeight != "")
		err = 1;
	
	diffHeight = lHeight - 60;
    
    if (sSex == "male")
    {
		lMinBmi = 19.1;
		lMaxBmi = 25.8;
	}
    
    if (sSex == "female")
    {
    	lMinBmi = 20.7;
		lMaxBmi = 26.4;
    }
    
    if (sSex == "")
		err=1;
			
	if (err == 0)
	{
		lMinDivBy705 = (lMinBmi / 705);
		lMaxDivBy705 = (lMaxBmi / 705);
		lHeightInInchesSquared = (lHeight * lHeight);
		lMinWeight = (lMinDivBy705 * lHeightInInchesSquared);
		lMaxWeight = (lMaxDivBy705 * lHeightInInchesSquared);
    	document.aspnetForm.lowWeight.value = Math.round(lMinWeight);
    	document.aspnetForm.highWeight.value = Math.round(lMaxWeight);
    }
}

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;
}


