// simple validation form for main contact page
// 30.05.2003 RK

function checkInput(formContent) {
	if (formContent.name.value == "")
	{
		alert("Please enter your full name and salutation please.");
		formContent.name.focus();
		return(false);
	}
	if (formContent.submit_by.value == "")
	{
		alert("Please enter your main e-mail address.");
		formContent.submit_by.focus();
		return(false);
	}
	if (!emailFormat(document.submitForm.submit_by))
	{
		alert("Your e-mail address does not appear to be the correct format. Please check your e-mail and try again.");
		formContent.submit_by.focus();
		return(false);
	}
	if (formContent.phone_number.value == "")
	{
		alert("Please enter your full Telephone number including STD code.");
		formContent.phone_number.focus();
		return(false);
	}
	if (formContent.client_candidate.selectedIndex == 0)
	{
		alert("Please inform us whether you are a client or a candidate.");
		formContent.client_candidate.focus();
		return(false);
	}
	if (formContent.nature_of_enquiry.value == "")
	{
		alert("Please indicate the nature of your enquiry. This will enable our staff to deal with your enquiry more efficiently.");
		formContent.nature_of_enquiry.focus();
		return(false);
	}
}

function emailFormat(formInput)
{
	var atPosition, dotPosition, lastPosition;
	with (formInput)
	{
		aPosition = value.indexOf("@");
		dotPosition = value.lastIndexOf(".");
		lastPosition = value.length-1;
		if (aPosition < 1 || dotPosition - aPosition < 2 || lastPosition - dotPosition > 3 || lastPosition - dotPosition < 2)
		{
			return(false);
		}
		return(true);
	}
}
