
function calcPhcp(ehcp, par, sr, cr)
{
    phcp = ehcp * sr / 113 + cr - par;
    return phcp;
}

function calculate()
{
    // haal Exact handicap op
    tmp_ehcp = document.getElementById("ehcp").value;
    tmp_s = tmp_ehcp.replace(',','.');
    ehcp = new Number(tmp_s);

    // berekenen playing handicap
    hbt = Math.round(calcPhcp(ehcp, 72.0, 131, 73.5));
    hmt = Math.round(calcPhcp(ehcp, 72.0, 130, 72.6));
    dbt = Math.round(calcPhcp(ehcp, 72.0, 124, 74.9));
    dmt = Math.round(calcPhcp(ehcp, 72.0, 123, 74.0));

    // vul de velden
    document.getElementById("hbtphcp").value = hbt;
    document.getElementById("hmtphcp").value = hmt;
    document.getElementById("dbtphcp").value = dbt;
    document.getElementById("dmtphcp").value = dmt;
        
}

