function validate_form(formName)
{
	var scoreOK = true;
	var illegalChars = /[^0-9]/; // Used for checking score values
	var illegalChars2 = /[^a-zA-Z]'/; //Used for name checks
	var message = "";

	if(formName.cancelled[0].checked) {
	//if(formName.name == "normalGame") {
		//Need to make sure that they don't select the indexes that are dividers for the dropdown menus for each division. Need to change this when the number of teams in the league changes.
		if(formName.winTeam.selectedIndex == 0 || formName.winTeam.selectedIndex == 1 || formName.winTeam.selectedIndex == 8 || formName.winTeam.selectedIndex == 19 || formName.winTeam.selectedIndex == 28 || formName.winTeam.selectedIndex == 35) {
			message += "WINNING TEAM is invalid!\n";
		}
		//Need to make sure that they don't select the indexes that are dividers for the dropdown menus for each division. Need to change this when the number of teams in the league changes.
		if(formName.loseTeam.selectedIndex == 0 || formName.loseTeam.selectedIndex == 1 || formName.loseTeam.selectedIndex == 8 || formName.loseTeam.selectedIndex == 19 || formName.loseTeam.selectedIndex == 28 || formName.loseTeam.selectedIndex == 35) {
			message += "LOOSING TEAM is invalid!\n";
		}
		//Make sure that a SUBMITTING team is selected when its a TIE
		if(formName.tieGame[1].checked) {
			if(formName.tieTeam.selectedIndex == 0 || formName.tieTeam.selectedIndex == 1 || formName.tieTeam.selectedIndex == 8 || formName.tieTeam.selectedIndex == 19 || formName.tieTeam.selectedIndex == 28 || formName.tieTeam.selectedIndex == 35) {
				message += "Please Indicate what Team you are submitting the Tie Score for!\n";
			}
		}
		if(formName.winTeam.selectedIndex == formName.loseTeam.selectedIndex) {
			message += "WINNING TEAM and LOOSING TEAM have to be distinct values!\n";
		}
		if(illegalChars.test(formName.winScore.value) || formName.winScore.value == "") {
			message += "WINNING TEAM SCORE value is invalid!\n";
			scoreOK = false;
		}
		if(illegalChars.test(formName.loseScore.value) || formName.loseScore.value == "") {
			message += "LOOSING TEAM SCORE value is invalid!\n";
			scoreOK = false;
		}
		if(scoreOK) {
			if((formName.winScore.value == formName.loseScore.value) && formName.tieGame[0].checked) {
				message += "YOU MUST answer YES to \"WAS THIS GAME A TIE?\" when there is a tie game!\n";
			}
			if((formName.winScore.value != formName.loseScore.value) && formName.tieGame[1].checked) {
				message += "Scores are not equal! Please answer NO to \"WAS THIS GAME A TIE?\"\n";
			}
		}
		if(illegalChars2.test(formName.umpire.value) || formName.umpire.value == "") {
			message += "ILLEGAL characters in the umpire name!\n";
		}
		if(illegalChars2.test(formName.submitName.value) || formName.submitName.value == "") {
			message += "ILLEGAL characters in \"Your Name\" field!\n";
		}
	} else if(formName.cancelled[1].checked) {
		//Need to make sure that they don't select the indexes that are dividers for the dropdown menus for each division. Need to change this when the number of teams in the league changes.
		if(formName.visitTeam.selectedIndex == 0 || formName.visitTeam.selectedIndex == 1 || formName.visitTeam.selectedIndex == 8 || formName.visitTeam.selectedIndex == 19 || formName.visitTeam.selectedIndex == 28 || formName.winTeam.selectedIndex == 35) {
			message += "VISITING TEAM is invalid!\n";
		}
		//Need to make sure that they don't select the indexes that are dividers for the dropdown menus for each division. Need to change this when the number of teams in the league changes.
		if(formName.homeTeam.selectedIndex == 0 || formName.homeTeam.selectedIndex == 1 || formName.homeTeam.selectedIndex == 8 || formName.homeTeam.selectedIndex == 19 || formName.homeTeam.selectedIndex == 28 || formName.winTeam.selectedIndex == 35) {
			message += "HOME TEAM is invalid!\n";
		}
		if(formName.visitTeam.selectedIndex == formName.homeTeam.selectedIndex) {
			message += "VISITING TEAM and HOME TEAM have to be distinct values!\n";
		}
		if(illegalChars2.test(formName.submitName2.value) || formName.submitName2.value == "") {
			message += "ILLEGAL characters in \"Your Name\" field!\n";
		}
	}

	if(message != "") {
		alert(message);
		 return false;
	} else {
        return true;
	}
	
}
