DOM = (document.getElementById) ? 1 : 0;
NS4 = (document.layers) ? 1 : 0;
Konqueror = (navigator.userAgent.indexOf("Konqueror") > -1) ? 1 : 0;
Konqueror22 = (navigator.userAgent.indexOf("Konqueror 2.2") > -1 || navigator.userAgent.indexOf("Konqueror/2.2") > -1) ? 1 : 0;
Opera = (navigator.userAgent.indexOf("Opera") > -1) ? 1 : 0;
Opera5 = (navigator.userAgent.indexOf("Opera 5") > -1 || navigator.userAgent.indexOf("Opera/5") > -1) ? 1 : 0;
Opera6 = (navigator.userAgent.indexOf("Opera 6") > -1 || navigator.userAgent.indexOf("Opera/6") > -1) ? 1 : 0;
Opera56 = Opera5 || Opera6;
IE = (navigator.userAgent.indexOf("MSIE") > -1) ? 1 : 0;
IE = IE && !Opera;
IE5 = IE && DOM;
IE4 = (document.all) ? 1 : 0;
IE4 = IE4 && IE && !DOM;

function setLMCookie(name, value) {
	document.cookie = name + "=" + value;
}

function getLMCookie(name) {
	foobar = document.cookie.split(name + "=");
	if (foobar.length < 2) {
		return null;
	}
	tempString = foobar[1];
	if (tempString.indexOf(";") == -1) {
		return tempString;
	}
	yafoobar = tempString.split(";");
	return yafoobar[0];
}


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;
		
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2 - 5;
var wint = (screen.height - h) / 2 - 15;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=no, toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
/*
function TextScroll(scrollname, div_name, up_name, down_name)
{
    this.div_name = div_name;
    this.name = scrollname;
    this.scrollCursor = 0;
    this.speed = 5;
    this.timeoutID = 0;
    this.div_obj = null;
    this.up_name = up_name;
    this.dn_name = down_name;

{
        if (document.getElementById) {
            div_obj = document.getElementById(this.div_name);
            if (div_obj) {
                this.div_obj = div_obj;
                this.div_obj.style.overflow = 'hidden';
            }
            div_up_obj = document.getElementById(this.up_name);
            div_dn_obj = document.getElementById(this.dn_name);
            if (div_up_obj && div_dn_obj) {
 div_up_obj.onmouseover = function() { eval(scrollname + ".scrollUp();") };
div_up_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };

div_dn_obj.onmouseover = function() { eval(scrollname + ".scrollDown();") };
div_dn_obj.onmouseout = function() { eval(scrollname + ".stopScroll();") };
            }
        }
    }

this.stopScroll = function() {
        clearTimeout(this.timeoutID);
    }

this.scrollUp = function() {
        if (this.div_obj) {
            this.scrollCursor = (this.scrollCursor - this.speed) < 0 ? 0 : this.scrollCursor - this.speed;
            this.div_obj.scrollTop = this.scrollCursor;
            this.timeoutID = setTimeout(this.name + ".scrollUp()", 60);
        }
    }

this.scrollDown = function() {
  if (this.div_obj) {
    this.scrollCursor += this.speed;
    this.div_obj.scrollTop = this.scrollCursor;
    if (this.div_obj.scrollTop == this.scrollCursor) {
      this.timeoutID = setTimeout(this.name + ".scrollDown()", 60);
    } else {
      this.scrollCursor = this.div_obj.scrollTop;
    }
  }
}

this.resetScroll = function() {
        if (this.div_obj) {
            this.div_obj.scrollTop = 0;
            this.scrollCursor = 0;
        }
    }
}

*/
