function calc_legend($grenzen_zas)
{
    global $legend, $zmax, $zgrenzen;
    // calculate the legend values
    $hulpar = explode(',', $grenzen_zas);
    $i = 1;
    // I18N: %d is a year
    $date = new WT_Date('BEF ' . $hulpar[0]);
    $legend[0] = strip_tags($date->display());
    $zgrenzen[0] = $hulpar[0] - 1;
    while (isset($hulpar[$i])) {
        $i1 = $i - 1;
        $date = new WT_Date('BET ' . $hulpar[$i1] . ' AND ' . ($hulpar[$i] - 1));
        $legend[$i] = strip_tags($date->display());
        $zgrenzen[$i] = $hulpar[$i] - 1;
        $i++;
    }
    $zmax = $i;
    $zmax1 = $zmax - 1;
    // I18N: %d is a year
    $date = new WT_Date('AFT ' . $hulpar[$zmax1]);
    $legend[$zmax] = strip_tags($date->display());
    $zgrenzen[$zmax] = 10000;
    $zmax = $zmax + 1;
    if ($zmax > 8) {
        $zmax = 8;
    }
}