function CheckForm(f){
	msg="";

// Player Info
	if (f.firstName.value.length < 3)
		msg+="Please enter the player's First Name.\n";
	if (f.lastName.value.length < 3)
		msg+="Please enter the player's Last Name.\n";
	validatePhoneNbr(f.homePhone.value, "player's Home Phone Nbr");
	if ((f.mm.selectedIndex < 1)||(f.dd.selectedIndex < 1)||(f.yyyy.selectedIndex < 1))
		msg+="Please enter the player's Birthdate.\n";
	else
		CheckDate(f);
//	if (f.tshirt.selectedIndex < 1)
//		msg+="Please select a t-shirt size.\n";
	if (f.parentFirstName.value.length < 3)
		msg+="Please enter the player's First Parent.\n";
	if (f.parentLastName.value.length < 3)
		msg+="Please enter the player's Last Parent.\n";
	validateEmail(f.email.value, "player's Parent Email");
	if (f.emergencyContact.value.length < 3)
		msg+="Please enter an Emergency Contact.\n";
	validatePhoneNbr(f.emergencyContactPhone.value, "Emergency Contact's Phone Nbr");
	if (msg){
		alert(msg);
		return false;
	}else{
//		if (f.readDisclaimer[1].checked){
			return true;
//		}else{
//			alert("You must read and agree with the terms and\nconditions of this application in order to continue.")
//			return false;
//		}
	}

}
function validatePhoneNbr(n, lit){
	if ((!n) || (n.length < 5))
		msg+="Please fill in "+ lit +" field.\n";
	else{
		j=0;
		for (i=0; i < n.length; i++){
			x=parseInt(n.charAt(i));
			if ((x < 10) && (x ==n.charAt(i))) {
				j++;
			}
		}
		if ((j < 10) || (n.length < 12))
			msg+="Please include Area Code with "+ lit +"\n            (i.e. 123-456-7890)\n";
	}
}

function validateEmail(e, lit){
// verify that the e-mail address has at least this format xx\@xx.xx
	i=e.indexOf('@',0)
	j=e.indexOf('.',i)
	if ((i < 2) || (j < 5) || (e.length < 7)){
		msg+="Please enter a proper E-mail address (i.e. joe\@abc.com)\n";
		return;
	}
	if (((j-i) < 3) || ((e.length - j) < 3)){
		msg+="Please enter a proper E-mail address (i.e. joe\@abc.com)\n";
		return;
	}
}

function montharr(m0,m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11){
        this[0]=m0;this[1]=m1;this[2]=m2;this[3]=m3;this[4]=m4;this[5]=m5;this[6]=m6;this[7]=m7;this[8]=m8;this[9]=m9;this[10]=m10;this[11]=m11;
}
var monthDays = new montharr(31,28,31,30,31,30,31,31,30,31,30,31);
function CheckDate(f){
	mm=f.mm.options[f.mm.selectedIndex].value;
	dd=f.dd.options[f.dd.selectedIndex].value;
	yyyy=f.yyyy.options[f.yyyy.selectedIndex].value;
	if (((yyyy % 4 == 0) && (yyyy % 100 != 0)) || (yyyy % 400 == 0))
		monthDays[1] = 29;
	if ((dd <1) || (dd > monthDays[mm-1]))
		msg+="Invalid Birthdate entered.\n";
}
