// JavaScript Document

function ShowMenu(num, menu, max) 
{ 
	//starting at one, loop through until the number 
	//chosen by the user 
	for(i = 1; i <= num; i++){ 
		//add number onto end of menu 
		var menu2 = menu + i; 
		//change visibility to block, or 'visible' 
		document.getElementById(menu2).style.display = 'block'; 
	} 
	//make a number one more than the number inputed 
	var num2 = num; num2++; 
	//hide it if the viewer selects a number lower 
	//this will hide every number between the selected 
	//number and the maximum 
	//ex. if 3 is selected, hide the <div> cells for 
	//4, 5, and 6 
	//loop until max is reached 
	while(num2 <= max){
		var menu3 = menu + num2; 
		//hide
		document.getElementById(menu3).style.display = 'none'; 
		//add one to loop 
		num2=num2+1; 
	} 
}

function validateForm(){

	if(document.enroll.fname.value=='')
	{
		alert("You must enter the student's first name.");
		document.enroll.fname.focus();
		return false;
	}
	if(document.enroll.lname.value=='')
	{
		alert("You must enter the student's last name.");
		document.enroll.lname.focus();
		return false;
	}
	if(document.enroll.pname.value=='')
	{
		alert("You must enter the parent's last name.");
		document.enroll.pname.focus();
		return false;
	}
	if(document.enroll.phone.value=='')
	{
		alert("You must enter a phone number.");
		document.enroll.phone.focus();
		return false;
	}
	if(document.enroll.pemail.value=='')
	{
		alert("You must enter an email address for the parent so we can make an account for you and send you your receipt.");
		document.enroll.pemail.focus();
		return false;
	}
	if(document.enroll.address.value=='')
	{
		alert("You must enter a billing address.");
		document.enroll.address.focus();
		return false;
	}
	if(document.enroll.city.value=='')
	{
		alert("You must enter a city.");
		document.enroll.city.focus();
		return false;
	}
	if(document.enroll.state.selectedIndex==0)
	{
		alert("You must select a state.");
		document.enroll.state.focus();
		return false;
	}
	if(document.enroll.zip.value=='')
	{
		alert("You must enter a zip code.");
		document.enroll.zip.focus();
		return false;
	}
	if(document.enroll.class_id.selectedIndex==0)
	{
		alert("You must select a class session to attend.");
		document.enroll.class_id.focus();
		return false;
	}
	return true;
}

function check_terms(){

	if(document.form5.agree.checked==false)
	{
		alert("You must read and agree to our terms before enrolling.");
		document.form5.agree.focus();
		return false;
	}
	return true;
}
