function pre_validate()
{
	obj_nameFirst = document.getElementById('name_first');
	obj_nameLast = document.getElementById('name_last');
	obj_date = document.getElementById('date');
	obj_time = document.getElementById('time');
	obj_people = document.getElementById('people');
	obj_radioTour = document.getElementById('radio_tour');
	obj_radioRide = document.getElementById('radio_ride');
	obj_type = document.getElementById('type_wrap');
	obj_option = document.getElementById('option_wrap');
	obj_tel1 = document.getElementById('tel1');
	obj_email1 = document.getElementById('email1');
	obj_email2 = document.getElementById('email2');
	var obj_email_filter = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
	var message = "The following required information must be submitted:\r\n";
	var validated = true;
	var warning_date_message = false;
	// check name
	if( obj_nameFirst.value.length == 0 ){
		validated = false;
		message = message + "Please enter your first name.\r\n";
	}
	if( obj_nameLast.value.length == 0 ){
		validated = false;
		message = message + "Please enter your last name.\r\n";
	}
	// check time/date
	if( obj_date.value.length == 0 ||
	    obj_time.selectedIndex == -1 ){
		validated = false;
		message = message + "Please choose the date and time you would like to request a reservation.\r\n";
	} else {

		var todays_date = new Date();
		var selected_date=new Date();
		var comp_date = new Date();
		obj_date = document.getElementById('date').value;
		obj_time = document.getElementById('time').value;
		obj_dateArray = obj_date.split('/');
		obj_timeArray = obj_time.split(':');
		obj_month = parseInt(obj_dateArray[0], 10) - 1;
		obj_date = parseInt(obj_dateArray[1], 10);
		obj_year = parseInt(obj_dateArray[2], 10);
		obj_hour = parseInt(obj_timeArray[0], 10);
		obj_min = parseInt(obj_timeArray[1], 10);
		// set comparison values
		comp_date.setDate(comp_date.getDate()+1);
		selected_date.setFullYear(obj_year,obj_month,obj_date);
		selected_date.setHours(obj_hour, obj_min);
		if (todays_date > selected_date) {
			validated = false;
			message = message + "Please select a date and time that is at least 2 days into the future.\r\n";
		} else {
			warning_date_message = (comp_date >= selected_date);
		}
	}
	// check # of people
	if( obj_people.value == 0 ){
		validated = false;
		message = message + "Please choose the amount of people taking the tour/ride.\r\n";
	}
	// check activity
	if( !obj_radioTour.checked &&
	    !obj_radioRide.checked ){
		validated = false;
		message = message + "Please choose the activity in which you would like to parcitipate.\r\n";
	} else {
		// check type
		objs_radioTypes = obj_type.getElementsByTagName('input');
		subvalidated = false;
		for( i = 0; i < objs_radioTypes.length ; i++ ){
			if( objs_radioTypes[i].checked ){
				subvalidated = true;
			}
		}
		if( !subvalidated ){
			validated = false;
			message = message + "Please choose the activity type/destination.\r\n";
		}
		// check option
		if( obj_radioTour.checked ){
			objs_radioOptions = obj_option.getElementsByTagName('input');
			subvalidated = false;
			for( i = 0; i < objs_radioOptions.length ; i++ ){
				if( objs_radioOptions[i].checked ){
					subvalidated = true;
				}
			}
			if( !subvalidated ){
				validated = false;
				message = message + "Please select an option for the chosen activity.\r\n";
			}
		}
	}
	// check telephone number
	if( obj_tel1.value.length < 10 ){
		validated = false;
		message = message + "Please enter a telephone number (including area code).\r\n";
	}
	// check email
	if( obj_email1.value.length == 0 ){
		validated = false;
		message = message + "Please enter your email address.\r\n";
	}
	// check email confirmation address
	if( obj_email1.value.length > 0 ){
		if( obj_email1.value != obj_email2.value ){
			validated = false;
			message = message + "The email addresses you entered do not match.\r\n";
		} else {
			if ( !obj_email_filter.test(obj_email1.value) ) {
				validated = false;
				message = message + "Please provide a valid email address.";
			}
		}
	}
	// if selected date is within 1 day or less
	if( warning_date_message ){
		alert("WARNING - Reservations that are requested through this online system may not be processed for 24 hours.  We therefore strongly recommend that you call 717-253-7987 to confirm the receipt and processing of your reservation request.");
	}
	// check validation status
	if( !validated ){
		return false;
	} else {
		message_exit = "Thank you for requesting a reservation with SegTours.\r\n\r\nYou will receive TWO emails in response.  The first will acknowledge receipt of your request.  The second will confirm that we are able to accommodate your reservation or it will describe the available alternatives.";

	}
}
function notify()
{
	alert('Note: A request for a Licensed Battlefield Guide is subject to availability. Please note in the comment section how you want us to proceed in the event that we cannot find an available guide (e.g., cancel, reschedule, use recorded audio instead, etc.).');
}
function offerSelections(choice)
{
	typeW = document.getElementById('type_wrap');
	optionW = document.getElementById('option_wrap');
	typeA = document.getElementById('type1');
	typeB = document.getElementById('type2');
	optionA = document.getElementById('option1');
	optionB = document.getElementById('option2');
	
	if(choice == 'tour')
	{
		typeW.innerHTML = typeA.innerHTML;
		optionW.innerHTML = optionA.innerHTML;
	} else {
		typeW.innerHTML = typeB.innerHTML;
		optionW.innerHTML = optionB.innerHTML;
	}
}
function showHours()
{
	date = document.getElementById('date').value;
	time = document.getElementById('time_wrap');
	dateArray = date.split('/');
	month = parseInt(dateArray[0], 10);
	date = parseInt(dateArray[1], 10);
	hourOptions = '';
	switch(month)
	{
		case 1:
		case 2:
		case 12:
			extraText = ( month == 1 ) ? 'in Jan' : ( ( month == 2 ) ? 'in Feb' : 'in Dec' );
			hourOptions += '<option>Closed ' + extraText + '</option>';
			time.innerHTML = '<select name="time" id="time" size="5" disabled>' + hourOptions + '</select><em>*</em>';	
			break;
		case 3:
			hourOptions += '<option value="10:00">10:00am</option>';
			hourOptions += '<option value="14:00">2:00pm</option>';
			break;
		case 4:
			hourOptions += '<option value="09:00">9:00am</option>';
			hourOptions += '<option value="13:00">1:00pm</option>';
			hourOptions += '<option value="17:00">5:00pm</option>';
			break;
		case 5:
			hourOptions += '<option value="09:00">9:00am</option>';
			hourOptions += '<option value="13:00">1:00pm</option>';
			hourOptions += '<option value="17:00">5:00pm</option>';
			break;
		case 6:
			hourOptions += '<option value="08:00">8:00am</option>';
			hourOptions += '<option value="11:00">11:00am</option>';
			hourOptions += '<option value="15:00">3:00pm</option>';
			hourOptions += '<option value="18:00">6:00pm</option>';
			break;
		case 7:
			if( date < 26 )
			{
				hourOptions += '<option value="08:00">8:00am</option>';
				hourOptions += '<option value="11:00">11:00am</option>';
				hourOptions += '<option value="15:00">3:00pm</option>';
				hourOptions += '<option value="18:00">6:00pm</option>';
			} else {
				hourOptions += '<option value="08:00">8:00am</option>';
				hourOptions += '<option value="11:00">11:00am</option>';
				hourOptions += '<option value="14:30">2:30pm</option>';
				hourOptions += '<option value="17:30">5:30pm</option>';
			}
			break;
		case 8:
			if( date < 22 )
			{
				hourOptions += '<option value="08:00">8:00am</option>';
				hourOptions += '<option value="11:00">11:00am</option>';
				hourOptions += '<option value="14:30">2:30pm</option>';
				hourOptions += '<option value="17:30">5:30pm</option>';
			} else {
				hourOptions += '<option value="08:00">8:00am</option>';
				hourOptions += '<option value="11:00">11:00am</option>';
				hourOptions += '<option value="14:00">2:00pm</option>';
				hourOptions += '<option value="17:00">5:00pm</option>';
			}
			break;
		case 9:
			if( date < 9 )
			{
				hourOptions += '<option value="08:00">8:00am</option>';
				hourOptions += '<option value="11:00">11:00am</option>';
				hourOptions += '<option value="14:00">2:00pm</option>';
				hourOptions += '<option value="17:00">5:00pm</option>';
			} else {
				hourOptions += '<option value="08:00">8:00am</option>';
				hourOptions += '<option value="11:00">11:00am</option>';
				hourOptions += '<option value="15:00">3:00pm</option>';
			}
			break;
		case 10:
			hourOptions += '<option value="08:00">8:00am</option>';
			hourOptions += '<option value="11:00">11:00am</option>';
			hourOptions += '<option value="15:00">3:00pm</option>';
			break;
		case 11:
			hourOptions += '<option value="10:00">10:00am</option>';
			hourOptions += '<option value="14:00">2:00pm</option>';
			break;
	}
	if( (month > 2) && (month != 12) )
	{
		time.innerHTML = '<select name="time" id="time" size="5">' + hourOptions + '</select><em>*</em>';	
	}
	
}

