function heartcalculate() {
	var age = parseFloat(document.heartcalc.age.value);
	var maxhr = Math.round(220 - age);
	document.heartcalc.maxhr.value = maxhr;
	document.heartcalc3.maxhr.value = maxhr;
}

function heartcalculate2() {
	var age = parseFloat(document.heartcalc2.age.value);
	var maxhr = Math.round(208 - (0.7 * age));
	document.heartcalc2.maxhr.value = maxhr;
	document.heartcalc3.maxhr.value = maxhr;
}

function heartcalculate3() {
	var maxhr = parseFloat(document.heartcalc3.maxhr.value);
	var rhr = parseFloat(document.heartcalc3.rhr.value);
	var tmphr = maxhr;
	if (rhr != 0) 
		tmphr = maxhr - rhr; 
	var pct90 = 0.9 * tmphr; 
	var pct80 = 0.8 * tmphr; 
	pct70 = 0.7 * tmphr; 
	pct60 = 0.6 * tmphr; 
	if (rhr != 0) { 
		pct90 += rhr; 
		pct80 += rhr; 
		pct70 += rhr; 
		pct60 += rhr; 
	} 
	document.heartcalc3.pct90.value = Math.round(pct90); 
	document.heartcalc3.pct80.value = Math.round(pct80); 
	document.heartcalc3.pct70.value = Math.round(pct70); 
	document.heartcalc3.pct60.value = Math.round(pct60); 
}
