// JavaScript Document

function toggleChildBaggageLocation()
{
	var dropdownIndex = document.getElementById('session_attending').selectedIndex;
	var session = document.getElementById('session_attending')[dropdownIndex].text;
	
	if (session == '')
	{		
		var optionString1 = '<select name="dropoff_at" id="dropoff_at"><option value=\"\">Select a session...</option></select>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option value=\"\">Select a session...</option></select>';
		
		document.getElementById('dropoff_at').disabled = true;
		document.getElementById('pickup_at').disabled = true;
	}

	else  // If they picked something
	{
		document.getElementById('dropoff_at').disabled = false;
		document.getElementById('pickup_at').disabled = false;
		
		var optionString1 = '<select name="dropoff_at" id="dropoff_at"><option value=\"\">Select a location...</option>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option value=\"\">Select a location...</option>';
	
		if (session == 'Session 1')
		{
			optionString1 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Rockland - Palisades Mall</option><option>Westchester - Bloomingdales, White Plains</option><option>New Jersey - Livingston Mall</option><option>Bethesda, MD - Chevy Chase Library</option><option>I plan to drop bags at camp</option><option>I plan to use Camp Trucking</option><option>I plan to use Fedex or UPS</option><option>Flight</option>';	
						   
			optionString2 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>Bethesda, MD - Chevy Chase Library</option><option>I plan to drop bags at camp</option><option>I plan to use Camp Trucking</option><option>I plan to use Fedex or UPS</option><option>Flight</option>';	
		}
		
		if (session == 'Session 2')
		{
			optionString1 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>Cherry Hill, NJ / Philadelphia - Marriot Hotel, Mount Laurel</option><option>Bethesda, MD - Chevy Chase Library</option><option>I plan to drop bags at camp</option><option>I plan to use Camp Trucking</option><option>I plan to use Fedex or UPS</option><option>Flight</option>';	
						   
			optionString2 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>NYC - 5th Avenue Between 86th and 87th St.</option><option>Cherry Hill, NJ / Philadelphia - Marriot Hotel, Mount Laurel</option><option>Bethesda, MD - Chevy Chase Library</option><option>Flight</option><option>I plan to drop bags at camp</option><option>I plan to use Camp Trucking</option><option>I plan to use Fedex or UPS</option><option>Flight</option>';	
		}
		
		if (session == 'Full Summer')
		{
			optionString1 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Rockland - Palisades Mall</option><option>Westchester - Bloomingdales, White Plains</option><option>New Jersey - Livingston Mall</option><option>Bethesda, MD - Chevy Chase Library</option><option>I plan to drop bags at camp</option><option>I plan to use Camp Trucking</option><option>I plan to use Fedex or UPS</option>';	
						   
			optionString2 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>NYC - 5th Avenue Between 86th and 87th St.</option><option>Cherry Hill, NJ / Philadelphia - Marriot Hotel, Mount Laurel</option><option>Bethesda, MD - Chevy Chase Library</option><option>Flight</option><option>I plan to drop bags at camp</option><option>I plan to use Camp Trucking</option><option>I plan to use Fedex or UPS</option>';	
		}	
		
	}
		document.getElementById('dropoff_at_td').innerHTML = optionString1;
		document.getElementById('pickup_at_td').innerHTML = optionString2;
}

