// 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>Select a session...</option></select>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option>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>Select a location...</option>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option>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>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>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>';	
		}
		
		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>';	
						   
			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>';	
		}
		
		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>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>Select a session...</option></select>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option>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>Select a location...</option>';
		var optionString2 = '<select name="pickup_at" id="pickup_at"><option>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>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>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>';	
						   
			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>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 == 'tc_camper_transport')
	{	
		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.email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.email.style.background = 'yellow';
			form.email.focus();
			valid = false;
		}	

	}		
	
	else if (formName == 'tc_group_inquiry')
	{
	
		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 == 'tc_staff_reference')
	{
	
		if (form.applicant_first_name.value == '')
		{
			alertMsg += "Please enter the applicant's first name!";
			form.applicant_first_name.style.background = 'yellow';
			form.applicant_first_name.focus();
			valid = false;
		}
		
		else if (form.applicant_last_name.value == '')
		{
			alertMsg += "Please enter the applicant's last name!";
			form.applicant_last_name.style.background = 'yellow';
			form.applicant_last_name.focus();
			valid = false;
		}		
		
		else if (form.referrer_email.value == '')
		{
			alertMsg += "Please enter your e-mail address!";
			form.referrer_email.style.background = 'yellow';
			form.referrer_email.focus();
			valid = false;
		}	
		
	}	
	
	
	if (!valid) {alert(alertMsg);} // If invalid, display reason why
	
	return valid;
}
