
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function Form_Validation(theForm)
{
	if (theForm.FirstName.value == "")
	{
		alert("Please fill out the \"First Name\" field.");
		theForm.FirstName.focus();
		return (false);
	}
	
	if (theForm.FirstName.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"First Name\" field.");
		theForm.FirstName.focus();
		return (false);
	}
	
	if (theForm.LastName.value == "")
	{
		alert("Please fill out the \"Last Name\" field.");
		theForm.LastName.focus();
		return (false);
	}
	
	if (theForm.LastName.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Last Name\" field.");
		theForm.LastName.focus();
		return (false);
	}
	
	if (theForm.Address.value == "")
	{
		alert("Please fill out the \"Address\" field.");
		theForm.Address.focus();
		return (false);
	}
	
	if (theForm.Address.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Address\" field.");
		theForm.Address.focus();
		return (false);
	}
	
	if (theForm.City.value == "")
	{
		alert("Please fill out the \"City\" field.");
		theForm.City.focus();
		return (false);
	}
	
	if (theForm.City.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"City\" field.");
		theForm.City.focus();
		return (false);
	}
	
	if (theForm.State.value == "")
	{
		alert("Please fill out the \"State\" field.");
		theForm.State.focus();
		return (false);
	}
	
	if (theForm.State.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"State\" field.");
		theForm.State.focus();
		return (false);
	}
	
	if (theForm.Zip.value == "")
	{
		alert("Please fill out the \"Zip\" field.");
		theForm.Zip.focus();
		return (false);
	}
	
	if (theForm.Zip.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Zip\" field.");
		theForm.Zip.focus();
		return (false);
	}
	
	// allow for blanks spaces to be entered by adding a space at the end of the string.
	var checkOK = "0123456789--/\()=+ ";
	var checkStr = theForm.Zip.value;
	var allValid = true;
	for (i = 0; i < checkStr.length; i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0; j < checkOK.length; j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
     }	
	 if (!allValid)
	 {
    	alert("Please enter only digit characters in the \"Zip\" field.");
    	theForm.Zip.focus();
    	return (false);
	 }
	
	if (theForm.WorkPhone.value == "")
	{
		alert("Please fill out the \"WorkPhone\" field.");
		theForm.WorkPhone.focus();
		return (false);
	}
	
	if (theForm.WorkPhone.value.length < 7)
	{
		alert("Please enter at least 7 digits in the \"WorkPhone\" field.");
		theForm.WorkPhone.focus();
		return (false);
	}
	
	// allow for blanks spaces to be entered by adding a space at the end of the string.
	var checkOK = "0123456789--/\()=+ ";
	var checkStr = theForm.WorkPhone.value;
	var allValid = true;
	for (i = 0; i < checkStr.length; i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0; j < checkOK.length; j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
     }	
	 if (!allValid)
	 {
    	alert("Please enter only digit characters in the \"WorkPhone\" field.  Example, 489-7843");
    	theForm.WorkPhone.focus();
    	return (false);
	 }
	 
	if (theForm.HomePhone.value == "")
	{
		alert("Please fill out the \"HomePhone\" field.");
		theForm.HomePhone.focus();
		return (false);
	}
	
	if (theForm.HomePhone.value.length < 7)
	{
		alert("Please enter at least 7 digits in the \"HomePhone\" field.");
		theForm.HomePhone.focus();
		return (false);
	}
	
	// allow for blanks spaces to be entered by adding a space at the end of the string.
	var checkOK = "0123456789-/\()=+ ";
	var checkStr = theForm.HomePhone.value;
	var allValid = true;
	for (i = 0; i < checkStr.length; i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0; j < checkOK.length; j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length)
		{
			allValid = false;
			break;
		}
     }	
	 if (!allValid)
	 {
    	alert("Please enter only digit characters in the \"HomePhone\" field.  Example, 489-7843");
    	theForm.HomePhone.focus();
    	return (false);
	 }
	
	if (theForm.Email.value == "")
	{
		alert("Please fill out the \"Email\" field.");
		theForm.Email.focus();
		return (false);
	}
	
	if (theForm.Email.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Email\" field.");
		theForm.Email.focus();
		return (false);
	}
	
	var checkOK = "@";
	var checkStr = theForm.Email.value;
	var allValid = true;
	
	ch = checkStr.indexOf(checkOK);
	if (ch == -1)
	{
    	alert("Please include the \"@\" character in the \"Email\" field.");
    	theForm.Email.focus();
    	return (false);
	}
	
	if (theForm.EventDate.value == "")
	{
		alert("Please fill out the \"Event Date\" field.");
		theForm.EventDate.focus();
		return (false);
	}
	
	if (theForm.EventDate.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Event Date\" field.");
		theForm.EventDate.focus();
		return (false);
	}
	
	if (theForm.EventLocation.value == "")
	{
		alert("Please fill out the \"City/State/Country\" field.");
		theForm.EventLocation.focus();
		return (false);
	}
	
	if (theForm.EventLocation.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"City/State/Country\" field.");
		theForm.EventLocation.focus();
		return (false);
	}
	
	if (theForm.EventName1.value == "")
	{
		alert("Please fill out the \"Name1\" field.");
		theForm.EventName1.focus();
		return (false);
	}
	
	if (theForm.EventName1.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Name1\" field.");
		theForm.EventName1.focus();
		return (false);
	}
	
	if (theForm.EventAddress1.value == "")
	{
		alert("Please fill out the \"Address1\" field.");
		theForm.EventAddress1.focus();
		return (false);
	}
	
	if (theForm.EventAddress1.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Address1\" field.");
		theForm.EventAddress1.focus();
		return (false);
	}
	
	if (theForm.Summary.value == "")
	{
		alert("Please fill out the \"Summary\" field.");
		theForm.Summary.focus();
		return (false);
	}
	
	if (theForm.Summary.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Summary\" field.");
		theForm.Summary.focus();
		return (false);
	}
	
	if (theForm.Summary.value.length > 300)
	{
		alert("Please enter at most 300 characters in the \"Summary\" field.");
		theForm.Summary.focus();
		return (false);
	}
	
	if (theForm.PhoneTime.value == "")
	{
		alert("Please fill out the \"Best Time to Reach You\" field.");
		theForm.PhoneTime.focus();
		return (false);
	}
	
	if (theForm.PhoneTime.value.length < 2)
	{
		alert("Please enter at least 2 characters in the \"Best Time to Reach You\" field.");
		theForm.PhoneTime.focus();
		return (false);
	}
	
	return (true);
}