// JavaScript 

function beregnhcp2008(form) {
nr = form.teenr.selectedIndex;
if (nr == 0)  {     // hvid herre tee
 slp = 132;        // ny pr.1/1 2008: 132
 cr = 73.2;        // ny pr.1/1 2008: 73,2
 }
if (nr == 1)  {		// gul herre tee
 slp = 129;        // ny pr.1/1 2008: 129
 cr = 71.6;        // ny pr.1/1 2008: 71,6
 }
if (nr == 2)  {     // rød herre tee
 slp = 118;        // ny pr.1/1 2008: 118
 cr = 67.1;        // ny pr.1/1 2008: 67,1 
 }
if (nr == 3)  {      // gul dame tee
 slp = 133;        // ny pr.1/1 2008: 133
 cr = 78.3;        // ny pr.1/1 2008: 78,3
 }
if (nr == 4)  {      // rød dame tee
 slp = 121;        // ny pr.1/1 2008: 121
 cr = 72.7;        // ny pr.1/1 2008: 72,7
 }

{
hcp = form.hcpinp.value
if ( hcp.indexOf(",") == -1) {
   hcp = hcp
   }
else
  { hcp=hcp.substring(0,parseFloat(hcp.indexOf(","))) + "." + hcp.substring(parseFloat(hcp.indexOf(","))+1,4)
   }}
   form.slag.value = Math.round((hcp * slp/113)+cr-72)
 }

