function validate()
// make sure fields we wish to check are not blank and e-mail is valid
{
	var elements = document.forms["frmApply"].elements;
	var emailPattern = /^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]+$/;
	
	for (var i = 0; i < elements.length; i++)
	{
		if (/(^| )checkfield( |$)/.test(elements[i].className) && elements[i].value == "")
		{
			elements[i].focus();
			alert("Please fill out this field");
			return false;
		}
		if (/(^| )checkemail( |$)/.test(elements[i].className) && !emailPattern.test(elements[i].value))
		{
			elements[i].focus();
			alert("Please fill in a valid e-mail address");
			return false;
		}
		if (/(^| )checkcbo( |$)/.test(elements[i].className) && elements[i].value == 0)
		{
			elements[i].focus();
			alert("Please select a value from this field");
			return false;
		}
	}

	return true;
}


//<< Beginning of Calendar
//set todays date
Now = new Date();
NowDay = Now.getDate();
NowMonth = Now.getMonth();
NowYear = Now.getYear();
if (NowYear < 2000) NowYear += 1900; //for Netscape

//function for returning how many days there are in a month including leap years
function DaysInMonth(WhichMonth, WhichYear)
{
  var DaysInMonth = 31;
  if (WhichMonth == "Apr" || WhichMonth == "Jun" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
  if (WhichMonth == "Feb" && (WhichYear/4) != Math.floor(WhichYear/4))	DaysInMonth = 28;
  if (WhichMonth == "Feb" && (WhichYear/4) == Math.floor(WhichYear/4))	DaysInMonth = 29;
  return DaysInMonth;
}

//function to change the available days in a months
function ChangeOptionDays(Which)
{
  DaysObject = eval("document.frmApply." + Which + "Day");
  MonthObject = eval("document.frmApply." + Which + "Month");
  YearObject = eval("document.frmApply." + Which + "Year");

  Month = MonthObject[MonthObject.selectedIndex].text;
  Year = YearObject[YearObject.selectedIndex].text;

  DaysForThisSelection = DaysInMonth(Month, Year);
  CurrentDaysInSelection = DaysObject.length;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      NewOption = new Option(DaysObject.options.length + 1);
      DaysObject.add(NewOption);
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

//function to set options to today
function SetToToday(Which)
{
  DaysObject = eval("document.frmApply." + Which + "Day");
  MonthObject = eval("document.frmApply." + Which + "Month");
  YearObject = eval("document.frmApply." + Which + "Year");

  YearObject[0].selected = true;
  MonthObject[NowMonth].selected = true;

  ChangeOptionDays(Which);

  DaysObject[NowDay-1].selected = true;
}

function gotoLink(form) {
   var OptionIndex=form.ListBoxURL.selectedIndex;
  parent.location = form.ListBoxURL.options[OptionIndex].value;}
function gotoLink2(form) {
   var OptionIndex=form.ListBoxURL.selectedIndex;
  parent.location = form.ListBoxURL.options[OptionIndex].value;}

  