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 strPhone = new String(objForm.telephone.value);
	// I would like to order some salt
	var strType = new String(objForm.type.value);
	var strQuantity = new String(objForm.quantity.value);
	var strDeliveryAddress = new String(objForm.delivery_address.value);
	var strPaymentMethod = new String(objForm.payment_method.value);
	// I have a question
	var strQuestion = new String(objForm.question.value);
	// Other
	var strOther = new String(objForm.other.value);	
	
	// check all compulsory fields to see if empty
	if (strName.length == 0) {
		strEmptyMsg += " --> Name\n";
		intErrors++;
	}
	if (strAddress.length == 0) {
		strEmptyMsg += " --> Address\n";
		intErrors++;
	}
	if (strPhone.length == 0) {
		strEmptyMsg += " --> Telephone\n";
		intErrors++;
	}
	// check all fields to see if they contain disallowed characters
	validate(strName, 'Name');
	validate(strAddress, 'Address');
	validate(strPhone, 'Telephone');
	
	validate(strType, 'Type');
	validate(strQuantity, 'Quantity');
	validate(strDeliveryAddress, 'Delivery address');
	validate(strPaymentMethod, 'Payment method');
	
	validate(strQuestion, 'Question');
	
	validate(strOther, 'Other');
	
	// checking any checboxes which need to be checked
	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;
	}

}
