function SetCode(Code, Description)
{
   this.Code        = Code;
   this.Description = Description;
}

var StateArray = new Array();
StateArray.push(new SetCode("00", "(Make Selection)"));
StateArray.push(new SetCode("AK", "Alaska"));
StateArray.push(new SetCode("AL", "Alabama"));
StateArray.push(new SetCode("AR", "Arkansas"));
StateArray.push(new SetCode("AZ", "Arizona"));
StateArray.push(new SetCode("CA", "California"));
StateArray.push(new SetCode("CO", "Colorado"));
StateArray.push(new SetCode("CT", "Connecticut"));
StateArray.push(new SetCode("DC", "District of Columbia"));
StateArray.push(new SetCode("DE", "Delaware"));
StateArray.push(new SetCode("FL", "Florida"));
StateArray.push(new SetCode("GA", "Georgia"));
StateArray.push(new SetCode("HI", "Hawaii"));
StateArray.push(new SetCode("IA", "Iowa"));
StateArray.push(new SetCode("ID", "Idaho"));
StateArray.push(new SetCode("IL", "Illinois"));
StateArray.push(new SetCode("IN", "Indiana"));
StateArray.push(new SetCode("KS", "Kansas"));
StateArray.push(new SetCode("KY", "Kentucky"));
StateArray.push(new SetCode("LA", "Louisiana"));
StateArray.push(new SetCode("MA", "Massachusetts"));
StateArray.push(new SetCode("MD", "Maryland"));
StateArray.push(new SetCode("ME", "Maine"));
StateArray.push(new SetCode("MI", "Michigan"));
StateArray.push(new SetCode("MN", "Minnesota"));
StateArray.push(new SetCode("MO", "Missouri"));
StateArray.push(new SetCode("MS", "Mississippi"));
StateArray.push(new SetCode("MT", "Montana"));
StateArray.push(new SetCode("NC", "North Carolina"));
StateArray.push(new SetCode("ND", "North Dakota"));
StateArray.push(new SetCode("NE", "Nebraska"));
StateArray.push(new SetCode("NH", "New Hampshire"));
StateArray.push(new SetCode("NJ", "New Jersey"));
StateArray.push(new SetCode("NM", "New Mexico"));
StateArray.push(new SetCode("NV", "Nevada"));
StateArray.push(new SetCode("NY", "New York"));
StateArray.push(new SetCode("OH", "Ohio"));
StateArray.push(new SetCode("OK", "Oklahoma"));
StateArray.push(new SetCode("OR", "Oregon"));
StateArray.push(new SetCode("PA", "Pennsylvania"));
StateArray.push(new SetCode("RI", "Rhode Island"));
StateArray.push(new SetCode("SC", "South Carolina"));
StateArray.push(new SetCode("SD", "South Dakota"));
StateArray.push(new SetCode("TN", "Tennessee"));
StateArray.push(new SetCode("TX", "Texas"));
StateArray.push(new SetCode("UT", "Utah"));
StateArray.push(new SetCode("VA", "Virginia"));
StateArray.push(new SetCode("VT", "Vermont"));
StateArray.push(new SetCode("WA", "Washington"));
StateArray.push(new SetCode("WV", "West Virginia"));
StateArray.push(new SetCode("WI", "Wisconsin"));
StateArray.push(new SetCode("WY", "Wyoming"));
StateArray.push(new SetCode("AP", "US Other : US Armed Forces: Pacific"));
StateArray.push(new SetCode("AE", "US Other : US Armed Forces: Europe"));
StateArray.push(new SetCode("AA", "US Other : US Armed Forces: America"));
StateArray.push(new SetCode("AS", "US Other : American Samoa"));
StateArray.push(new SetCode("FM", "US Other : Federated States of Micronesia"));
StateArray.push(new SetCode("GU", "US Other : Guam"));
StateArray.push(new SetCode("MH", "US Other : Marshall Islands"));
StateArray.push(new SetCode("MP", "US Other : North Mariana Islands"));
StateArray.push(new SetCode("PR", "US Other : Puerto Rico"));
StateArray.push(new SetCode("VI", "US Other : Virgin Islands"));
StateArray.push(new SetCode("AB", "Canada : Alberta"));
StateArray.push(new SetCode("BC", "Canada : British Columbia"));
StateArray.push(new SetCode("MB", "Canada : Manitoba"));
StateArray.push(new SetCode("NB", "Canada : New Brunswick"));
StateArray.push(new SetCode("NF", "Canada : Newfoundland"));
StateArray.push(new SetCode("NT", "Canada : Northwest Territories"));
StateArray.push(new SetCode("NS", "Canada : Nova Scotia"));
StateArray.push(new SetCode("ON", "Canada : Ontario"));
StateArray.push(new SetCode("PE", "Canada : Prince Edward Island"));
StateArray.push(new SetCode("QC", "Canada : Quebec"));
StateArray.push(new SetCode("SK", "Canada : Saskatchewan"));
StateArray.push(new SetCode("YT", "Canada : Yukon Territory"));
StateArray.push(new SetCode("Z0", "Mexico : Aguacalientes"));
StateArray.push(new SetCode("Z1", "Mexico : Baja California"));
StateArray.push(new SetCode("Z2", "Mexico : Baja California Sur"));
StateArray.push(new SetCode("Z3", "Mexico : Campeche"));
StateArray.push(new SetCode("Z4", "Mexico : Coahuila de Zaragoza"));
StateArray.push(new SetCode("Z5", "Mexico : Colima"));
StateArray.push(new SetCode("Z6", "Mexico : Chiapas"));
StateArray.push(new SetCode("Z7", "Mexico : Chihuahua"));
StateArray.push(new SetCode("Z8", "Mexico : Distrito Federal"));
StateArray.push(new SetCode("Z9", "Mexico : Durango"));
StateArray.push(new SetCode("ZA", "Mexico : Guanajuato"));
StateArray.push(new SetCode("ZB", "Mexico : Guerrero"));
StateArray.push(new SetCode("ZC", "Mexico : Hidalgo"));
StateArray.push(new SetCode("ZD", "Mexico : Jalisco"));
StateArray.push(new SetCode("ZE", "Mexico : Mexico"));
StateArray.push(new SetCode("ZF", "Mexico : Michoacan de Ocampo"));
StateArray.push(new SetCode("ZG", "Mexico : Morelos"));
StateArray.push(new SetCode("ZH", "Mexico : Nayarit"));
StateArray.push(new SetCode("ZI", "Mexico : Nuevo Leo"));
StateArray.push(new SetCode("ZJ", "Mexico : Oaxaca"));
StateArray.push(new SetCode("ZK", "Mexico : Puebla"));
StateArray.push(new SetCode("ZL", "Mexico : Queretaro Artega"));
StateArray.push(new SetCode("ZM", "Mexico : Quintana Roo"));
StateArray.push(new SetCode("ZN", "Mexico : San Luis Potosi"));
StateArray.push(new SetCode("ZO", "Mexico : Sinaloa"));
StateArray.push(new SetCode("ZP", "Mexico : Sonora"));
StateArray.push(new SetCode("ZQ", "Mexico : Tabasco"));
StateArray.push(new SetCode("ZR", "Mexico : Tamaulipas"));
StateArray.push(new SetCode("ZS", "Mexico : Tlaxcala"));
StateArray.push(new SetCode("ZT", "Mexico : Veracruz"));
StateArray.push(new SetCode("ZU", "Mexico : Yucatan"));
StateArray.push(new SetCode("ZV", "Mexico : Zaxatecas"));