function toggleChildCamperLocation()
{
	var dropdownIndex = document.getElementById('session_attending').selectedIndex;
	var session = document.getElementById('session_attending')[dropdownIndex].text;
	
	if (session == '')
	{
		var optionString1 = '<select name="dropoff_at" id="dropoff_at"><option value=\"\">Select a session...</option></select>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option value=\"\">Select a session...</option></select>';
		
		document.getElementById('dropoff_at').disabled = true;
		document.getElementById('pickup_at').disabled = true;
	}

	else  // If they picked something
	{
		document.getElementById('dropoff_at').disabled = false;
		document.getElementById('pickup_at').disabled = false;
		
		var optionString1 = '<select name="dropoff_at" id="dropoff_at"><option value=\"\">Select a location...</option>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option value=\"\">Select a location...</option>';
	
		if (session == 'Session 1')
		{
			optionString1 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>NYC - 5th Avenue Between 86th and 87th St.</option><option>Bethesda, MD - Chevy Chase Library</option><option>Flight</option><option>I plan to drive my child to camp</option>';	
						   
			optionString2 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>Bethesda, MD - Chevy Chase Library</option><option>Flight</option><option>I plan on picking my child up at camp</option>';	
		}
		
		if (session == 'Session 2')
		{
			optionString1 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>Cherry Hill, NJ / Philadelphia - Marriot Hotel, Mount Laurel</option><option>Bethesda, MD - Chevy Chase Library</option><option>I plan on driving my child to camp</option><option>Flight</option>';	
						   
			optionString2 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>NYC - 5th Avenue Between 86th and 87th St.</option><option>Cherry Hill, NJ / Philadelphia - Marriot Hotel, Mount Laurel</option><option>Bethesda, MD - Chevy Chase Library</option><option>Flight</option><option>I plan on picking my child up at camp</option>';	
		}
		
		if (session == 'Full Summer')
		{
			optionString1 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>NYC - 5th Avenue Between 86th and 87th St.</option><option>Bethesda, MD - Chevy Chase Library</option><option>Flight</option><option>I plan to drive my child to camp</option>';	
						   
			optionString2 += '<option>Long Island - Old Bethpage Village Restoration</option><option>Westchester / Rockland - Palisades Mall</option><option>New Jersey - Livingston Mall</option><option>NYC - 5th Avenue Between 86th and 87th St.</option><option>Cherry Hill, NJ / Philadelphia - Marriot Hotel, Mount Laurel</option><option>Bethesda, MD - Chevy Chase Library</option><option>Flight</option><option>I plan on picking my child up at camp</option>';	
		}	
	}
		
		document.getElementById('dropoff_at_td').innerHTML = optionString1;
		document.getElementById('pickup_at_td').innerHTML = optionString2;
}


