function validate_required(field,alerttxt){
	with (field){
	  if (value==null||value==""){
		  alert(alerttxt);
		  return false;
	  }
	  else{
		  return true;
	  }
	}
}

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;
		}

	}
}


function validate_contact(thisform){
	with (thisform){
		if(captcha.options[captcha.selectedIndex].value == "0"){
			alert('You must change the value of the validation field to submit the form');
			captcha.focus();
			return false;
		}
		if (validate_required(name,"You must fill out a name.")==false){
			name.focus();
			return false;
		}
		if (validate_required(phone,"You must provide a phone number.")==false){
			phone.focus();
			return false;
		}
		if (validate_email(email,"You must give a valid e-mail address.")==false){
			email.focus();
			return false;
		}
		if (validate_required(message,"You must type a message.")==false){
			message.focus();
			return false;
		}
	}
}

