function calcGFR(form) {
	var ageGroup = form.ageGroup.selectedIndex;
	var height = form.height.value;
	var htUnits = form.htUnits.selectedIndex;
	var cr = form.cr.value;
	var gfr, k;
	
	if ((height == "") || (height <=0) || (isNaN(height))) {
		alert("Please enter the patient's height.");
		form.height.focus();
		form.height.select();
		return false;
	}

	if ((cr == "") || (cr <=0) || (isNaN(cr))) {
		alert("Please enter the serum creatinine.");
		form.cr.focus();
		form.cr.select();
		return false;
	}

// Convert inches to cm
	if (htUnits == 1) {height = height * 2.54}

// What proportionality constant?
	if (ageGroup == 0) {k = 0.33}
	if (ageGroup == 1) {k = 0.45}
	if (ageGroup == 2 || ageGroup == 3) {k = 0.55}
	if (ageGroup == 4) {k = 0.7}

// Schwartz GFR
	gfr = k * height / cr;
	gfr = roundNum(gfr,1);
	form.gfr.value = gfr;
}

function roundNum(thisNum,dec) {
	thisNum = thisNum * Math.pow(10,dec)
	thisNum = Math.round(thisNum)
	thisNum = thisNum / Math.pow(10,dec)
	return thisNum
}

