// JavaScript Document

window.onload = function(){

	$("email_error").style.display = "none";
	$("name_error").style.display = "none";
	$("comments_error").style.display = "none";
	// turns off form error messages
	
	$("contact_form").onsubmit = function(){
	// instructions for when the send button is clicked

		emailvalue = $F("email");
		// assigns value of email field to variable called emailvalue

		namevalue = $F("name");
		// assigns value of name field to variable called namevalue

		commentsvalue = $F("comments");
		// assigns value of comments field to variable called commentsvalue

		if ((emailvalue == "") || (namevalue == "") || (commentsvalue == "")){
			if (emailvalue == ""){
				new Effect.Appear("email_error");
				// display error message if email field is blank
			}
			else{
				$("email_error").style.display = "none";
			}
			if (namevalue == ""){
				new Effect.Appear("name_error");
				// display error message if name field is blank
			}
			else{
				$("name_error").style.display = "none";
			}
			if (commentsvalue == ""){
				new Effect.Appear("comments_error");
				// display error message if comments field is blank
			}
			else{
				$("comments_error").style.display = "none";
			}
			return false;
			// prevents form from sending
		}
		else{
			$("email_error").style.display = "none";
			$("name_error").style.display = "none";
			$("comments_error").style.display = "none";
			return true;
			// removes error message
			// sends form
		}
	}
	// CLOSES $("contact_form").onsubmit
}