<!-- OSLC Javascripts -->
<!-- Hide script to validate various fields
//
//Set Mail Form destination
//
function SetRecipient(FormName) { 
return(FormName.recipient.value = FormName.SENDTO.options[FormName.SENDTO.selectedIndex].value + '@' + 'oursaviours.org'); 
}
//
//Set Mail Form destination, if general question, change destination to J. Valentine
//
function SetDestination(FormName) 
{ 
 if (FormName.SENDTO.options[FormName.SENDTO.selectedIndex].value == "general")
    {
        return(FormName.recipient.value = 'webmaster' + '@' + 'oursaviours.org');
	return(FormName.destination.value = 'General Question');
    } 
	else 
     { 
 	if (FormName.SENDTO.options[FormName.SENDTO.selectedIndex].value == "praylist")
     	{
	return(FormName.recipient.value = 'jvalentine' + '@' + 'oursaviours.org');
	return(FormName.destination.value = 'Prayer List');
     	} 
	else 
    	{
//alert(FormName.SENDTO.options[FormName.SENDTO.selectedIndex].value + '@' + 'oursaviours.org');
	return(FormName.recipient.value = FormName.SENDTO.options[FormName.SENDTO.selectedIndex].value + '@' + 'oursaviours.org'); 
	}
     }
}
//
//
//Set Care Mail Form subject
//
function SetSubject(FormName) { 
return(FormName.subject.value = 'Care Form-' + FormName.FIRST_NAME.value + ' ' + FormName.LAST_NAME.value); 
}
//
//
//
//Validate volunteer dates filled in
//
//
function EditVolunteer0(FormName) {
 if (FormName.VOLUNTEER[0].checked == true) 
{ 
	if (FormName.VOLUNTEER_DATES.value == "" ||
FormName.VOLUNTEER_DATES.value == null ||
FormName.VOLUNTEER_DATES.value == " " ) 
	{
	  	alert("Please enter preferred dates.");
		FormName.VOLUNTEER_DATES.focus();
		FormName.VOLUNTEER_DATES.select();
		return (false);

	} else {
	//	alert("Volunteer Dates have correct value." + 	//	FormName.VOLUNTEER_DATES.value + 	//	FormName.VOLUNTEER[0].checked );
		return (true);
	}
} else {
	 
		return (true);

		
	}
} 
//
function EditVolunteer1(FormName) {
 if (FormName.VOLUNTEER[1].checked == true) 
{ 
	if (FormName.VOLUNTEER_DATES.value == "" ||
	FormName.VOLUNTEER_DATES.value == null ||
	FormName.VOLUNTEER_DATES.value == " " ) 

	{
	  	alert("Please enter preferred dates.");
		FormName.VOLUNTEER_DATES.focus();
		FormName.VOLUNTEER_DATES.select();
		return (false);
	
	} else {
	//	alert("Volunteer Dates 1 have correct value.");
		return (true);	}
} else {
	
		return (true);

		
	}
} 
//
function EditVolunteer2(FormName) {
 if (FormName.VOLUNTEER[2].checked == true) 
{ 
	if (FormName.VOLUNTEER_DATES.value == "" ||
	FormName.VOLUNTEER_DATES.value == null ||
	FormName.VOLUNTEER_DATES.value == " " ) 

	{
	 	alert("Please enter preferred dates.");
		FormName.VOLUNTEER_DATES.focus();
		FormName.VOLUNTEER_DATES.select();
		return (false);

	} else {
	
	//	alert("Volunteer Dates 2 have correct value.");
		return (true);

	}
} else {
	
		return (true);		
	}
} 
//
function EditVolunteer3(FormName) {
 if (FormName.VOLUNTEER[3].checked == true) 
{ 
	if (FormName.VOLUNTEER_DATES.value == "" ||
	FormName.VOLUNTEER_DATES.value == null) 
	{
	//	alert("Volunteer Dates 3 have correct value." + 	//	FormName.VOLUNTEER[3].checked);
		return (true);
	} else {
		alert("This option does not require preferred dates to be entered. ");
		FormName.VOLUNTEER_DATES.focus();
		FormName.VOLUNTEER_DATES.select();
		return (false);
	}
} else {
	//	 alert("Volunteer Dates 3 has correct value.");
		return (true);
		
	}
} 
//
function EditHelpBake(FieldName) {
 if (document.ACEForm.VOLUNTEER[3].checked == true) 
{ 
if (FieldName.options[FieldName.selectedIndex].value == "" || FieldName.options[FieldName.selectedIndex].value == null)	 

	{
		alert("Please choose two help dates and a bake date.");
		FieldName.focus();
		return (false);
	} else {
	 //	alert("Help Bake Dates have correct value." + 	//	document.ACEForm.VOLUNTEER[3].checked + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
	}
} else {
	//	 alert("Help Bake Dates have correct values." + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
		
	}
} 
//
function EditHelpBake1(FieldName) {
 if (document.ACEForm.VOLUNTEER[3].checked == false) 
{ 
if (FieldName.options[FieldName.selectedIndex].value == "" || FieldName.options[FieldName.selectedIndex].value == null)	 

	{
 	//	alert("Help Bake Dates have correct value." + 	//	document.ACEForm.VOLUNTEER[3].checked + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
		
	} else {
		alert("Help and bake dates dont apply to this choice.");
		FieldName.focus();
		return (false);
	}
} else {
	//	 alert("Help Bake Dates have correct values." + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
		
	}
} 

