//*********************************************************************
// Access date object
	var now = new Date();

// Get month - from 1 to 12 zero based so add 1
	var ThisMonth = now.getMonth() + 1;

// Get day - from 1 to 31
	var ThisDay = now.getDate();

// Get year - four digits
	var ThisYear = now.getFullYear();
//*********************************************************************
	// Opens up a plain window of the url passed to it - used for help pages
	//
	function popwin(bookmark)
	{
	window.open(bookmark,"","alwaysRaised=yes,height=400,width=400,status=no,location=no,toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes");
	}
//*********************************************************************
	// Opens up a plain window of the url passed to it - used for alert pages
	//
	function alertwin(url)
	{
	window.open(url,"","alwaysRaised=yes,height=40,width=350,status=no,location=no,toolbar=no,directories=no,menubar=no,scrollbars=yes,resizable=yes");
	}
//*********************************************************************
	// Checks for empty fields. Receives the field value and url of the alert message - returns false if empty.
	//
	function isFilled(fld,txt)
	{
	if (fld == "")
	{
	alert(txt);
	focus(fld);
	return false;
	}
	return true;
	}
//*********************************************************************
	// Checks for unselected option fields. Receives the field value and url of the alert message - returns false if empty.
	//
	function isSelect(fld,txt)
	{
	if (fld < 1)
	{
	alert(txt);
	return false;
	}
	return true;
	}
//*********************************************************************
	// Password verify
	function verify() 
	{
	pw1 = document.frmNewAcct.Password.value;
	pw2 = document.frmNewAcct.PasswordVerify.value;
	if (pw1 != pw2) 
	{
	alertwin("alert_page.html#Verify");
	return false;
	}
	return true;
	}
//*********************************************************************
	// Validation for the Entry of a State (netscape fix).
	//
	function isState(fld,url)   
  {
  if (fld == "0")
	{
	alertwin(url);
	return false;
	}
	return true;
	}
//*********************************************************************
	//Validate Fieldlength
	//
	function isLength(fld,n,url)
	{
	if (fld == "" || fld.length < n)
		{
		alertwin(url);
		return false;
		}
	return true;
	}
//*********************************************************************
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
	function isDOB(dateStr)
	{
	var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/; // requires 4 digit year

	var matchArray = dateStr.match(datePat); // is the format ok?
	if (matchArray == null)
		{
		alert("Date is not in a valid format.");
		return false;
		}
	month = matchArray[1]; // parse date into variables
	day = matchArray[3];
	year = matchArray[4];
	if (month < 1 || month > 12) // check month range
		{
		alert("Month must be between 1 and 12.");
		return false;
		}	
	if (day < 1 || day > 31)
		{
		alert("Day must be between 1 and 31.");
		return false;
		}
	if ((month==4 || month==6 || month==9 || month==11) && day==31)
		{
		alert("Month "+month+" doesn't have 31 days!");
		return false;
		}
	if (month == 2) // check for february 29th
		{
		var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
		if (day>29 || (day==29 && !isleap))
			{
			alert("February " + year + " doesn't have " + day + " days!");
			return false;
			}
	  }
	if (year<(ThisYear-115))
  {
  alert("Please enter a valid year for the Date of Birth Field.");
  return false;
  }
  if (year>(ThisYear-18))
	{
	alert("You must be 18 or older."); 
	return false;
	}
	if (year<(ThisYear-18))
  return true;
	if (month>ThisMonth)
	{
	alert("You must be 18 or older.");
	return false;
	}
  if (month<ThisMonth) return true;
  if (day>ThisDay)
	{
	alert("You must be 18 or older.");
  return false;
	}  
	return true;
	}
//*********************************************************************
	// Checks radio buttons. Receives the fieldname and url of the alert message - returns false if nothing chosen.
	//
	function radio(fld,txt)
	{
		var ok=false;
		for (var n=0; n<fld.length; n++)
 			{ok = ok || fld[n].checked;}
		
		if (ok == false)
			{
			alert(txt);
			return false;
			}

		return true;
	}
//*********************************************************************
	// Checks if text entered is apha and or spaces - returns false if not
	//
	function isAlpha(fld,url)
	{
	for (var i = 0; i > fld.length; i++) 
		{
		var ch = fld.substring(i, i + 1);
		if (((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && ch != ' ') 
			{
			alertwin(url);
			return false;
			}
		}
	return true;
	}
//*********************************************************************
	// Checks if text entered is numerical, dashes or spaces - returns false if not
	//
	function isNum(fld,url)
	{
	for (var i = 0; i < fld.length; i++) 
		{
		var ch = fld.substring(i, i + 1);
		if ((ch < "0" || "9" < ch) && ch !='-' && ch !=' ') 
			{
			alertwin(url);
			return false;
			}
		}
	return true;
	}
//*********************************************************************
	// Checks if text is not zero - nine, or field empty - returns false
	//
	function isInt(fld,url)
	{
	if (fld == "")
		{alertwin(url);return false;}
	for (var i = 0; i < fld.length; i++) 
		{
		var ch = fld.substring(i, i + 1);
		if (ch < "0" || "9" < ch)
			{
			alertwin(url);
			return false;
			}
		}
	return true;
	}
//*********************************************************************
	// Checks for valid email address
	function isEmail(fld,url)
	{   
	if (fld == "")
		{
		alert(url);  
		return false;       
		}   
	// Return false if e-mail field does not contain a '@' and '.' .   
		if (fld.indexOf ('@',0) == -1 || fld.indexOf ('.',0) == -1)
		{
		alert(url);  
		return false;       
		}
	return true;
	}