function NumberOfParticipants_change(){

	if (document.form1.NumberOfParticipants.selectedIndex < 0) {
		document.form1.NumberOfParticipants.selectedIndex = 0;
	} 
	document.form1.GolfTotal.value = (document.form1.NumberOfParticipants.selectedIndex + 1) * GolfTotal;
	
	for (i = 1; i < 11; i++) {
	
		if (i <= document.form1.NumberOfParticipants.options[document.form1.NumberOfParticipants.selectedIndex].text) {
			showdiv('Participant' + i);
		}
		else {
			hidediv('Participant' + i);
		}
	}
}
	
function hidediv(id){
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}
	function ValidateForm(){
		var isValid = true;
		var errorString = '';
		if (document.form1.NumberOfParticipants.value > 0) {
			if (document.form1.FirstName1.value == '') {
			isValid = false;
			errorString = errorString + '  - Player 1 First Name is blank \n';
			}
			if (document.form1.LastName1.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 1 Last Name is blank \n';
			}
			if (document.form1.Address1.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 1 Address Name is blank \n';
			}
			if (document.form1.City1.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 1 City is blank \n';
			}
			if (document.form1.State1.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 1 State is blank \n';
			}
			if (document.form1.zip1.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 1 Postal (zip) code is blank \n';
			}
			if (document.form1.Phone1.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 1 Phone is blank \n';
			}
		}
		if (document.form1.NumberOfParticipants.value > 1) {
			if (document.form1.FirstName2.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 2 First Name is blank \n';
			}
			if (document.form1.LastName2.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 2 Last Name is blank \n';
			}
			if (document.form1.Address2.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 2 Address Name is blank \n';
			}
			if (document.form1.City2.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 2 City is blank \n';
			}
			if (document.form1.State2.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 2 State is blank \n';
			}
			if (document.form1.zip2.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 2 Postal (zip) code is blank \n';
			}
			if (document.form1.Phone2.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 2 Phone is blank \n';
			}
		}
		if (document.form1.NumberOfParticipants.value > 2) {
			if (document.form1.FirstName3.value == '') {
			isValid = false;
			errorString = errorString + '  - Player 3 First Name is blank \n';
			}
			if (document.form1.LastName3.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 3 Last Name is blank \n';
			}
			if (document.form1.Address3.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 3 Address Name is blank \n';
			}
			if (document.form1.City3.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 3 City is blank \n';
			}
			if (document.form1.State3.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 3 State is blank \n';
			}
			if (document.form1.zip3.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 3 Postal (zip) code is blank \n';
			}
			if (document.form1.Phone3.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 3 Phone is blank \n';
			}
			
		}
		if (document.form1.NumberOfParticipants.value > 3) {
			if (document.form1.FirstName4.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 4 First Name is blank \n';
			}
			if (document.form1.LastName4.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 4 Last Name is blank \n';
			}
			if (document.form1.Address4.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 4 Address Name is blank \n';
			}
			if (document.form1.City4.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 4 City is blank \n';
			}
			if (document.form1.State4.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 4 State is blank \n';
			}
			if (document.form1.zip4.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 4 Postal (zip) code is blank \n';
			}
			if (document.form1.Phone4.value == '') {
				isValid = false;
				errorString = errorString + '  - Player 4 Phone is blank \n';
			}
		}
		
		if (document.form1.waiver.checked) {
		}
		else {
			isValid = false;
			errorString = errorString + 'You must agree to the waiver statement before submitting this application \n';
		}
		if (isValid) {
			document.form1.submit();
		}
		else {
			alert('I am sorry, but the following errors were found on the page: \n' + errorString);
		}
	}
	
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function Jump(NavUrl){
	window.location.href = NavUrl;
}