function validateForm(formName)
{
	var valid = true;
	var form = document.getElementById(formName);
	var alertMsg = '';
	
	if (formName == 'is_baggage_service')
	{	
		
		if (form.email.value == '')
		{
			alertMsg += "Please enter an e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();					
			valid = false;
		}
		
		else if (form.camper_first_name.value == '')
		{
			alertMsg += "Please enter the camper's first name!";
			form.camper_first_name.style.background = 'yellow';
			form.camper_first_name.focus();					
			valid = false;
		}
		
		else if (form.camper_last_name.value == '')
		{
			alertMsg += "Please enter the camper's last name!";
			form.camper_last_name.style.background = 'yellow';
			form.camper_last_name.focus();					
			valid = false;
		}	
		
		


	}
	
	else if (formName == 'is_camper_travel')
	{
		
		if (form.email.value == '')
		{
			alertMsg += "Please enter an e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();			
			valid = false;
		}
		
		else if (form.camper_first_name.value == '')
		{
			alertMsg += "Please enter the camper's first name!";
			form.camper_first_name.style.background = 'yellow';
			form.camper_first_name.focus();			
			valid = false;
		}
		
		else if (form.camper_last_name.value == '')
		{
			alertMsg += "Please enter the camper's last name!";
			form.camper_last_name.style.background = 'yellow';
			form.camper_last_name.focus();			
			valid =false;
		}		
		

	}
	
	else if (formName == 'is_emergency_contact')
	{
		
		
		if (form.filler_email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.filler_email.style.background = 'yellow';
			form.filler_email.focus();
			valid = false;
		}	
		
		else if (form.camper_first_name.value == '')
		{
			alertMsg += "Please enter the camper's first name!";
			form.camper_first_name.style.background = 'yellow';
			form.camper_first_name.focus();
			valid = false;
		}
		
		else if (form.camper_last_name.value == '')
		{
			alertMsg += "Please enter the camper's last name!";
			form.camper_last_name.style.background = 'yellow';
			form.camper_last_name.focus();
			valid = false;
		}
		

	}
	
	else if (formName == 'is_golf')
	{
		
		
		if (form.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}	
		
		else if (form.camper_first_name.value == '')
		{
			alertMsg += "Please enter the camper's first name!";
			form.camper_first_name.style.background = 'yellow';
			form.camper_first_name.focus();
			valid = false;
		}
		
		else if (form.camper_last_name.value == '')
		{
			alertMsg += "Please enter the camper's last name!";
			form.camper_last_name.style.background = 'yellow';
			form.camper_last_name.focus();
			valid = false;
		}
		
		else if (form.package.value == '')
		{
			alertMsg += "Please select a golf package!";
			form.package.style.background = 'yellow';
			form.package.focus();
			valid = false;
		}
		

	}
	
	else if (formName == 'is_horseback')
	{
		
		
		if (form.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}	
		
		else if (form.camper_first_name.value == '')
		{
			alertMsg += "Please enter the camper's first name!";
			form.camper_first_name.style.background = 'yellow';
			form.camper_first_name.focus();
			valid = false;
		}
		
		else if (form.camper_last_name.value == '')
		{
			alertMsg += "Please enter the camper's last name!";
			form.camper_last_name.style.background = 'yellow';
			form.camper_last_name.focus();
			valid = false;
		}
		

	}

	else if (formName == 'is_parent_questionnaire')
	{
		
		
		if (form.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}	
		
		else if (form.camper_first_name.value == '')
		{
			alertMsg += "Please enter the camper's first name!";
			form.camper_first_name.style.background = 'yellow';
			form.camper_first_name.focus();
			valid = false;
		}
		
		else if (form.camper_last_name.value == '')
		{
			alertMsg += "Please enter the camper's last name!";
			form.camper_last_name.style.background = 'yellow';
			form.camper_last_name.focus();
			valid = false;
		}
		

	}
	
	else if (formName == 'is_staff_emergency_contact')
	{
		
	
		if (form.staff_first_name.value == '')
		{
			alertMsg += "Please enter your first name!";
			form.staff_first_name.style.background = 'yellow';
			form.staff_first_name.focus();
			valid = false;
		}
		
		else if (form.staff_last_name.value == '')
		{
			alertMsg += "Please enter your last name!";
			form.staff_last_name.style.background = 'yellow';
			form.staff_last_name.focus();
			valid = false;
		}		
		
		else if (form.staff_email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.staff_email.style.background = 'yellow';
			form.staff_email.focus();
			valid = false;
		}	
		

	}
	
	else if (formName == 'is_staff_getting_to_know')
	{
		
	
		if (form.first_name.value == '')
		{
			alertMsg += "Please enter your first name!";
			form.first_name.style.background = 'yellow';
			form.first_name.focus();
			valid = false;
		}
		
		else if (form.last_name.value == '')
		{
			alertMsg += "Please enter your last name!";
			form.last_name.style.background = 'yellow';
			form.last_name.focus();
			valid = false;
		}		
		
		else if (form.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}	
		

	}
	
	else if (formName == 'is_staff_arrival_info')
	{
		
	
		if (form.first_name.value == '')
		{
			alertMsg += "Please enter your first name!";
			form.first_name.style.background = 'yellow';
			form.first_name.focus();
			valid = false;
		}
		
		else if (form.last_name.value == '')
		{
			alertMsg += "Please enter your last name!";
			form.last_name.style.background = 'yellow';
			form.last_name.focus();
			valid = false;
		}		
		
		else if (form.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}	
		

	}
	
	else if (formName == 'is_group_rental_request')
	{
		
	
		if (form.contact_first_name.value == '')
		{
			alertMsg += "Please enter the contact's first name!";
			form.contact_first_name.style.background = 'yellow';
			form.contact_first_name.focus();
			valid = false;
		}
		
		else if (form.contact_last_name.value == '')
		{
			alertMsg += "Please enter the contact's last name!";
			form.contact_last_name.style.background = 'yellow';
			form.contact_last_name.focus();
			valid = false;
		}		
		
		else if (form.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}	
		

	}
		
	
	else if (formName == 'is_staff_response')
	{
		
		if (form.first_name.value == '')
		{
			alertMsg += "Please enter your first name!";
			form.first_name.style.background = 'yellow';
			form.first_name.focus();
			valid = false;
		}
		
		else if (form.last_name.value == '')
		{
			alertMsg += "Please enter your last name!";
			form.last_name.style.background = 'yellow';
			form.last_name.focus();
			valid = false;
		}	
		
		else if (form.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}				
		
		else if (document.getElementById('response_yes').checked == false && document.getElementById('response_maybe').checked == false && document.getElementById('response_no').checked == false)
		{
			alertMsg += "Please select whether or not you plan on coming back next summer!";
			document.getElementById('response_yes').focus();
			valid = false;
		}	

	}		
	
	
	if (!valid) {alert(alertMsg);} // If invalid, display reason why
	
	return valid;
}