var MonthArray = new Array();
MonthArray.push(new SetCode("00", "(Make Selection)"));
MonthArray.push(new SetCode("01", "January"));
MonthArray.push(new SetCode("02", "Februrary"));
MonthArray.push(new SetCode("03", "March"));
MonthArray.push(new SetCode("04", "April"));
MonthArray.push(new SetCode("05", "May"));
MonthArray.push(new SetCode("06", "June"));
MonthArray.push(new SetCode("07", "July"));
MonthArray.push(new SetCode("08", "August"));
MonthArray.push(new SetCode("09", "September"));
MonthArray.push(new SetCode("10", "October"));
MonthArray.push(new SetCode("11", "November"));
MonthArray.push(new SetCode("12", "December"));

function LoadCodes(ComboList, CodeArray)
{
   for (i=0; i < CodeArray.length; i++)
   {
		ComboList.options[i] = new Option(CodeArray[i].Description);
		ComboList.options[i].value = CodeArray[i].Code;
   }
   ComboList.options[0].selected = true;
}

function LoadYears(ComboList)
{
   ComboList.options[0] = new Option("YYYY");
   var j = 1;
   
   var date = new Date();
   var currentYear = date.getFullYear();
   for (i=currentYear; i >= 1920; i--)
   {
		ComboList.options[j] = new Option(i);
		j++;
   }
   date = null;
   currentYear = null;
   j = null;
}
function LoadDays(ComboList)
{
   for (i=1; i <= 31; i++)
   {
		ComboList.options[i - 1] = new Option(i);
   }
}

