
// make sure the form meets with our approval
function validate(f) {
	errors = "";
	
	// run our checks
	if(f.name && f.name.value == "") { errors += "\n- Must complete the Name field."; }
	if(f.email && f.email.value == "") { errors += "\n- Must complete the Email field."; }
	if(f.email && f.email.value != f.email_confirm.value) { errors += "\n- Email doesn't match confirmation."; }
	if(f.cv && f.cv.value == "") { errors += "\n- Must attach a CV."; }
	if(f.message.value == "") { errors += "\n- Must complete the Covering Letter field."; }
	if(!f.confirm.checked) { errors += "\n- You must be eligible to work in the UK!"; }
	
	// if error found, complain
	if(errors != "") {
		errors = "The following problems were found with your details:\n" + errors + "\n\nPlease correct and try again.";
		alert(errors);
		return false;
	}
	
	// otherwise cool, let's go
	else {
		return true;
	}
}

// make sure the form meets with our approval
function sendtoafriend(f) {
	errors = "";
	
	// run our checks
	if(f.name.value == "") { errors += "\n- Must complete the Your Name field."; }
	if(f.email.value == "") { errors += "\n- Must complete the Email field."; }
	if(f.email.value != f.email_confirm.value) { errors += "\n- Email doesn't match confirmation."; }
	
	// if error found, complain
	if(errors != "") {
		errors = "The following problems were found with your details:\n" + errors + "\n\nPlease correct and try again.";
		alert(errors);
		return false;
	}
	
	// otherwise cool, let's go
	else {
		return true;
	}
}
