function validateemailthispage() {
	var emailaddress1=document.emailthispageform.emailthispagefrom2
	var emailaddress2=document.emailthispageform.emailthispageto

	if (document.emailthispageform.emailthispagefrom.value=="") {
		alert("Please fill out the Your Name field.");
		document.emailthispageform.emailthispagefrom.focus();
		return false;
	}

	if (document.emailthispageform.emailthispagefrom2.value=="") {
		alert("Please fill out the Your Email field.");
		document.emailthispageform.emailthispagefrom2.focus();
		return false;
	}

	if (checkemail(emailaddress1.value)==false){
		emailaddress1.value="";
		emailaddress1.focus();
		return false;
	}

	if (document.emailthispageform.emailthispageto.value=="") {
		alert("Please fill out the Recipient Email field.");
		document.emailthispageform.emailthispageto.focus();
		return false;
	}

	if (checkemail(emailaddress2.value)==false){
		emailaddress2.value="";
		emailaddress2.focus();
		return false;
	}

	document.emailthispageform.submit();

}

function validate() {
	var emailaddress=document.contactform.email

	if (document.contactform.name.value=="") {
		alert("Please fill out the Name field.");
		document.contactform.name.focus();
		return false;
	}

//	if (document.contactform.email.value=="") {
//		alert("Please fill out the Email field.");
//		document.contactform.email.focus();
//		return false;
//	}

//	if (checkemail(emailaddress.value)==false){
//		emailaddress.value="";
//		emailaddress.focus();
//		return false;
//	}

//	if (document.contactform.phone.value=="") {
//		alert("Please fill out the Phone field.");
//		document.contactform.phone.focus();
//		return false;
//	}

	if (document.contactform.message.value=="") {
		alert("Please fill out the Message field.");
		document.contactform.message.focus();
		return false;
	}

	document.contactform.submit();

}

function checkemail(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1){
		alert("Please enter a valid Email Address.");
		return false;
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		alert("Please enter a valid Email Address.");
		return false;
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		alert("Please enter a valid Email Address.");
		return false;
	}

	if (str.indexOf(at,(lat+1))!=-1){
		alert("Please enter a valid Email Address.");
		return false;
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		alert("Please enter a valid Email Address.");
		return false;
	}

	if (str.indexOf(dot,(lat+2))==-1){
		alert("Please enter a valid Email Address.");
		return false;
	}
	
	if (str.indexOf(" ")!=-1){
		alert("Please enter a valid Email Address.");
		return false;
	}

	return true;
}