//	Be aware this sorce code file is the property of Andrew Jackson, and by copying it, 
//	or distributing the code, you will violate copyright laws.
//	Andrew Jackson, is the code developer and you may seek
//	his permission to use the code on your own page.

//	Developed by:		Andrew Jackson, Interneers
//	Released on:		15 Aug 2002

//	Version No:		1.0

//	Updates:		None




















window.defaultStatus = "Welcome to the Travel2Torbay web site.";

function Move(destination){
	location.href = destination;
}

function checkemail(str){

	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
	if (filter.test(str))
		testresults=true;
	else
		testresults=false;
	return (testresults);
}


function computetotal(booking)
{
	var people = parseInt(booking.No_Of_People_Travelling.value)
	var calc = 0 

	if (booking.Travel_To_Paignton_From.value == 'false') 
		calc += 0
	else
		calc += 1
		
	if (booking.Travel_From_Paignton_To.value == 'false')
		calc += 0
	else
		calc += 1
		
	if (calc == 0)
		alert("Please enter a Travel to Paignton from or Travel from Paignton to destination")
	else if (calc == 1)
		booking.total.value = '#' + (people * 40)
	else
		booking.total.value = '#' + (people * 70)
}
function ContactForm()
{
	if (document.webform.name.value.length < 1){
		alert("Please enter your full name.");
		document.webform.name.focus();
		return false;
	}
	if (document.webform.email.value.length < 1){
		alert("Please enter a contact email address.");
		document.webform.email.focus();
		return false;
	}
	if (document.webform.word.value.length < 1){
		alert("Please enter the Security word.");
		document.webform.word.focus();
		return false;
	}
	isemail = checkemail(document.webform.email.value);
	if (!isemail){
		alert("Email Address does not follow normal guidelines. Please try again or Email admin@travel2torbay.co.uk directly.");
		document.webform.email.focus();
		return false;
	}
}
function BookingForm()
{
	if (document.bookingform.bookername.value.length < 1){
		alert("Please enter your full name.");
		document.bookingform.bookername.focus();
		return false;
	}
	if (document.bookingform.address.value.length < 1){
		alert("Please enter your address.");
		document.bookingform.address.focus();
		return false;
	}
	if (document.bookingform.town_city.value.length < 1){
		alert("Please enter your Town/City.");
		document.bookingform.town_city.focus();
		return false;
	}
	if (document.bookingform.county.value.length < 1){
		alert("Please enter your Country.");
		document.bookingform.county.focus();
		return false;
	}
	if (document.bookingform.post_code.value.length < 1){
		alert("Please enter your Post Code.");
		document.bookingform.post_code.focus();
		return false;
	}
	if (document.bookingform.phone_number.value.length < 1){
		alert("Please enter your contact Phone Number.");
		document.bookingform.phone_number.focus();
		return false;
	}
	if (document.bookingform.email.value.length < 1){
		alert("Please enter a contact email address.");
		document.bookingform.email.focus();
		return false;
	}
	
	if (document.bookingform.Travel_To_Paignton_Date.value.length < 1){
		alert("Please enter a Travel to Paignton Date.");
		document.bookingform.Travel_To_Paignton_Date.focus();
		return false;
	}
	if (document.bookingform.word.value.length < 1){
		alert("Please enter the Security word.");
		document.bookingform.word.focus();
		return false;
	}
	if (document.bookingform.Travel_From_Paignton_Date.value.length < 1){
		alert("Please enter a Travel from Paignton Date.");
		document.bookingform.Travel_From_Paignton_Date.focus();
		return false;
	}
	if (document.bookingform.No_Of_People_Travelling.value.length < 1){
		alert("Please enter the number of people the booking is for.");
		document.bookingform.No_Of_People_Travelling.focus();
		return false;
	}
	isemail = checkemail(document.bookingform.email.value);
	if (!isemail){
		alert("Email Address does not follow normal guidelines. Please try again or Email admin@travel2torbay.co.uk directly.");
		document.bookingform.email.focus();
		return false;
	}
}
function Move(destination){
	location.href = destination;
}


function Status(message)
{
	window.status = message;
}