function checkName(){
	
	if (document.contactForm.name.value == ""){
		alert("Please enter your full name." + "\n")
		return false
	}
	else
	return true
}

function checkEmail() {
	email = document.contactForm.email.value
	AtPos = email.indexOf("@")
	StopPos = email.lastIndexOf(".")
	Message = ""
	
	if (email == "") {
		alert("Please enter a valid Email address" + "\n")
		return false
	}
	
	if (AtPos == -1 || StopPos == -1) {
		alert("Please enter a valid Email address" + "\n")
		return false
	}
	
	if (StopPos < AtPos) {
		alert("Please enter a valid Email address" + "\n")
		return false
	}
	
	if (StopPos - AtPos == 1) {
		alert("Please enter a valid Email address" + "\n")
		return false
	} 
	
	else
	return true
}

function checkNumber(){
	var x=document.contactForm.telephoneNumber.value
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(x))
		testresult=true
	else
		{
		alert("Your telephone number cannot have characters other than numbers.\nPlease check and resubmit.")
		testresult=false
		}
return (testresult)
}

function checkBan(){
	if (document.layers||document.all||document.getElementById)
		return checkNumber()
	else
		return true
}

function checkTelNumber(){
	if(document.contactForm.telephoneNumber.value!=""){
		return checkChars9() && checkBan()
	}
	else
		return true
}

function checkChars9(){
	var minlength=9
	if (document.contactForm.telephoneNumber.value.length<minlength)
		{
		alert("Your Telephone number seems to be too short, please check and resubmit with full area code.")
		return false
		}
	else
		return true
}

function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}

function checkSubject() {
	if(document.contactForm.subject.value == "Please Select")
	{
		alert("Please select the subject of your enquiry.")
		return false
		}
else
	return true
}

function checkPostCode(){
	if(document.contactForm.postCode.value != ""){
		if (document.contactForm.postCode.value.length<5)
			{
			alert("Your Post Code must contain at least 5 digits.")
			return false
			}
		else
			return true
	}
	else
		return true
}

function checkAddInfo(){
	if (document.contactForm.addInfo.value == ""){
			alert("Please enter any additional information relating to your request.")
			return false
	}
	else
		return true
}