function isBlank(theInput){
	if ((theInput.value == "")||(theInput.value == null)){
		return true;
	}
	return false;
}


function isNotEmail(theInput){
	if(isBlank(theInput)){
		return true;
	}
	if((theInput.value.indexOf('@')!=-1)&&(theInput.value.indexOf('.')!=-1)){
		return false;
	}
	return true;
}


function submitForm(theForm){
	var errors='';

	if (isBlank(theForm.name)){
		errors+='\nFirst name';
	}
	
	if (isBlank(theForm.surname)){
		errors+='\nLast name';
	}

	if (isNotEmail(theForm.email)||(theForm.email.value.length < 8)){
		errors+='\nemail';
	}  
	
	if (isBlank(theForm.address1)){
		errors+='\nAddress 1';
	}
	
	if (isBlank(theForm.city)){
		errors+='\nCity';
	}
	
	if (isBlank(theForm.country)){
		errors+='\nCountry';
	}
	
	if (isBlank(theForm.postcode)){
		errors+='\nPostcode';
	}

	if(errors!=''){
		alert('Please amend or enter the following:'+errors);
	}
	else{
		theForm.submit();
	}
}