function checkForm(){
	var hasError = 0;
	var hasError4 = 0;
	var missingFields = "";
	var errorFields = "";
	
	highlightColor = "#ffffcc";
	defaultColor = "#ffffff";
	thisForm = document.contactForm

	var arrFields = new Array("Name","Email","Telephone");
	var arrTitles = new Array("Your Name","Your Email","Your Telephone");

	for(i=0; i<arrFields.length; i++){
		theField = arrFields[i]
		theTitle = arrTitles[i]

		if(isNaN(thisForm[theField].length) || ! isNaN(thisForm[theField].selectedIndex)){
			if(thisForm[theField].value == ""){
				missingFields += theTitle + "\n";
				thisForm[theField].style.background = highlightColor;
				if(hasError == 0){thisForm[theField].focus()}
				hasError = 1;
			}else{
				thisForm[theField].style.background = defaultColor;
			}
		}else{
			var hasNodeSelected = 0;
			for(j=0; j<thisForm[theField].length; j++){
				if(thisForm[theField][j].checked){
					hasNodeSelected++;
				}
			}
			if(hasNodeSelected == 0){
				hasError = 1;
				missingFields += theTitle + "\n";
			}
		}
	}
	
	thisEmail = thisForm.Email
	mail=thisEmail.value;
	atloc=(mail.indexOf("@"));
	if (atloc==-1) {
		thisEmail.style.background = highlightColor;
		errorFields += 'Please enter a valid e-mail address.' + "\n";
		hasError4 = 1;
	}else if (mail.indexOf(".",atloc)==-1) {
		thisEmail.style.background = highlightColor;
		errorFields += 'Please enter a valid e-mail address.' + "\n";
		hasError4 = 1;
	}else if (mail.indexOf(' ') > 0){
		thisEmail.style.background = highlightColor;
		errorFields += 'Please ensure that your email address does not contain spaces.' + "\n";
		hasError4 = 1;
	}	


	if(hasError == 1){
		alert('Please complete the following fields:\n' + missingFields)
		return false;
	}else if (hasError4 == 1){
		alert(errorFields);
		return false;			
	}else{
		return true;
	}

}