function calcGFR(form) {
	var ucr = form.ucr.value;
	var pcr = form.pcr.value;
	var uvol = form.uvol.value;
	var volUnits = form.volUnits.selectedIndex;
	var utime = form.utime.value;
	var timeUnits = form.timeUnits.selectedIndex;
	var height = form.height.value;
	var htUnits = form.htUnits.selectedIndex;
	var weight = form.weight.value;
	var wtUnits = form.wtUnits.selectedIndex;

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

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

	if ((uvol == "") || (uvol <=0) || (isNaN(uvol))) {
		alert("Please enter the total urine volume.");
		form.uvol.focus();
		form.uvol.select();
		return false;
	}

	if ((utime == "") || (utime <=0) || (isNaN(utime))) {
		alert("Please enter the total urine collection time.");
		form.utime.focus();
		form.utime.select();
		return false;
	}

// Convert urine volume to cc
	if (volUnits == 2) {uvol *= 1000}
	if (volUnits == 3) {uvol *= 29.57}
	if (volUnits == 4) {uvol *= 236.59}
	if (volUnits == 5) {uvol *= 473.18}
	if (volUnits == 6) {uvol *= 946.35}
	if (volUnits == 7) {uvol *= 3785.41}

// Convert collection time to minutes
	if (timeUnits == 1) {utime *= 60}

// Convert height to centimeters
	if (htUnits == 1) {height *= 2.54}
	if (htUnits == 2) {height *= 30.48}
	if (htUnits == 3) {height *= 100}

// Convert weight to kg
	if (wtUnits == 1) {weight *= 0.45359}


// Creatinine Clearance
	var bsa = height * weight / 3600;
	bsa = Math.sqrt(bsa);
	var gfr = (ucr * uvol) / (pcr * utime);
	gfr = roundNum(gfr,1);
	form.gfr.value = gfr;

	if (height != "" && weight != "") {
	if ((height <= 0) || (isNaN(height))) {
		alert("Please enter the patient's height.");
		form.height.focus();
		form.height.select();
		form.gfrCorrect.value = "";
		return false;
	}

	if ((weight <= 0) || (isNaN(weight))) {
		alert("Please enter the patient's weight.");
		form.weight.focus();
		form.weight.select();
		form.gfrCorrect.value = "";
		return false;
	}

		var gfrCorrect = gfr * 1.73 / bsa;
		gfrCorrect = roundNum(gfrCorrect,1);
		form.gfrCorrect.value = gfrCorrect;
	} else {form.gfrCorrect.value = ""}
}

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