// JavaScript Document
function validateEmail(field) {
	with (field){
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(value)){
			return (true)
		}
		return (false)
	}
}

function validate_required(field,alerttxt){
	with (field){
		if (value==null||value=="")
  			{alert(alerttxt);return false}
		else {return true}
	}
}

function validate(thisform){
	with (thisform){
		if (validate_required(firstName,"Please tell us your First Name")==false) {
			firstName.focus();return false;}
		if (validate_required(lastName,"Please tell us your Last Name")==false) {
			lastName.focus();return false;}
		if (validateEmail(email)==false) {
			alert("Invalid E-mail Address. \nPlease enter a Valid Email Address.");
			email.focus();return false;}
		if (emailConfirm.value!=email.value) {
			alert("The E-mail addresses you entered do not match.\nPlease double check them and try again.");
			emailConfirm.focus();return false;}
		if (validate_required(password,"Please enter a password")==false) {
			password.focus();return false;}
		if (password.value!=passwordConfirm.value) {
			alert("The passwords you entered do not match.\nPlease double check them and try again.");
			passwordConfirm.focus();return false;}
		if (!tou.checked) {
			alert("Please read and agree to the\nTerms of Use and our Privacy Policy");
			tou.focus();return false;}
	} 
}

function validateContact(thisform){
	with (thisform){
		if (validate_required(firstName,"Please tell us your First Name")==false) {
			firstName.focus();return false;}
		if (validate_required(lastName,"Please tell us your Last Name")==false) {
			lastName.focus();return false;}
		if (validateEmail(email)==false) {
			alert("Invalid E-mail Address. \nPlease enter a Valid Email Address.");
			email.focus();return false;}
		if (validate_required(message,"Please enter a message.")==false) {
			message.focus();return false;}
	} 
}

function clearFocus(thisField) {
	thisField.value='';
	thisField.style.color='';
	thisField.style.fontWeight='';
}