function VerifyData() {
// Source code to check form data goes here.
// Create a variable to keep track of whether the form is valid.
// Initializing this value to 1 means, in effect, that
// the form is valid unless the value changes sometime in the
// routine.
var valid = 1
var error_msg="";

if (!check_email(document.contact_form.required_email.value)) {
		valid = 0
		error_msg="invalid email address";
	}
if (document.contact_form.required_name.value == "") {
		valid = 0
		error_msg="missing name";
	}
/*
if (document.contact_form.Email.value == "") {
		valid = 0
	}
if (!CheckPhoneNumber(document.contact_form.Phone.value)) {
		valid = 0
	}
*/
// Here we decide whether to submit the form.
	if (!valid) {
	alert("Please complete all the required fields: "+error_msg);
	return(false);
	}
	return valid
	}

function CheckPhoneNumber(TheNumber) {
var valid = 1
var GoodChars = "0123456789()-+ "
var i = 0
if (TheNumber=="") {
// Return false if number is empty
valid = 0
	}
for (i =0; i <= TheNumber.length -1; i++) {
if (GoodChars.indexOf(TheNumber.charAt(i)) == -1) {
// Note: Remove the comments from the following line to see this
// for loop in action.
// alert(TheNumber.charAt(i) + " is no good.")
valid = 0
} // End if statement
	} // End for loop
return valid
}

function check_email(e) {
ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";

for(i=0; i < e.length ;i++){
if(ok.indexOf(e.charAt(i))<0){ 
return (false);
}	
} 

if (document.images) {
re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
if (!e.match(re) && e.match(re_two)) {
return (-1);		
} 

}

}


