function handicap()
{
var r1_strokes = document.form.r1_strokes.value;
var r1_course = document.form.r1_course.value;
var r1_slope = document.form.r1_slope.value;

var r2_strokes = document.form.r2_strokes.value;
var r2_course = document.form.r2_course.value;
var r2_slope = document.form.r2_slope.value;

var r3_strokes = document.form.r3_strokes.value;
var r3_course = document.form.r3_course.value;
var r3_slope = document.form.r3_slope.value;



if (document.form.r1_holes[1].checked == true)
{
var hd_1 = (Math.round(((r1_strokes * 2) - (r1_course * 2)) * 1130 / r1_slope))/10;
}
else
{
var hd_1 = (Math.round((r1_strokes - r1_course) * 1130 / r1_slope))/10;
}



if (document.form.r2_holes[1].checked == true)
{
var hd_2 = (Math.round(((r2_strokes * 2) - (r2_course * 2)) * 1130 / r2_slope))/10;
}
else
{
var hd_2 = (Math.round((r2_strokes - r2_course) * 1130 / r2_slope))/10;
}



if (document.form.r3_holes[1].checked == true)
{
var hd_3 = (Math.round(((r3_strokes * 2) - (r3_course * 2)) * 1130 / r3_slope))/10;
}
else
{
var hd_3 = (Math.round((r3_strokes - r3_course) * 1130 / r3_slope))/10;
}



var handi = Math.round(((hd_1 + hd_2 + hd_3) / 3 * .96) - .5);

document.form.handi.value = handi;
}





function roll()
{
var dice_din = document.getElementById('dice_total');
var img_name = new Array("images/di_1.gif","images/di_2.gif","images/di_3.gif","images/di_4.gif","images/di_5.gif","images/di_6.gif");

var l = img_name.length;

var rnd_no1 = Math.round((l-1)*Math.random());
var rnd_no2 = Math.round((l-1)*Math.random());
var rnd_no3 = Math.round((l-1)*Math.random());
var rnd_no4 = Math.round((l-1)*Math.random());

document.di1.src = img_name[rnd_no1];
document.di2.src = img_name[rnd_no2];
document.di3.src = img_name[rnd_no3];
document.di4.src = img_name[rnd_no4];

var actual = (rnd_no1 + 1) + (rnd_no2 + 1) + (rnd_no3 + 1) + (rnd_no4 + 1);

dice_din.value = actual;
}


function course_handicap()
        {
var1 = Math.round(document.form1.index.value.replace("+", "-") * document.form1.slp.value/113);
var2 = var1.toString();
var3 = var2.replace("-", "+");
document.form1.hc.value = var3;
        }