/*
<script language="JavaScript">
if (location.protocol != 'https:'){
     window.location= 'https://' + location.host + location.pathname + location.search
}
</script>
*/

var states = new Array();

	states[0] = new Array('N/A', 'N/A');

	states[1] = new Array(
	'PL','Please Select',
	'AL','Alabama',
	'AK','Alaska',
	'AZ','Arizona',
	'AR','Arkansas',
	'CA','California',
	'CO','Colorado',
	'CT','Connecticut',
	'DE','Delaware',
	'DC','District of Columbia',
	'FL','Florida',
	'GA','Georgia',
	'HI','Hawaii',
	'ID','Idaho',
	'IL','Illinois',
	'IN','Indiana',
	'IA','Iowa',
	'KS','Kansas',
	'KY','Kentucky',
	'LA','Louisiana',
	'ME','Maine',
	'MD','Maryland',
	'MA','Massachusetts',
	'MI','Michigan',
	'MN','Minnesota',
	'MS','Mississippi',
	'MO','Missouri',
	'MT','Montana',
	'NE','Nebraska',
	'NV','Nevada',
	'NH','New Hampshire',
	'NJ','New Jersey',
	'NM','New Mexico',
	'NY','New York',
	'NC','North Carolina',
	'ND','North Dakota',
	'OH','Ohio',
	'OK','Oklahoma',
	'OR','Oregon',
	'PA','Pennsylvania',
	'PR','Puerto Rico',
	'RI','Rhode Island',
	'SC','South Carolina',
	'SD','South Dakota',
	'TN','Tennessee',
	'TX','Texas',
	'UT','Utah',
	'VT','Vermont',
	'VA','Virginia',
    'VI','U.S. Virgin Islands',
	'WA','Washington',
	'WV','West Virginia',
	'WI','Wisconsin',
	'WY','Wyoming'
    );

    states[2] = new Array(
	'PL','Please Select',
    'AB','Alberta',
	'BC','British Columbia',
	'MB','Manitoba',
	'NB','New Brunswick',
	'NF','Newfoundland',
	'NWT','Northwest Territories',
	'NS','Nova Scotia',
	'NU','Nunavut',
	'ON','Ontario',
	'PE','Prince Edward Island',
	'PQ','Quebec',
	'SK','Saskatchewan',
	'YT','Yukon Territory'
	);

	function populate()
	{
		countryId=0;
		document.harborside_ri.State.disabled=true;
		if(document.harborside_ri.Country.value=='United States of America'){
			document.harborside_ri.State.disabled=false;
			countryId=1;
		}

		if(document.harborside_ri.Country.value=='Canada'){
			document.harborside_ri.State.disabled=false;
			countryId=2;
		}

		var list = states[countryId];
		var box2 = document.harborside_ri.State;
		box2.options.length = 0;
		for(i=0;i<list.length;i+=2)
		{
			box2.options[i/2] = new Option(list[i+1],list[i]);
		}
	};
	function showDestField()
    {
        var choice = document.harborside_ri.ReferralPoint.options[document.harborside_ri.ReferralPoint.selectedIndex].value;
 
        if(choice == "Other")
        {
            document.all['otherDest-div'].style.display = "";           
     
        }
  else
   {
    document.all['otherDest-div'].style.display = "none";           
      
   }
    };	
	function checkForm(){
		//function that checks the validity of the form
		//checks for empty required fields and if the emails equal
		
		var bolOK = true;
		
		if(bolOK)
		{
			if(document.harborside_ri.interestedIn[document.harborside_ri.interestedIn.selectedIndex].value == 'PL')
			{
				bolOK=false;
				alert("Please select an interest.");
				eval("document.harborside_ri.interestedIn.focus();");
			}

		}
		
		if(bolOK)
		{
			bolOK = notEmpty('custom','harborside_ri','firstName','A first name is required.','lastName','A last name is required.','State','A state is required.','Country','A country is required.');
		
		}
		if(bolOK)
		{
			if(document.harborside_ri.State[document.harborside_ri.State.selectedIndex].value == 'PL')
			{
				bolOK=false;
				alert("Please choose a state.");
				eval("document.harborside_ri.State.focus();");
			}

		}
		if(bolOK)
		{
			bolOK=notEmpty('custom','harborside_ri','PostalCode','Please enter a postal code.','Number','A contact phone is required.');
		}
		if(bolOK)
		{
			bolOK = checkEmailNoAlerts(document.harborside_ri.Email.value);
			if(!bolOK)
			{
				alert('An email address is required.');
				eval("document.harborside_ri.Email.focus();");
			}
		}
		return bolOK;
	};
	
