function fncValidateForm(objForm) {
	var strEmptyMsg = "";
	var strErrorMsg = "";
	var intErrors = 0;
	
	function validate(str, text) {
		if (str.indexOf("@") >= 0 || str.indexOf(":") >= 0 || str.indexOf(";") >= 0 || str.split("http").length-1 > 1) {
			strErrorMsg += " --> "+text+"\n";
			intErrors++;
		}
	}
	
	//validates email address
	var reString = /^(\w+([-.]\w)*)+[@]\w+(([-]\w+)*[.]\w+)+$/;
	var regex = new RegExp(reString);
	var strValidSample = "aaa.bbbbbb@cccc.ddd";
	var strEmail = new String(objForm.email.value);
	if (strValidSample.search(regex) == -1) {
		// this is netscape 4.x or early IE 5.0x
		// we'll check for a @, the presence of spaces, a length of at least 6 (a@b.co is the smallest valid email string), the presence of a .
		if((strEmail.indexOf("@") == -1) || (strEmail.indexOf(" ") > -1) || (strEmail.length < 6) || (strEmail.length == 0)  || (strEmail.indexOf(".") == -1)) {
			strEmptyMsg += " --> Email\n";
			intErrors++;
		}
	} else {
		if (objForm.email.value.search(regex) == -1 || strEmail.length == 0) {
			strEmptyMsg += " --> Email\n";
			intErrors++;
		}
	}

// get variables from the form
var strName = new String(objForm.name.value);
var strAddress = new String(objForm.address.value);
var strPostal_address = new String(objForm.postal_address.value);
var strMobile = new String(objForm.mobile.value);
var strPhone = new String(objForm.phone.value);
var strFax = new String(objForm.fax.value);
var strChild1 = new String(objForm.child1_name.value);
var strChild2 = new String(objForm.child2_name.value);
var strChild3 = new String(objForm.child3_name.value);
var strChild4 = new String(objForm.child4_name.value);
var strChild5 = new String(objForm.child5_name.value);
var strConsent = new String(objForm.consent.value);


var strDairy_experience = new String(objForm.dairy_experience.value);
var strOther_agri_experience = new String(objForm.other_agri_experience.value);
var strQualifications = new String(objForm.qualifications.value);
var strDescription1 = new String(objForm.description1.value);
var strReference1 = new String(objForm.reference1.value);
var strDescription2 = new String(objForm.description2.value);
var strReference2 = new String(objForm.reference2.value);
var strDescription3 = new String(objForm.description3.value);
var strReference3 = new String(objForm.reference3.value);
var strReference4 = new String(objForm.reference4.value);
var strSalary = new String(objForm.salary.value);
var strTraining = new String(objForm.training_required.value);
var strHerd_size = new String(objForm.herd_size.value);
var strOther_candidate_info = new String(objForm.other_candidate_info.value);
var strComments = new String(objForm.comments.value);

// check all compulsory fields to see if empty
	if (strName.length == 0) {
		strEmptyMsg += " --> Name\n";
		intErrors++;
	}
	if (strPhone.length == 0) {
		strEmptyMsg += " --> Phone\n";
		intErrors++;
	}	
	if (strAddress.length == 0) {
		strEmptyMsg += " --> Address\n";
		intErrors++;
	}
	if (strPostal_address.length == 0) {
		strEmptyMsg += " --> Postal address\n";
		intErrors++;
	}
	
	// check all fields to see if they contain disallowed characters
	validate(strName, 'Name');
	validate(strAddress, 'Address');	
	validate(strPostal_address, 'Postal address');
	validate(strPhone, 'Phone');
	validate(strFax, 'Fax');
	validate(strMobile, 'Mobile');	
	validate(strChild1, 'Child 1 name');
	validate(strChild2, 'Child 2 name');
	validate(strChild3, 'Child 3 name');
	validate(strChild4, 'Child 4 name');
	validate(strChild5, 'Child 5 name');	
	validate(strComments, 'Comments');
	validate(strDairy_experience, 'Dairy experience');
	validate(strOther_agri_experience, 'Other agricultural experience');
	validate(strQualifications, 'Qualifications');	
	validate(strDescription1, 'Job 1 description');
	validate(strDescription2, 'Job 2 description');
	validate(strDescription3, 'Job 3 description');
	validate(strReference1, 'Job 1 reference');
	validate(strReference2, 'Job 2 reference');	
	validate(strReference3, 'Job 3 reference');
	validate(strReference4, 'Other job references');	
	validate(strSalary, 'Salary');			
	validate(strHerd_size, 'Herd size');		
	validate(strOther_candidate_info, 'Other candidate info');	
	
	if (objForm.consent.checked != true) {
	strEmptyMsg += " --> Please tick the consent checkbox\n";
	intErrors++
	}
	
	// if there are any errors show these
	if(intErrors > 0) {
		var message = '';
		if(strEmptyMsg != '') message = message + "Please fill in the following fields:\n" + strEmptyMsg + "\n";
		if(strErrorMsg != '') message = message + "Please remove the characters : ; or @ and any instances of 'http' in the following fields:\n" + strErrorMsg + "\n";
		
		alert(message);
		return false;
	} else {
		// return true if all ok and send email
		return true;
	}

}