//
function EditHelp(FormName,FieldName,FieldName2,FieldName3) {
 if (FormName.VOLUNTEER[3].checked == true  && 
	FieldName2.value != "" && 		
	FieldName3.value != "") 
{ 
if (FieldName.options[FieldName.selectedIndex].value == "" || FieldName.options[FieldName.selectedIndex].value == null)	 

	{
		alert("Please choose two help dates.");
		FieldName.focus();
		return (false);
	} else {
	 //	alert("Help Dates have correct value." + 	//	FormName.VOLUNTEER[3].checked + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
	}
} else {
	//	 alert("Help Dates have correct values." + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
		
	}
} 
//
function EditHelp1(FormName,FieldName,FieldName2,FieldName3) {
 if (FormName.VOLUNTEER[3].checked == false  && 
	FieldName2.value != "" && 		
	FieldName3.value != "") 
{ 
if (FieldName.options[FieldName.selectedIndex].value == "" || FieldName.options[FieldName.selectedIndex].value == null)	 

	{
 	//	alert("Help Dates have correct value." + 	//	FormName.VOLUNTEER[3].checked + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
		
	} else {
		alert("Help dates dont apply to this choice.");
		FieldName.focus();
		return (false);
	}
} else {
	//	 alert("Help Dates have correct values." + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
		
	}
} 

//
function EditHelp2(FormName,FieldName,FieldName2,FieldName3) {
if (FieldName.options[FieldName.selectedIndex].value != "" && FieldName.options[FieldName.selectedIndex].value != null)	 
{ 
	if (FieldName2.value == "" || FieldName3.value == "") 

	{
 		alert("Child Name missing for these help dates.");
		FieldName.focus();
		return (false);
		
	} else {
	//	alert("Help dates chosen for this child.");
	//	FieldName.focus();
		return (true);
	}
} else {
	//	 alert("Help Dates have correct values." + 	//	FieldName.options[FieldName.selectedIndex].value );
		return (true);
		
	}
} 


