function validEmail(email)
{

	// define the invalid characters
	invalidChars = " /:,;'\"\\`~";

	// if the email field is blank, cancel the form submission
	if (email == "")
	{
		return false;
	}

	// if the default email field value is sent, cancel the form submission
	if (email == "name@domain.com")
	{
		return false;
	}

	// if the default email field value is sent, cancel the form submission
	if (email == "youremail@domain.com")
	{
		return false;
	}

	// for every possible invalid character as defined earlier...
	for (i=0; i<invalidChars.length; i++)
	{
		// asssign the current character to a variable for use
		badChar = invalidChars.charAt(i);

		// if the character exists in the email address, cancel the form submission
		if (email.indexOf(badChar,0) > -1)
		{
			return false;
		}
	}

	
	atPos = email.indexOf("@",1);
			
	if (atPos == -1)
	{
		return false;
	}

	if (email.indexOf("@",atPos+1) > -1)
	{
		return false;
	}
			
	periodPos = email.indexOf(".",atPos)
			
	if (periodPos == -1)
	{
		return false;
	}

	if (periodPos+3 > email.length)
	{
		return false;
	}

	return true;

}


function validateEmail()
{
	var noerror = true;
	var errormessage = "Hi, I'm the automated e-mail validator.\r\n\r\n";

	if(document.getElementById("FromName").value == "" || document.getElementById("FromName").value == "Your Name")
	{
		errormessage += "You did not enter in a name for this e-mail.\r\n\r\n";
		noerror = false;
	}

	if(document.getElementById("subject").value == "")
	{
		if(!noerror)
		{
			errormessage += "You also did not ";
		}
		else
		{
			errormessage += "You did not ";
		}
		errormessage += "enter in a subject for this e-mail.\r\n\r\n";
		noerror = false;
	}

	if (!validEmail(document.getElementById("FromEmail").value))
	{
		if(!noerror)
		{
			errormessage += "Lastly, ";
		}
		errormessage += "I don't recognize your e-mail address as entered properly. Perhaps you forgot something or juxtaposed some letters. In any case, I can not send your e-mail until the problem has been corrected. Please double check all your information and try again.";
		noerror = false;
	}

	if(noerror)
	{
		window.alert(errormessage + "Your e-mail will be submitted.");
		return noerror;
	}
	else
	{
		window.alert(errormessage);
		return noerror;
	}
}