function calcQTc(form) {
	var qt = form.qt.value;
	var qtunits = form.qtunits.selectedIndex;
	var rr = form.rr.value;
	var rrunits = form.rrunits.selectedIndex;

	if ((qt == "") || (qt <=0) || (isNaN(qt))) {
		alert("Please enter the QT interval.");
		form.qt.focus();
		form.qt.select();
		return false;
	}

	if ((rr == "") || (rr <=0) || (isNaN(rr))) {
		alert("Please enter the RR interval.");
		form.rr.focus();
		form.rr.select();
		return false;
	}

	if (qtunits == 0) {qt = qt/1000};	// convert msec to sec
	if (qtunits == 2) {qt *= 0.04};	// convert boxes to sec

	if (rrunits == 0) {rr = rr/1000};
	if (rrunits == 2) {rr *= 0.04};

// Calculate QTc:	Created by Charles Hu, chuckhu@hotmail.com, July 21, 2000
	var qtc = qt / Math.sqrt(rr);		// units in seconds
	qtc = roundNum(qtc,3);

	form.qtc.value = qtc;
	return true;
}

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