//
//Validate all fields for child 1 are filled in
//
function EditChild1a(FormName) {
 if (FormName.CHILD_1_FIRST_NAME.value != "") 
{ 
	if (FormName.CHILD_1_LAST_NAME.value != "" && 		FormName.CHILD_1_SCHOOL.value != "") 
	{
	//	alert("Child 1 filled in correctly.");
		return (true);
	} else {
		alert("Child 1 requires all fields to be completed.");		
		FormName.CHILD_1_FIRST_NAME.focus();
			FormName.CHILD_1_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 1 first name blank.");
		return (true);
	}
} 
function EditChild1b(FormName) {
 if (FormName.CHILD_1_LAST_NAME.value != "") 
{ 
	if (FormName.CHILD_1_FIRST_NAME.value != "" && 		FormName.CHILD_1_SCHOOL.value != "") 
	{
	//	alert("Child 1 filled in correctly.");
		return (true);
	} else {
		alert("Child 1 requires all fields to be completed.");
			FormName.CHILD_1_FIRST_NAME.focus();
			FormName.CHILD_1_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 1 last name blank.");
		return (true);
	}
} 
function EditChild1c(FormName) {
 if (FormName.CHILD_1_SCHOOL.value != "") 
{ 
	if (FormName.CHILD_1_FIRST_NAME.value != "" && 		FormName.CHILD_1_LAST_NAME.value != "") 
	{
	//	alert("Child 1 filled in correctly.");
		return (true);
	} else {
		alert("Child 1 requires all fields to be completed.");		
			FormName.CHILD_1_FIRST_NAME.focus();
			FormName.CHILD_1_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 1 school name blank.");
		return (true);
	}
} 
//
//Validate all fields for child 2 are filled in
//
function EditChild2a(FormName) {
 if (FormName.CHILD_2_FIRST_NAME.value != "") 
{ 
	if (FormName.CHILD_2_LAST_NAME.value != "" && 		FormName.CHILD_2_SCHOOL.value != ""  &&
		FormName.CHILD_2_BIRTH_MONTH.options[FormName.CHILD_2_BIRTH_MONTH.selectedIndex].value != null  &&
		FormName.CHILD_2_BIRTH_DAY.options[FormName.CHILD_2_BIRTH_DAY.selectedIndex].value != null  &&
FormName.CHILD_2_BIRTH_YEAR.options[FormName.CHILD_2_BIRTH_YEAR.selectedIndex].value != null  &&
		FormName.CHILD_2_AGE.options[FormName.CHILD_2_AGE.selectedIndex].value != null  &&
FormName.CHILD_2_GRADE.options[FormName.CHILD_2_GRADE.selectedIndex].value != null  &&
		(FormName.CHILD_2_SEX[0].checked == true  ||	
		FormName.CHILD_2_SEX[1].checked == true)  
) 
	{
	//	alert("Child 2 filled in correctly.");
		return (true);
	} else {
		alert("Child 2 requires all fields to be completed.");
			FormName.CHILD_2_FIRST_NAME.focus();
			FormName.CHILD_2_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 2 first name blank.");
		return (true);
	}
} 
function EditChild2b(FormName) {
 if (FormName.CHILD_2_LAST_NAME.value != "") 
{ 
	if (FormName.CHILD_2_FIRST_NAME.value != "" && 		FormName.CHILD_2_SCHOOL.value != "" &&
	   	FormName.CHILD_2_BIRTH_MONTH.options[FormName.CHILD_2_BIRTH_MONTH.selectedIndex].value != null  &&
		FormName.CHILD_2_BIRTH_DAY.options[FormName.CHILD_2_BIRTH_DAY.selectedIndex].value != null  &&
FormName.CHILD_2_BIRTH_YEAR.options[FormName.CHILD_2_BIRTH_YEAR.selectedIndex].value != null  &&
		FormName.CHILD_2_AGE.options[FormName.CHILD_2_AGE.selectedIndex].value != null  &&
FormName.CHILD_2_GRADE.options[FormName.CHILD_2_GRADE.selectedIndex].value != null  &&
		(FormName.CHILD_2_SEX[0].checked == true  ||	
		FormName.CHILD_2_SEX[1].checked == true)  
  )
	{
	//	alert("Child 2 filled in correctly.");
		return (true);
	} else {
			alert("Child 2 requires all fields to be completed.");
			FormName.CHILD_2_FIRST_NAME.focus();
			FormName.CHILD_2_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 2 last name blank.");
		return (true);
	}
} 
function EditChild2c(FormName) {
 if (FormName.CHILD_2_SCHOOL.value != "") 
{ 
	if (FormName.CHILD_2_FIRST_NAME.value != "" && 		FormName.CHILD_2_LAST_NAME.value != "" &&
		FormName.CHILD_2_BIRTH_MONTH.options[FormName.CHILD_2_BIRTH_MONTH.selectedIndex].value != null  &&
		FormName.CHILD_2_BIRTH_DAY.options[FormName.CHILD_2_BIRTH_DAY.selectedIndex].value != null  &&
FormName.CHILD_2_BIRTH_YEAR.options[FormName.CHILD_2_BIRTH_YEAR.selectedIndex].value != null  &&
		FormName.CHILD_2_AGE.options[FormName.CHILD_2_AGE.selectedIndex].value != null  &&
FormName.CHILD_2_GRADE.options[FormName.CHILD_2_GRADE.selectedIndex].value != null  &&
		(FormName.CHILD_2_SEX[0].checked == true  ||	
		FormName.CHILD_2_SEX[1].checked == true)  
) 
	{
	//	alert("Child 2 filled in correctly.");
		return (true);
	} else {
		alert("Child 2 requires all fields to be completed.");
			FormName.CHILD_2_FIRST_NAME.focus();
			FormName.CHILD_2_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 2 school name blank.");
		return (true);
	}
} 
//
//Validate all fields for child 3 are filled in
//
function EditChild3a(FormName) {
 if (FormName.CHILD_3_FIRST_NAME.value != "") 
{ 
	if (FormName.CHILD_3_LAST_NAME.value != "" && 		FormName.CHILD_3_SCHOOL.value != ""  &&
	FormName.CHILD_3_BIRTH_MONTH.options[FormName.CHILD_3_BIRTH_MONTH.selectedIndex].value != null  &&
		FormName.CHILD_3_BIRTH_DAY.options[FormName.CHILD_3_BIRTH_DAY.selectedIndex].value != null  &&
FormName.CHILD_3_BIRTH_YEAR.options[FormName.CHILD_3_BIRTH_YEAR.selectedIndex].value != null  &&
		FormName.CHILD_3_AGE.options[FormName.CHILD_3_AGE.selectedIndex].value != null  &&
FormName.CHILD_3_GRADE.options[FormName.CHILD_3_GRADE.selectedIndex].value != null  &&
		(FormName.CHILD_3_SEX[0].checked == true  ||	
		FormName.CHILD_3_SEX[1].checked == true)  
)  
	{
	//	alert("Child 3 filled in correctly.");
		return (true);
	} else {
		alert("Child 3 requires all fields to be completed.");		
		FormName.CHILD_3_FIRST_NAME.focus();
		FormName.CHILD_3_FIRST_NAME.select();
		return (false);
		
	}
} else {
	//	alert("Child 3 first name blank.");
		return (true);
	}
} 
function EditChild3b(FormName) {
 if (FormName.CHILD_3_LAST_NAME.value != "") 
{ 
	if (FormName.CHILD_3_FIRST_NAME.value != "" && 		FormName.CHILD_3_SCHOOL.value != "" &&
		FormName.CHILD_3_BIRTH_MONTH.options[FormName.CHILD_3_BIRTH_MONTH.selectedIndex].value != null  &&
		FormName.CHILD_3_BIRTH_DAY.options[FormName.CHILD_3_BIRTH_DAY.selectedIndex].value != null  &&
FormName.CHILD_3_BIRTH_YEAR.options[FormName.CHILD_3_BIRTH_YEAR.selectedIndex].value != null  &&
		FormName.CHILD_3_AGE.options[FormName.CHILD_3_AGE.selectedIndex].value != null  &&
FormName.CHILD_3_GRADE.options[FormName.CHILD_3_GRADE.selectedIndex].value != null  &&
		(FormName.CHILD_3_SEX[0].checked == true  ||	
		FormName.CHILD_3_SEX[1].checked == true)  
)  
 
	{
	//	alert("Child 3 filled in correctly.");
		return (true);
	} else {
		alert("Child 3 requires all fields to be completed.");		
			FormName.CHILD_3_FIRST_NAME.focus();
			FormName.CHILD_3_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 3 last name blank.");
		return (true);
	}
} 
function EditChild3c(FormName) {
 if (FormName.CHILD_3_SCHOOL.value != "") 
{ 
	if (FormName.CHILD_3_FIRST_NAME.value != "" && 		FormName.CHILD_3_LAST_NAME.value != ""  &&
	FormName.CHILD_3_BIRTH_MONTH.options[FormName.CHILD_3_BIRTH_MONTH.selectedIndex].value != null  &&
		FormName.CHILD_3_BIRTH_DAY.options[FormName.CHILD_3_BIRTH_DAY.selectedIndex].value != null  &&
FormName.CHILD_3_BIRTH_YEAR.options[FormName.CHILD_3_BIRTH_YEAR.selectedIndex].value != null  &&
		FormName.CHILD_3_AGE.options[FormName.CHILD_3_AGE.selectedIndex].value != null  &&
FormName.CHILD_3_GRADE.options[FormName.CHILD_3_GRADE.selectedIndex].value != null  &&
		(FormName.CHILD_3_SEX[0].checked == true  ||	
		FormName.CHILD_3_SEX[1].checked == true)  
)  
 
	{
	//	alert("Child 3 filled in correctly.");
		return (true);
	} else {
		alert("Child 3 requires all fields to be completed.");
			FormName.CHILD_3_FIRST_NAME.focus();
			FormName.CHILD_3_FIRST_NAME.select();
			return (false);
		
	}
} else {
	//	alert("Child 3 school name blank.");
		return (true);
	}
} 
//Presence Edit
function SelectPresent(FieldName) {
if (FieldName.options[FieldName.selectedIndex].value == "" || FieldName.options[FieldName.selectedIndex].value == null)	 
	{	 	
		alert(FieldName.name + " must be entered. " + 		FieldName.options[FieldName.selectedIndex].value);
		FieldName.focus();
		return (false);
} else {
	// alert(FieldName.name + " is correct. " + 	// FieldName.options[FieldName.selectedIndex].value);
	return (true);
}
}


//
//Presence Edit
function EditPresent(FieldName) 
 { 
var str = FieldTrim(FieldName.value); 
if (str.length > 0)
//{alert(str);
//return (true);  }
return (true);  
else { 
alert(FieldName.name + " must be entered. ");
		FieldName.focus();
		return (false);
} 
} 

function FieldTrim(strText) { 
// this will get rid of leading spaces 
while (strText.substring(0,1) == " ") 
strText = strText.substring(1, strText.length); 

// this will get rid of trailing spaces 
while (strText.substring(strText.length-1,strText.length) == " ") 
strText = strText.substring(0, strText.length-1); 

return strText; 
}
//
//

function EditSexF(FormName) {
 if (FormName.CHILD_1_SEX[0].checked == false) 
{ 
	if (FormName.CHILD_1_SEX[1].checked == true) 
	{
	//	alert("Child 1 Sex F has correct value.");
		return (true);
	} else {
		alert("Please select Child 1 Sex.");
		FormName.CHILD_1_SEX[0].focus();
				return (false);
	}
} else {
	//	alert("Child 1 Sex F has correct value.");
		return (true);
		
	}
} 
//
function EditSexM(FormName) {
 if (FormName.CHILD_1_SEX[1].checked == false) 
{ 
	if (FormName.CHILD_1_SEX[0].checked == true) 
	{
	//	alert("Child 1 Sex M has correct value.");
		return (true);
	} else {
		alert("Please select Child 1 Sex.");
		FormName.CHILD_1_SEX[0].focus();
				return (false);
	}
} else {
	//	alert("Child 1 Sex M has correct value.");
		return (true);
		
	}
} 
 
// Numeric edit-checks for numerics if the field is entered and correct // length.  Zero length means just check for presence of numerics. 
function EditNumericValue(FieldName, FieldLength) {
if (isNaN(FieldName.value) == true && FieldName.value != "")	 
	{	 	
	alert(FieldName.name + " is not numeric. ");
	FieldName.focus();
	FieldName.select();
	return (false);
} else {
	if (FieldName.value.length == FieldLength || FieldLength == 0) 
{
	//alert(FieldName.name + " is numeric. ");
		return (true);
	} else {
		alert(FieldName.name + " is not " + FieldLength + " digits. ");
		FieldName.focus();
		FieldName.select();
		return (false);
	}
}
}

//Numeric presence edit-checks for numerics and correct length.  
//Zero length means just check for presence of numerics.
function EditNumericPresent(FieldName, FieldLength) {
if (isNaN(FieldName.value) == true)	 
	{	 	
	alert(FieldName.name + " is not numeric. ");
	FieldName.focus();
	FieldName.select();
	return (false);
} else {
	if (FieldName.value.length == FieldLength || FieldLength == 0) 
{
	//alert(FieldName.name + " is numeric. ");
		return (true);
	} else {
		alert(FieldName.name + " is not " + FieldLength + " digits. ");
		FieldName.focus();
		FieldName.select();
		return (false);
	}
}
}
//Script to edit zip code
function EditZIP(FieldName) {
var valid = "0123456789-";
var hyphencount = 0;

if (FieldName.value.length !=5 && FieldName.value.length != 10) {
alert("Please enter your 5 digit or 5 digit plus 4 zip code.");
FieldName.focus();
FieldName.select();
return false;
}
for (var i=0; i < FieldName.value.length; i++) {
temp = "" + FieldName.value.substring(i, i+1);
if (temp == "-") hyphencount++;
if (valid.indexOf(temp) == "-1") {
alert("Invalid characters in your zip code.  Please try again.");
FieldName.focus();
FieldName.select();
return false;
}
if ((hyphencount > 1) || 
(FieldName.value.length == 10 && "" + FieldName.value.charAt(5) != "-")  || 
(hyphencount > 0 && FieldName.value.length == 5)) {
alert("The hyphen character should be used with a properly formatted 5 digit plus 4 zip code like 12345-6789.   Please try again."); 
FieldName.focus();
FieldName.select();
return false;
   }
}
return true;
}

//script to edit email name for validity
function EditEmail(FieldName) {
/* The following pattern is used to check if the entered e-mail address
   fits the user@domain format.  It also is used to separate the username
   from the domain. */
var emailPat=/^(.+)@(.+)$/
/* The following string represents the pattern for matching all special
   characters.  We don't want to allow special characters in the address. 
   These characters include ( ) < > @ , ; : \ " . [ ]    */
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
/* The following string represents the range of characters allowed in a 
   username or domainname.  It really states which chars aren't allowed. */
var validChars="\[^\\s" + specialChars + "\]"
/* The following pattern applies if the "user" is a quoted string (in
   which case, there are no rules about which characters are allowed
   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   is a legal e-mail address. */
var quotedUser="(\"[^\"]*\")"
/* The following pattern applies for domains that are IP addresses,
   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   e-mail address. NOTE: The square brackets are required. */
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
/* The following string represents an atom (basically a series of
   non-special characters.) */
var atom=validChars + '+'
/* The following string represents one word in the typical username.
   For example, in john.doe@somewhere.com, john and doe are words.
   Basically, a word is either an atom or quoted string. */
var word="(" + atom + "|" + quotedUser + ")"
// The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
/* The following pattern describes the structure of a normal symbolic
   domain, as opposed to ipDomainPat, shown above. */
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var str = FieldTrim(FieldName.value)

/* Finally, let's start trying to figure out if the supplied address is
   valid. */



/* Begin with the coarse pattern to simply break up user@domain into
   different pieces that are easy to analyze. */
var matchArray=FieldName.value.match(emailPat)
if (matchArray==null) {
  /* Too many/few @'s or something; basically, this address doesn't
     even fit the general mould of a valid e-mail address. */
	alert("Email address seems incorrect (check for presence of @ and .'s)");
	FieldName.focus();
      FieldName.select();
      return false;
}
var user=matchArray[1]
var domain=matchArray[2]

// See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
    alert("Email username doesn't seem to be valid.");
    FieldName.focus();
    FieldName.select();
    return false;

}

/* if the e-mail address is at an IP address (as opposed to a symbolic
   host name) make sure the IP address is valid. */
var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Email destination IP address is invalid!");
		  FieldName.focus();
   		  FieldName.select();
              return false;
	    }
    }
    return true
}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Email domain name doesn't seem to be valid.");
      FieldName.focus();
      FieldName.select();
      return false;

}

/* domain name seems valid, but now make sure that it ends in a
   three-letter word (like com, edu, gov) or a two-letter word,
   representing country (uk, nl), and that there's a hostname preceding 
   the domain or country. */

/* Now we need to break up the domain to get a count of how many atoms
   it consists of. */
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || 
    domArr[domArr.length-1].length>3) {
   // the address must end in a two letter or three letter word.
   alert("Email address must end in a three-letter domain, or two letter country.");
   FieldName.focus();
   FieldName.select();
   return false;
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   alert("Email address is missing a hostname!");
   FieldName.focus();
   FieldName.select();
   return false;
}

// If we've gotten this far, everything's valid!
return true;
}


// Stop hiding script -->

