
//function LimitAttach(form, file) {
//    extArray = new Array(".doc", ".txt", ".pdf");
//    allowSubmit = false;
//    if (!file) return;
//    while (file.indexOf("\\") != -1)
// 	   file = file.slice(file.indexOf("\\") + 1);
//    	ext = file.slice(file.indexOf(".")).toLowerCase();
//    for (var i = 0; i < extArray.length; i++) {
//    	if (extArray[i] == ext) { allowSubmit = true; break; }
//    }
//    if (allowSubmit) return true;
//    else
//		alert("Please only upload files that end in types:  "
//		+ (extArray.join("  ")) + "\nPlease select a new "
//		+ "file to upload and submit again.");
//    return false;
//}
//function GetOnlyFileName(file) {
//	var arrFile = new Array;
//	arrFile = file.split("\\");
//	var x = arrFile.length;
//	var filename = arrFile[x-1];
	
//	if (filename.indexOf(" ") > 0)
//	{
//		alert('Please make sure there are no spaces in the file name.');
//		return false;
//	}else{
//		return true;
//	}
//}
function validate(theForm) {
			
	if (theForm.firstname.value == "")
	{
		alert("Please enter your first name.");
		theForm.firstname.focus();
		return;
	}
	if (theForm.lastname.value == "")
	{
		alert("Please enter your last name.");
		theForm.lastname.focus();
		return;
	}
	if (theForm.street.value == "")
	{
		alert("Please enter your street address.");
		theForm.street.focus();
		return;
	}
	if (theForm.city.value == "")
	{
		alert("Please enter your city.");
		theForm.city.focus();
		return;
	}
	if (theForm.state.value == "")
	{
		alert("Please enter your state.");
		theForm.state.focus();
		return;
	}
	if (theForm.zip.value == "")
	{
		alert("Please enter your zip code.");
		theForm.zip.focus();
		return;
	}

	if (theForm.email.value == "")
	{
		alert("Please enter your e-mail address.");
		theForm.email.focus();
		return;
	}
	
	
	else
	{   
    // there must be >= 1 character before @, so we
    // start looking at character position 1 
    // (i.e. second character)
    var i = 1;
    var sLength = theForm.email.value.length;

    // look for @
    while ((i < sLength) && (theForm.email.value.charAt(i) != "@"))
    { i++
    }

    if ((i >= sLength) || (theForm.email.value.charAt(i) != "@"))
	{
	 alert("Please enter a valid e-mail address.");
	 theForm.email.focus();
	 return false;
    	}
	else i += 2;

    // look for .
    while ((i < sLength) && (theForm.email.value.charAt(i) != "."))
    { i++
    }

    // there must be at least one character after the .
    if ((i >= sLength - 1) || (theForm.email.value.charAt(i) != "."))
	{
	      alert("Please enter a valid e-mail address.");
		theForm.email.focus();
		return false;
	}
}

	
	
	
	if (theForm.WorkExpYrs.value.length > 0)
	{
		if (isNaN(parseFloat(theForm.WorkExpYrs.value))) 
		{
		alert("Please enter a numeric value for Years of Work Experience.");
		theForm.WorkExpYrs.focus();
		return;
		}
	}
	
	
	

	
	if (theForm.StartMonth.value == "Month")
	{
		alert("Please enter the month you can begin work.");
		theForm.StartMonth.focus();
		return;
	}
	if (theForm.StartDay.value == "Day")
	{
		alert("Please enter the day you can begin work.");
		theForm.StartDay.focus();
		return;
	}

	if (theForm.ideology.selectedIndex == 0)
	{
		alert('Please select your ideology.');
		theForm.ideology.focus();
		return;
	}
	
	
	
		
		if (theForm.answer1.selectedIndex == 0){
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer1.focus();
			return false;
		}
					
		if (theForm.answer2.selectedIndex == 0) {
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer2.focus();
			return false;
		}
					
		if (theForm.answer3.selectedIndex == 0)  {
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer3.focus();
			return false;
		}
					
		if (theForm.answer4.selectedIndex == 0)  {
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer4.focus();
			return false;
		}
					
		if (theForm.answer5.selectedIndex == 0)  {
			alert('Please answer question 5.');
			theForm.answer5.focus();
			return false;
		}
					
		if (theForm.answer6.selectedIndex == 0)  {
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer6.focus();
			return false;
		}
					
		if (theForm.answer7.selectedIndex == 0)  {
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer7.focus();
			return false;
		}
					
		if (theForm.answer8.selectedIndex == 0)  {
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer8.focus();
			return false;
		}
					
		if (theForm.answer9.selectedIndex == 0)  {
			alert('Please answer all questions in the issues questionnaire.');
			theForm.answer9.focus();
			return false;
		}
		
	
	
	
	
	
	
	
	
	//if (theForm.ResumeFile.value == "")
	//{
	//	alert('Please upload your resume in Word or .txt format.');
	//	theForm.ResumeFile.focus();
	//	return;
	//}else{
	//	theForm.ResFileName.value = theForm.ResumeFile.value;
	//}
	
	//var sFileName = theForm.ResumeFile.value
	
	//if (LimitAttach(theForm, sFileName) == false)
	//{
		//alert('Please upload your resume in Word or .txt format.');
	//	theForm.ResumeFile.focus();
	//	return;
	//}
	
	//if (GetOnlyFileName(sFileName) == false)
	//{
		//alert('Please upload your resume in Word or .txt format.');
	//	theForm.ResumeFile.focus();
	//	return;
	//}
	
	//if ( (sFileName.indexOf("'") > 0) )
	//{
	//	alert('Please make sure there are no apostrophes in the file name.');
	//	theForm.ResumeFile.focus();
	//	return;
	//}

	theForm.submit();
}

