//original form at http://www.w3schools.com/js/js_form_validation.asp
function validate_required(field,alerttxt){
with (field){
  if (value==null||value=="") {
    alert(alerttxt);
  	return false;
  	}
  else {
	  return true;
		}
}//endwith
}//endfunction

function goodcontact(field1,field2){
var numcontacts = 2;
if(field1.value == null || field1.value == ""){
  numcontacts--;
	}
if(field2.value == null || field2.value == ""){
  numcontacts--;
	}
return numcontacts;
}//endfunction	
	 
function validate_email(field,alerttxt){
with (field){
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2){
	  alert(alerttxt);
		return false;
		}
  else {
	  return true;
		}
}//endwith
}//endfunction

function validate_quick(thisform){
with (thisform){
  if (validate_required(uname,"Please enter your name!") == false ){
	  uname.focus();
		return false;
		}//endif
  var contacts = goodcontact(uphone,uemail);
	if(contacts < 1){
	  alert("Please provide a means of contacting you!");
		return false;
		}		
	var email_length = uemail.value.length;
	if(email_length > 0){
    if (validate_email(uemail,"Not a valid e-mail address!")== false ){
	    uemail.focus();
		  return false;
		  }	
	}
  if (validate_required(umessage,"Please enter your message!") == false ){
	  umessage.focus();
		return false;
		}//endif	
	var msgLength = umessage.value.length;
	if(msgLength > 2000){
	  msgText.value = msgText.value.substr(0,2000);
		}
  if (validate_required(verification,"Please enter the characters in the image below!") == false ){
	  verification.focus();
		return false;
		}//endif	
}//endwith
}//endfunction