function selectCountry()
		{
			var StateSelected = document.myForm.State.options[document.myForm.State.selectedIndex].value;
			var CountryToSelect = "";

			switch(StateSelected)
			{
				case 'ME':
				case 'VT':
				case 'NH':
				case 'MA':
				case 'NY':
				case 'NH':
				case 'MA':
				case 'NY':
				case 'NJ':
				case 'WV':
				case 'KY':
				case 'TN':
				case 'NC':
				case 'SC':
				case 'GA':
				case 'FL':
				case 'AL':
				case 'MS':
				case 'LA':
				case 'AR':
				case 'OK':
				case 'CO':
				case 'TX':
				case 'ON':
				case 'QC':
				case 'NS':
				case 'PE':
				case 'NF':
				case 'CT':
				case 'RI':
				case 'NB':
				case 'SN':
				case 'LN':
				case 'SS':
				case 'JB':
				case 'VA':
				case 'MD':
				case 'PA':
				case 'DC':
				case 'OH':
				case 'IN':
				case 'MI':
				case 'IL':
				case 'WI':
				case 'IA':
				case 'MO':
				case 'MN':
				case 'KS':
				case 'NE':
				case 'SD':
				case 'ND':
				case 'MT':
				case 'WY':
				case 'NM':
				case 'AZ':
				case 'UT':
				case 'NV':
				case 'CA':
				case 'OR':
				case 'ID':
				case 'WA':
				case 'HI':
				case 'AK':
				case 'BC':
				case 'AB':
				case 'SK':
				case 'MB':
				case 'DE':
					CountryToSelect = "United States of America;1;3";
					break;

				case 'Alberta':
				case 'British Columbia':
				case 'Manitoba':
				case 'New Brunswick':
				case 'Newfoundland':
				case 'Northwest Territories':
				case 'Nova Scotia':
				case 'Nunavut': 
				case 'Ontario':
				case 'Prince Edward Island':  
				case 'Quebec':  
				case 'Saskatchewan':
				case 'Yukon':
					CountryToSelect = "Canada;1;3";
					break;
			}
			
			if(CountryToSelect == "")
			{
				//Reset the form so it selects the default option.
				document.myForm.Country.selectedIndex = 0;
			}
			else
			{
				//Iterate through each item to find a match.
				for (var i = 0 ; i < document.myForm.Country.length; i++)
				{ 
					if (document.myForm.Country.options[i].value == CountryToSelect)
					{ 
						document.myForm.Country.selectedIndex = i; 
						return; 
					} 
			   } 
			}
		}

function validateForm() {
var NumbersOnly = /[0-9]/; // allow only numbers


var AddValidationRoadshows = document.getElementById('date_loc'); // see if the select box exists and if so add validation
if (AddValidationRoadshows != null)
{
	if (document.myForm.date_loc.value == "00"){alert("Please choose date/location");return false;}
}
	else
{
	//alert('null');
}



if (document.myForm.FirstName.value == ""){alert("Please enter your First Name");document.myForm.FirstName.focus(); return false;}
if (document.myForm.LastName.value == ""){alert("Please enter your Last Name");document.myForm.LastName.focus(); return false;}
if (document.myForm.Email.value == ""){alert("Please enter your E-mail address");document.myForm.Email.focus(); return false;}
if (document.myForm.Phone.value == ""){alert("Please enter your Phone Number");document.myForm.Phone.focus(); return false;}
if (document.myForm.Organization.value == ""){alert("Please enter your Organizations Name");document.myForm.Organization.focus(); return false;}
if (document.myForm.City.value == ""){alert("Please enter your City");document.myForm.City.focus(); return false;}
if (document.myForm.State.value == "00"){alert("Please select your State or Province");document.myForm.State.focus(); return false;}
if (document.myForm.Country.value == "00"){alert("Please select your Country");document.myForm.Country.focus(); return false;}

if (document.myForm.LeadType.value == "00")
{
 	alert("Please let us know how you heard about Picis."); 
	return false;
}


// see if the select box exists/visible and if so add validation


}

function SetAllSelectBoxes(SelectMe,FormName,FieldName){
var objSelectBoxes = document.forms[FormName].elements[FieldName];
for(i=0; i<objSelectBoxes.length; i++) { 

if (objSelectBoxes.options[i].value == SelectMe) {
   objSelectBoxes.options[i].selected=true
		}
   }

}

function SetAllSelectBoxesII(SelectMe,FormName,FieldName){
var objSelectBoxes = document.forms[FormName].elements[FieldName];
for(i=0; i<objSelectBoxes.length; i++) { 

if ((objSelectBoxes.options[i].value == SelectMe+';0;0') || (objSelectBoxes.options[i].value == SelectMe+';1;0')||(objSelectBoxes.options[i].value == SelectMe+';1;1')||(objSelectBoxes.options[i].value == SelectMe+';1;2')||(objSelectBoxes.options[i].value == SelectMe+';1;3')||(objSelectBoxes.options[i].value == SelectMe+';1;4')||(objSelectBoxes.options[i].value == SelectMe+';1;5')){
   objSelectBoxes.options[i].selected=true
		}
   }

}

function SelectLeadType () {
var LeadTypeSelected = document.myForm.LeadType.value;
	if ((LeadTypeSelected == "SearchEngine")||(LeadTypeSelected == "Tradeshow")||(LeadTypeSelected == "PicisRepresentative")||(LeadTypeSelected == "Other"))
		{
		//alert(LeadTypeSelected);
		showdiv('SpecifyLeadType');
		}
	else
	{hidediv('SpecifyLeadType');
	}
}

function ClearForm() {
document.myForm.SpecifyLeadType.value = "";
}

function hidediv(id) {

	if (document.getElementById) { 
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { 
			document.id.display = 'none';
		}
		else { 
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	
		  
	if (document.getElementById) { 
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { 
			document.id.display = 'block';
		}
		else { 
			document.all.id.style.display = 'block';
		}
	}
}
