<!--
	function ValidateForm(oForm)
	{

		var validForm;
		var errMessage;
		var eleFocus;
		validForm = true;
		
		errMessage = "Errors have been recognized in the following fields:";
		
		for (i=0; i < oForm.elements.length-1; i++)
		{
			if ( (oForm.elements[i].name.indexOf("_*") > 0) || (oForm.elements[i].name.indexOf("_required") > 0) )
			{
				if(isBlank(oForm.elements[i]))
				{
					validForm= false;
					errMessage += "\n\t - " + getNewError(oForm.elements[i].name) ;
					continue;
				}
			}
			
			if(oForm.elements[i].name.indexOf("_date") > 0)
			{
				if(isInvalidDate(oForm.elements[i]))
				{
					validForm= false;
					errMessage += "\n\t - " + getNewError(oForm.elements[i].name) ;
				}
			}
			
			if(oForm.elements[i].name.indexOf("_ssn") > 0)
			{
				if(isInvalidSSN(oForm.elements[i]))
				{
					validForm= false;
					errMessage += "\n\t - " + getNewError(oForm.elements[i].name) ;
				}
			}
			
			if(oForm.elements[i].name.indexOf("_zip") > 0)
			{
				if(isInvalidZip(oForm.elements[i]))
				{
					validForm= false;
					errMessage += "\n\t - " + getNewError(oForm.elements[i].name) ;
				}
			}
			
			if(oForm.elements[i].name.indexOf("_phone") > 0)
			{
				if(isInvalidPhoneNumber(oForm.elements[i]))
				{
					validForm= false;
					errMessage += "\n\t - " + getNewError(oForm.elements[i].name) ;
				}
			}

			if(oForm.elements[i].name.indexOf("_afterdate") > 0)
			{
				if(isPostDated(oForm.elements[i]))
				{
					validForm= false;
					errMessage += "\n\t - " + getNewError(oForm.elements[i].name) ;
				}
			}
					
			if(oForm.elements[i].name.indexOf("_email") > 0)
			{
				if(isInvalidEmail(oForm.elements[i]))
				{
					validForm= false;
					errMessage += "\n\t - " + getNewError(oForm.elements[i].name) ;
				}
			}
						
		}
		if (validForm == false)
		{
			alert(errMessage);
			return false;
		}
		else
		{
			return true;
		}
	}
		
	function getNewError(strFieldName)
	{

		if (strFieldName.indexOf("_*") > 0)
			strFieldName = strFieldName.substr(0, strFieldName.indexOf("_*"));
		else if (strFieldName.indexOf("_required") > 0)
				strFieldName = strFieldName.substr(0, strFieldName.indexOf("_required"));
			 else
				strFieldName = strFieldName.substr(0, strFieldName.indexOf("_o"));
			 
	
		while(strFieldName.indexOf("_") >0)
		{
			strFieldName = strFieldName.substr(0,strFieldName.indexOf("_") ) + " " + strFieldName.substr(strFieldName.indexOf("_") + 1, strFieldName.length - strFieldName.indexOf("_"));
			
		}
		return strFieldName;	
	}

	function trim(xstring) {
	//Trims leading and trailing spaces from string - same as VBscript trim
	tmpstr = "";
	if(xstring.substring(0,1) == " ") {
		//alert("first space");
		tmpstr = trim(xstring.substring(1,xstring.length));
	}
	else if(xstring.substring(xstring.length-1,xstring.length) == " ") {
		//alert("last space");
		tmpstr = trim(xstring.substring(0,xstring.length-1));
	}
	else
		tmpstr = xstring;
	return(tmpstr);
	}

	// check for a blank field
	function isBlank(oCheck)
	{
		if(oCheck.length == 0 || oCheck.value == "" )
		{
			return true;
		}
		else{
			return false;
		}	
	
	}


	// check if the specified date is before now
	function isPostDated(oCheck)
	{
	
		if (oCheck.length == 0)
			return false;

		//alert("post dated:" + oCheck.length);			
	
		// retrieve the current day, need to create a current time and
		//  then create the current date only using the precision of 
		//  year, month, date or you wouldn't be allowed to enter todays
		//  date before tomorrow
		var CurrentTime = new Date();
		var CurrentDay = new Date(CurrentTime.getYear(), CurrentTime.getMonth(), CurrentTime.getDate());
	
		if ((new Date(oCheck.value)) < CurrentDay) {
			return true;
		} else {
			return false;
		}
		
	}

	// validate the email address is in the correct format
	function isInvalidEmail(oCheck)
	{
		var Value = oCheck.value;
		
		//alert(Value);

		if (Value.length == 0)
			return false;
		
		// check the email address for the @ symbol
		if ( Value.indexOf('@') < 0 ) {
			return true;
		}

		// make sure there is a period after the @
		if ( Value.indexOf('.', Value.indexOf('@')+1 ) < 0 ) {
			return true;
		}
		
	}
		
	// validate the data is in the correct format
	function isInvalidDate(oCheck)
	{
	
		var Value = oCheck.value;

		if (Value.length == 0)
			return false;
		
		// reformat a single digit month
		var reformatRegex = /^\d{1}\D{1}/;
		if ( reformatRegex.test(Value) ) {
			Value = "0" + Value
		}	

		// reformat a single digit day
		var reformatRegex = /^\d{2}\D{1}\d{1}\D{1}/;
		if ( reformatRegex.test(Value) ) {
			Value = Value.substr(0,3) + "0" + Value.substr(3, Value.length-3)
		}	
	
		// update the form with the formatted value
		oCheck.value = Value;
		
		// validate the date is in the appropriate format
		var regex = /\d{2}\D{1}\d{2}\D{1}\d{4}/;
		if ( regex.test(Value) ) {
				
			var month = Value.substr(0,2);
			var day = Value.substr(3,2);
			var year = Value.substr(6,4);
			
			//alert(month);
			//alert(day);
			//alert(year);
			
			if (month < 1 || month > 12)
				return true;

			if (day < 1 || day > 31)
				return true;

			switch (parseInt(month)) {
				case (1): // jan
					if (day > 31)
						return true;
					break;
				case (2): // feb
					// if the year is exactly divisible by 4 then it is
					//  a leap year  
					//  NOTE: not calculating if year is century year
					//		fix before next century year exactly divisible by 400 ??
					if ((year%4) == 0) {
						if (day > 29)  // leap year # of days
							return true;
					} else {
						if (day > 28)
							return true;
					}
					break;
				case (3): // march
					//  need to look at leap year
					if (day > 31)
						return true;
					break;
				case (4): // april
					if (day > 30)
						return true;
					break;
				case (5): // may
					if (day > 31)
						return true;
					break;
				case (6): // june
					if (day > 30)
						return true;
					break;
				case (7): // july
					if (day > 31)
						return true;
					break;
				case (8): // august
					if (day > 31)
						return true;
					break;
				case (9): // sept
					if (day > 30)
						return true;
					break;
				case (10): // oct
					if (day > 31)
						return true;
					break;
				case (11): // nov
					if (day > 30)
						return true;
					break;
				case (12): // dec
					if (day > 31)
						return true;
					break;
			}
			
			// check that the year is 19XX or greater
			if (year.substr(0,2) < 19)
				return true;
				
			return false;
		}	
		return true;
	}

	
	
	//  validate the ssn number is in the correct format
	function isInvalidSSN(oCheck)
	{
	
		var Value = oCheck.value;
	
		//  if value is empty then return false
		//   for optional fields
		if (Value.length == 0)
			return false;
	
		// validate the date is in the appropriate format
		var regex = /^\d{3}.{1}\d{2}.{1}\d{4}$/;
		if (regex.test(Value)) {

			var ssn1 = Value.substr(0,3);
			var ssn2 = Value.substr(4,2);
			var ssn3 = Value.substr(7,4);
				
			return false;
				
		}			
		return true;
	}

	// validate that the zip code is in the correct format
	function isInvalidZip(oCheck)
	{
	
		// validate the zip is in the correct format
		//  XXXXX format
		var regex = /^\d{5}$/;
		if (regex.test(oCheck.value)) {
			return false;
		}
		//  XXXXX-XXXX format
		regex = /^\d{5}\-\d{4}$/;
		if (regex.test(oCheck.value)) {				
			return false;
		}
		return true;
	}

	// validate that the phone number is in the correct format
	function isInvalidPhoneNumber(oCheck)
	{
	
		var Value = oCheck.value;
	
		if (Value.length == 0)
			return false;
	
		// validate the zip is in the correct format
		//  XXX-XXX-XXXX format
		var regex = /^\d{3}\D{1}\d{3}\D{1}\d{4}$/;
		if (regex.test(Value)) {
		
			// reformat to standard format
			var part1 = oCheck.value.substr(0,3);
			var part2 = oCheck.value.substr(4,3);
			var part3 = oCheck.value.substr(8,4);		
			oCheck.value = "(" + part1 + ") " + part2 + "-" + part3;
		
			return false;
			
		}

		// test for (XXX) XXX-XXXX format
		var regex = /^\(\d{3}\)\s+\d{3}\D{1}\d{4}$/;
		if (regex.test(Value)) {				
			return false;
		}
		
		return true;
		
	}
	
	// reset function for the form clear image.....
	function frmReset(frmName)
	{
		document.forms[frmName].reset();
	}
	
	//  OPEN the help window to the specified section id
	function OpenHelp(SectionId)
	{
		window.open("/help.asp#" + SectionId, "Help","height=600,width=500,scrollbars");
	}
	
	
-->	