function checkEmail(e) 
{
	
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e.value))
	{
		return (true);
	}

	return (false);
}

function checkDate(e) 
{
	var reg = /^\d{2}(\-|\/|\.)\d{4}$/
	
	if (reg.test(e.value))
	{
		return (true);
	}
	
	return (false);
}

function checkGenInfo( genInfo )
{
	err = '';

	if(genInfo.firstname.value == '')
		err += "<li>You must include your first name</li>";

	if(genInfo.lastname.value == '')
		err += "<li>You must include your last name</li>";

	if(genInfo.address.value == '')
		err += "<li>You must include your address</li>";

	if(genInfo.city.value == '')
		err += "<li>You must include your city</li>";

	if(genInfo.state.value == '')
		err += "<li>You must include your state</li>";

	if(genInfo.zip.value == '')
		err += "<li>You must include your zip code</li>";

	if(genInfo.email.value == '') //  || !checkEmail(genInfo.email.value))
		err += "<li>You must include a valid email </li>";
		
	if(genInfo.objective.value == '') //  || !checkEmail(genInfo.email.value))
		err += "<li>You must include your job objective </li>";
		
	if(genInfo.skills.value == '') //  || !checkEmail(genInfo.email.value))
		err += "<li>You must include some relevant skills </li>";
	
	if(err != "")
	{
		errbox = document.getElementById("error");
		errbox.innerHTML = "<li><strong>Please review the following errors:</strong><br / ></li>";
		errbox.innerHTML += err;
		toggle(true, "error");
		document.location.href = "#top";
		return(false)
	}
	
	return (true);
	
}


function checkHighSchool( eduForm )
{
	err = '';
	
	if(eduForm.school_0.value == '')
		err += "<li>You must include the high school's name</li>";

	if(eduForm.location_0.value == '')
		err += "<li>You must include the high school's location</li>";

	if(!checkDate(eduForm.startdate_0) || !checkDate(eduForm.enddate_0))
		err += "<li>You must include the years you attended</li>";

	if(eduForm.degree_0.value == '')
		err += "<li>You must select a degree for high school</li>";
		
	if(eduForm.degree_0.value.indexOf("Other") != -1 && eduForm.other_degree_0.value == '')
		err += "<li>You must provide the alternate degree earned</li>";

	
	if(err != "")
	{
		errbox = document.getElementById("error");
		errbox.innerHTML = "<li><strong>Please review the following errors:</strong><br / ></li>";
		errbox.innerHTML += err;
		toggle(true, "error");
		document.location.href = "#top";
		return(false)
	}
	
	return (true);
	
}

function recentJob( jobForm )
{
	err = '';
	pRes = !/"present"/i;
	
	if(jobForm.company_0.value == '')
		err += "<li>You must include the company's name</li>";

	if(jobForm.comp_city_0.value == '')
		err += "<li>You must include the company's city</li>";
		
	if(jobForm.comp_state_0.value == '')
		err += "<li>You must include the company's state</li>";		

	if(jobForm.position_0.value == '')
		err += "<li>You must enter your title</li>";
	
	if(!checkDate(jobForm.comp_startdate_0) || (!checkDate(jobForm.comp_enddate_0) && pRes.test(jobForm.comp_enddate_0.value)))
		err += "<li>You must include the dates you worked</li>";

	if(jobForm.duties_0.value == '')
		err += "<li>You must enter the duties you performed</li>";
	

	if(err != "")
	{
		errbox = document.getElementById("error");
		errbox.innerHTML = "<li><strong>Please review the following errors:</strong><br / ></li>";
		errbox.innerHTML += err;
		toggle(true, "error");
		document.location.href = "#top";
		return(false)
	}
	
	return (true);
	
}



function toggle(on, div){
	var fileBox = document.getElementById(div);
	if (on) fileBox.style.display = 'block';
	else fileBox.style.display = 'none';
}