function chk() { 
	str =document.myform.hci.value; 
	x = " "; 
	dot = ","; 
	x = str.split(dot); 
	antal = x.length;
	if (antal > 1){ 
		var str= x[0] + "." + x[1]; 
	}
	document.myform.hci.value = str;
}

function bhcp() {
	if (document.myform.hci.value == "") { 
		alert("Du skal skrive dit handicap"); 
		document.myform.hci.focus(); 
	} 
	chk(); 
	var checkOK = "0123456789-.,"; 
	var checkStr = document.myform.hci.value; 
	var allValid = true; 
	var validGroups = true; 
	var decPoints = 0; 
	var allNum = ""; 
	for (i = 0; i < checkStr.length; i++) { 
		ch = checkStr.charAt(i); 
		for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; 
		if (j == checkOK.length) { 
			allValid = false; break; 
		} 
		if (ch == ",") { 
			allNum += "."; 
			decPoints++; 
		} else if (ch == "." && decPoints != 0) { 
			validGroups = false; 
			break; 
		} else if (ch != ".") allNum += ch; 
	} 
	if (!allValid) { 
		alert("Skriv kun tal i feltet - og brug punktum som decimaltegn!"); 
		document.myform.hci.value=''; 
		document.myform.hci.focus(); 
		document.myform.hcpsyd.value='';
		return (false);
	}
	var parsyd = 72;
	var hci = eval(document.myform.hci.value)
	var tee = eval(document.myform.tee.value)
	var crsyd;
	if (document.myform.sex[0].checked){
		if (document.myform.tee.selectedIndex == 0) {
			//Gul 
			herrercrsyd = 72.0;
			teesyd = 128;
		} else {
			if (document.myform.tee.selectedIndex == 1){
				//R?d 
				herrercrsyd = 67.1;
				teesyd = 116;
			}
		}
		crsyd = herrercrsyd;
	} else {
		if (document.myform.tee.selectedIndex == 0) {
			//Gul 
			Damecrsyd = 78.4;
			teesyd = 134;
		} else {
			if (document.myform.tee.selectedIndex == 1){
				//R?d 
				Damecrsyd = 72.5;
				teesyd = 121;
			}
		}
		crsyd = Damecrsyd;
	}
	var atssyd = (hci*teesyd/113)+crsyd-parsyd;
	document.myform.hcpsyd.value=custRound(atssyd,0);
	if (document.myform.tee.selectedIndex == 2){
		document.myform.hcpnord.value="XXX";
	}
}
function custRound(x,places) { 
	return (Math.round(x*Math.pow(10,places)))/Math.pow(10,places)
}
