﻿function aagcInit(){
getSecondLevelPageName(strLegendPath);
}
function aagcHistoryGoBack(){
//alert(history[0])
if(window.location.search.indexOf('Id=165') != -1){
history.go(-2)
}
else{
history.go(-1)
}
}
function calcbanehcp(form) {
	//Orginal rating
	//CR = new Array(74.4, 72.4, 69.3, 67.6, 78.3, 74.4, 72.4);
	//Slope = new Array(140, 135, 127, 123, 144, 136, 132);
	
	// midlertidig rating 27-04-2003
	//CR = new Array(73, 70.4, 68.5, 67.3, 76.5, 73.4, 70.9);
	//Slope = new Array(138, 132, 126, 123, 141, 134, 131);

// ny rating december 2008
	CR = new Array(73.7, 71.5, 68.2, 66.6, 78, 73.9, 71.9);
	Slope = new Array(137, 131, 124, 120, 137, 128, 124);

	curCR = CR[form.teeselected.options[form.teeselected.selectedIndex].value];
	curSlope = Slope[form.teeselected.options[form.teeselected.selectedIndex].value];
	
	hcit = form.hcpidx.value;
	if ( hcit.indexOf(",") != -1)
     hcit = hcit.substring(0, parseFloat(hcit.indexOf(","))) + "." + hcit.substring(parseFloat(hcit.indexOf(","))+1,4)
	


	form.banehcp.value = Math.round(parseFloat(hcit) * curSlope / 113 + curCR - 72)
	if (form.banehcp.value == "NaN") form.banehcp.value = "";
	setfocus();
}

function setfocus() {
  document.calcHcpForm.hcpidx.focus();
  document.calcHcpForm.hcpidx.select();
}

function getSecondLevelPageName(str){
//alert(str)
	var myRe=/\d{1,}/g;
	var aPath = new Array();
	aPath[0] = myRe.exec(str);
	var intPathCount = 1;
	while(myRe.lastIndex > 0){
		aPath[intPathCount] = myRe.exec(str);
		intPathCount++;
	}
	var strRe;
	strRe = /<SPAN class="Legend">/gi;
	strLegendPath = strLegendPath.replace(strRe,'');

	strRe = /<\/SPAN>/gi;
	strLegendPath = strLegendPath.replace(strRe,'');

	strRe = / class=Legend/gi;
	strLegendPath = strLegendPath.replace(strRe,'');
strRe = / class="Legend"/gi;
	strLegendPath = strLegendPath.replace(strRe,'');

	strRe = /<\/A>/gi;
	strLegendPath = strLegendPath.replace(strRe,'');

	strRe = /<A href="Default.asp\?ID=\d*"/gi;
	strLegendPath = strLegendPath.replace(strRe,'');

	strLegendPath = strLegendPath.substring(strLegendPath.indexOf('>')+1);
	var aLegendPath = strLegendPath.split('>');
	
	if(aLegendPath.length>=2){
//alert(aLegendPath[1])
		document.getElementById('oHTMLlevel2').innerHTML = '<a href="/default.asp?Id=' + aPath[1] + '" class="pageName">' + aLegendPath[1] + '</a>';
document.getElementById('oHTMLlevel2').style.display= 'block';
	}
}

		function checkHerreklubIndmeldelse(objForm){
//alert('der er pt nogle problemer med denne formular. Pr?v igen senere')
//return false

			var strAlert = ''
			var isChecked = false;
			if(objForm.elements['medlemsnr.'].value == ''){
				strAlert += 'Husk at udfylde feltet: "Medlemsnr."\n'
			}
			if(objForm.elements['Navn'].value == ''){
				strAlert += 'Husk at udfylde feltet: "Navn"\n'
			}
			if(objForm.elements['Adresse'].value == ''){
				strAlert += 'Husk at udfylde feltet: "Adresse"\n'
			}
			if(objForm.elements['Post-nummer'].value == ''){
				strAlert += 'Husk at udfylde feltet: "Postnr."\n'
			}
			if(objForm.elements['By'].value == ''){
				strAlert += 'Husk at udfylde feltet: "By"\n'
			}
			if(objForm.elements['Telefon'].value == ''){
				strAlert += 'Husk at udfylde feltet: "Telefon"\n'
			}
			if(objForm.elements['email'].value == ''){
				strAlert += 'Husk at udfylde feltet: "Email"\n'
			}
			for(i=0;i<objForm.elements['medlem'].length;i++){
				if(objForm.elements['medlem'][i].checked){
					isChecked = true;
					break;				
				}
			}
			if(!isChecked){
				strAlert += 'Husk at vaelge en "Spillegruppe"\n'
			}
			
			if(strAlert != ''){
				alert(strAlert)
			}
			else{
				objForm.submit()

			}
		}

var blnWin = false;
function popImageWin(strSrc,intwidth,intHeight){

var strAtt = 'height='+intHeight+',width='+intwidth
if(!blnWin){
pictWin = window.open('','',strAtt)
blnWin = true;
}
else{
pictWin.close()
pictWin = window.open('','',strAtt)
}
pictWin.document.write('<html><head><title>Billeder</title></head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0><img src='+strSrc+'></body></html>');
}