function vContact(theForm){
	var reason="";
	reason+=vCheck(theForm.name, theForm.email, theForm.comments);
	if(reason!=""){
		alert("Required fields:\n\n"+reason);
		return false;
	}else{
		return true;
	}
}
function vCareer(theForm){
	var reason="";
	reason+=vResume(theForm.name, theForm.occupation, theForm.uResume, theForm.resume);
	if(reason!=""){
		alert("Required fields:\n\n"+reason);
		return false;
	}else{
		return true;
	}
}
//check if empty
function trim(s){
  return s.replace(/^\s+|\s+$/, '');
}
function vCheck(nM, eM, cM){
	var error="";
	var tfld=trim(eM.value); // value of field with whitespace trimmed off
	var emailFilter=/^[^@]+@[^@.]+\.[^@]*\w\w$/;
	var illegalChars=/[\(\)\<\>\,\;\:\\\"\[\]]/;

	if(nM.value.length==0){
		nM.style.background='#f4f5b9'; 
		error+="Name.\n"
	}else{
		nM.style.background='#fff';
	}
	if(eM.value==""){
		eM.style.background='#f4f5b9';
		error+="Email.\n";
	}else if(!emailFilter.test(tfld)){    		//test email for illegal characters
		eM.style.background='#f4f5b9';
		error+="Email address is not valid.\n";
	}else if(fld.value.match(illegalChars)){
		eM.style.background='#f4f5b9';
		error+="Email address contains illegal characters.\n";
	}else {
		eM.style.background='#fff';
	}
	if(cM.value.length==0){
		cM.style.background='#f4f5b9'; 
		error+="Comments/Questions.\n"
	}else{
		cM.style.background='#fff';
	}
	return error;
}
function vResume(nM, oC, uR, rS){
	var error="";
	if(nM.value.length==0){
		nM.style.background='#f4f5b9'; 
		error+="Name.\n"
	}else{
		nM.style.background='#fff';
	}
	if(oC.value.length==0){
		oC.style.background='#f4f5b9'; 
		error+="Occupation.\n"
	}else{
		oC.style.background='#fff';
	}
	if(uR.value.length==0 && rS.value.length==0){
		rS.style.background='#f4f5b9'; 
		uR.style.background='#f4f5b9'; 
		error+="Resume Text or Upload Resume.\n"
	}else{
		uR.style.background='#fff';
		rS.style.background='#fff';
	}
	return error;
}