function LoadBody()
{
	LoadCodes(document.FrontPage_Form1.STATE, StateArray);

	LoadDays(document.FrontPage_Form1.AVAIL_START_DAY);
	LoadCodes(document.FrontPage_Form1.AVAIL_START_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.AVAIL_START_YEAR);
	
//	LoadCodes(document.FrontPage_Form1.CONVICTION_STATE, StateArray);
//	LoadCodes(document.FrontPage_Form1.CONVICTION_DATE_MONTH, MonthArray);
//	LoadYears(document.FrontPage_Form1.CONVICTION_DATE_YEAR);
	
	LoadCodes(document.FrontPage_Form1.EDUC1_STATE, StateArray);
	LoadCodes(document.FrontPage_Form1.EDUC1_START_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.EDUC1_START_YEAR);
	LoadCodes(document.FrontPage_Form1.EDUC1_END_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.EDUC1_END_YEAR);

	LoadCodes(document.FrontPage_Form1.PAST1_STATE, StateArray);
	LoadCodes(document.FrontPage_Form1.PAST1_START_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.PAST1_START_YEAR);
	LoadCodes(document.FrontPage_Form1.PAST1_END_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.PAST1_END_YEAR);

	LoadCodes(document.FrontPage_Form1.PAST2_STATE, StateArray);
	LoadCodes(document.FrontPage_Form1.PAST2_START_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.PAST2_START_YEAR);
	LoadCodes(document.FrontPage_Form1.PAST2_END_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.PAST2_END_YEAR);

	LoadCodes(document.FrontPage_Form1.PAST3_STATE, StateArray);
	LoadCodes(document.FrontPage_Form1.PAST3_START_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.PAST3_START_YEAR);
	LoadCodes(document.FrontPage_Form1.PAST3_END_MONTH, MonthArray);
	LoadYears(document.FrontPage_Form1.PAST3_END_YEAR);
	
	delete LoadCodes;
	delete LoadDays;
	delete LoadYears;
	delete LoadBody;
}

function FrontPage_Form1_Validator(theForm)
{
	var requiredFields = new Array();
	requiredFields[0] = theForm.FIRST_NAME;
	requiredFields[1] = theForm.LAST_NAME;
	requiredFields[2] = theForm.HOME_PHONE_AREA;
	requiredFields[3] = theForm.HOME_PHONE_PREFIX;
	requiredFields[4] = theForm.HOME_PHONE_SUBSCRIBER;
	requiredFields[5] = theForm.SIGNATURE_INITIALS;
	var allValid = true;
	var validGroups = true;
	var checkStr;
	var errorMessage;
	
	for (var f = 0; f < requiredFields.length; f++)
	{
		 checkStr = requiredFields[f].value;
	  
		if (checkStr == '')
		{
			requiredFields[f].focus();
			alert('Please enter data in this field');
			allValid = false;
			break;
		}
		else
		{
			var charCode;
			for (var i = 0; i < checkStr.length; i++)
			{
				charCode = checkStr.charCodeAt(i);
				switch (requiredFields[f].id)
				{
					case "FIRST_NAME":
						if (!(charCode >= 65 && charCode <= 90) && !(charCode >= 97 && charCode <= 122) && charCode != 45)
						{
							requiredFields[f].focus();
							alert('Please only enter characters in the first name field');
							allValid = false;
						}
						break;
						
					case "LAST_NAME":
						if (!(charCode >= 65 && charCode <= 90) && !(charCode >= 97 && charCode <= 122) && charCode != 45)
						{
							requiredFields[f].focus();
							alert('Please only enter characters in the last name field');
							allValid = false;
						}
						break;
						
					case "SIGNATURE_INITIALS"	:
						if (!(charCode >= 65 && charCode <= 90) && !(charCode >= 97 && charCode <= 122))
						{
							requiredFields[f].focus();
							alert('Please only enter characters in the initials field');
							allValid = false;
						}
						break;
						
					default:
						if (!(charCode >= 48 && charCode <= 57))
						{
							requiredFields[f].focus();
							alert('Please only enter numbers in the phone fields');
							allValid = false;
						}
						break;
				}
				if (!allValid)
				{
					break;
				}
			}
		}
		if (!allValid)
		{
			break;
		}
	}
	return allValid;
}

