function Has_Value(Field_Name, Error_Message)
//this function is used to make sure that required form fields have values.
//Field_Name: name of a form field in the form of document.form_name.form_field_name that will be validated.
//Error_Message: this is the alert error message that will be displayed to the user.
{
	if(Field_Name.value.length == 0)
	{
		alert(Error_Message);
		Field_Name.select();
		Field_Name.focus();
		return false;   
	}
	if (Field_Name.value.charAt(0) == " ")
	{
		alert("A blank space cannot be the first character in this field.");
		Field_Name.select();
		Field_Name.focus();
		return false;	
	}
	return true;
}

function Is_Valid_Email(email)
//this function is used to make sure that emails are in the proper format.
//email: name of the form field in the document where the email is input, comes
//in the form of document.form_name.form_field_name
{
	if (email.value.length == 0)
	{
       	return true;
	}
	if(email.value.indexOf("@")==-1)
	{
		alert("Email Address format requires the '@' symbol");
		email.focus();
		return false;
	}
	else
	{
		if(email.value.indexOf(".")==-1)
		{
			alert("Email Address format requires a period (.) and a 3 digit domain.  Example(.com, .net)");
			email.focus();
			return false;
		}
	}
	//loop through checking each char in address.
	//var period_counter; // counts periods in email
	//period_counter = 0;
	var at_symbol_counter; // counts the @ symbol in emails
	at_symbol_counter = 0;
	if (email.value.charAt(0) == "@")
	{
		alert("The @ symbol cannot be the first character of an email address.");
		email.focus();
		return false;	
	}
	for (i=0; i<email.value.length; i++)
	{
		/*
		if (email.value.charAt(i) == ".")
		{
			period_counter = period_counter + 1;
			if (period_counter > 1)
			{
				alert("Email address cannot contain more than one period.");
				email.focus();
				return false;	
			}
		}
		*/
		if (email.value.charAt(i) == "@")
		{
			at_symbol_counter = at_symbol_counter + 1;
			if (at_symbol_counter > 1)
			{
			alert("Email address cannot contain more than one @ symbol.");
			email.focus();
			return false;
		}
	}
	if (email.value.charAt(i) == ";")
	{
		alert("Email address cannot contain a semicolon.");
		email.focus();
		return false;	
	}
	if (email.value.charAt(i) == ",")
	{
		alert("Email address cannot contain a comma.");
		email.focus();
		return false;	
	}
	if (email.value.charAt(i) == ">")
	{
		alert("Email address cannot contain the > symbol.");
		email.focus();
		return false	
	}
	if (email.value.charAt(i) == "<")
	{
		alert("Email address cannot contain the < symbol.");
		email.focus();
		return false;	
	}
	if (email.value.charAt(i) == ")")
	{
		alert("Email address cannot contain the ) symbol.");
		email.focus();
		return false;	
	}
	if (email.value.charAt(i) == "(")
	{
		alert("Email address cannot contain the ( symbol.");
		email.focus();
		return false;	
	}
	if (email.value.charAt(i) == "*")
	{
		alert("Email address cannot contain the * symbol.");
		email.focus();
		return false;	
	}
	if (email.value.charAt(i) == " ")
	{
		alert("Email address cannot contain spaces.");
		email.focus();
		return false;	
	}
  }
  return true;  //Passed all test!
}
