// JavaScript Document

function validate_fname() {
	var msg='';
	if(	!document.jobapp.fname.value)
	   {
  
	   msg=msg + '--Please begin with your first name.---\n';
	   document.jobapp.fname.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}

function validate_lname() {
	var msg='';
	if(	document.jobapp.lname.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide your last name.---\n';
	   document.jobapp.lname.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}

function validate_address() {
	var msg='';
	if(	document.jobapp.address.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide your street address.---\n';
	   document.jobapp.address.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}
function validate_city() {
	var msg='';
	if(	document.jobapp.city.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide your town or city.---\n';
	   document.jobapp.city.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}

function validate_zip() {
	
	var msg='';
	if(!document.jobapp.postalcode1.value.match(/\d{5,7}/ ) ||
		document.jobapp.postalcode1.value.length < 5)
	   {
	   
	   msg=msg + '--Please specify your zip code in 5 numbers only.---\n';
	   document.jobapp.postalcode1.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
		
}
function validate_phone() {
	
	var msg='';
		if (document.jobapp.phonearea.value.length  < 3) msg=msg + 'Phone  area code must have 3 digits..\n';
		if (document.jobapp.phone2.value.length  < 3) msg=msg + 'Phone  exchange code must have 3 digits..\n';
		if (document.jobapp.phone3.value.length  < 4) msg=msg + 'Phone  local code must have 4 digits..\n';	
		if(!document.jobapp.phonearea.value.match(/\d{3,3}/ ) ||
		!document.jobapp.phone2.value.match(/\d{3,3}/ ) ||
		!document.jobapp.phone3.value.match(/\d{4,4}/ )	) msg=msg + 'Please specify your phone number in numbers only.\n';
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 document.jobapp.phonearea.value="";
	 document.jobapp.phone2.value="";
	 document.jobapp.phone3.value="";
	  return false;	
		
}	


function validate_email() {
	var msg='';
	if(	document.jobapp.email.value.length < 1 )
	   {
	   msg=msg + '--Email address is required.---\n';
	   document.jobapp.email.value="";  
	   }
	  if (msg=='')
	  { 
	    return true;
	  }
	  alert(msg);
	  return false;	
}


function validate_emailOLD() {
		var confirmemail = /^.+\@.+\..+$/;	
		var msg='';	
		if (document.jobapp.email.value.length  < 1 ) msg=msg + 'Email address is required.\n';
		else if (!confirmemail.test(document.jobapp.email.value)) msg=msg + 'Email address must be valid.\n';
		if (document.jobapp.email.value!=document.jobapp.confirmemail.value) msg=msg + 'Your email address and Confirmation Email addresses do not match.\n';	
	alert(msg);
		return false;
}

function validate_email_match() {
		var confirmemail = /^.+\@.+\..+$/;	
		var msg='';			
		if (document.jobapp.email.value.length  < 1 ) msg=msg + 'Email address is required.\n';
		else if (!confirmemail.test(document.jobapp.email.value)) msg=msg + 'Email address must be valid.\n';
		if (document.jobapp.email.value!=document.jobapp.confirmemail.value) msg=msg + 'Your email address and Confirmation Email addresses do not match.\n';		
		if (msg=='') return true;
	alert(msg);
		return false;
	
}
















function validate_name() {
	 
	//  alert("validating name ");
	
		var msg='';
		if (document.jobapp.fname.value.length < 1 )msg=msg + 'First name is required.\n';
		if (document.jobapp.lname.value.length < 1 )msg=msg + 'Last name is required.\n';


		if (document.jobapp.address.value.length < 1) msg=msg + 'Address 1 is required.\n';		

		if (document.jobapp.city.value.length < 1) msg=msg + 'City is required.\n';			

		if (document.jobapp.state.value.length < 1) msg=msg + 'State is required.\n';			

		if (document.jobapp.postalcode1.value.length < 5) msg=msg + 'Postal Code is required.\n';	

		if(!document.jobapp.postalcode1.value.match(/\d{5,7}/ ) ) msg=msg + '--Please specify your zip code in numbers only.---\n';
		

		if (document.jobapp.phonearea.value.length  < 3) msg=msg + 'Phone  area code must have 3 digits..\n';
		if (document.jobapp.phone2.value.length  < 3) msg=msg + 'Phone  exchange code must have 3 digits..\n';
		if (document.jobapp.phone3.value.length  < 4) msg=msg + 'Phone  local code must have 4 digits..\n';	
		if(!document.jobapp.phonearea.value.match(/\d{3,3}/ ) ||
		!document.jobapp.phone2.value.match(/\d{3,3}/ ) ||
		!document.jobapp.phone3.value.match(/\d{4,4}/ )	) msg=msg + 'Please specify your phone number in numbers only.\n';
		
		
		if( document.jobapp.cellphonearea2.value != '')
		{
		if (document.jobapp.cellphonearea2.value.length  < 3) msg=msg + 'Cell Phone  area code must have 3 digits..\n';
		if (document.jobapp.cellphone12.value.length  < 3) msg=msg + 'Cell Phone  exchange code must have 3 digits..\n';
		if (document.jobapp.cellphone22.value.length  < 4) msg=msg + 'Cell Phone  local code must have 4 digits..\n';	
		}	
		if (document.jobapp.resume.value.length < 1){
			document.jobapp.resume.focus();
			msg=msg + 'A resume is required.\n';		
		}
				
		if (msg=='') return true;
	alert(msg);
	
//	  alert("end validating name ");	
	
		return false;		
}

function validate_curmgr() {
	var msg='';
	if(	document.jobapp.curmgr.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide your current manager.---\n';
	   document.jobapp.curmgr.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}

function validate_curtitle() {
	var msg='';
	if(	document.jobapp.curtitle.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide your current title.---\n';
	   document.jobapp.curtitle.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}

function validate_yearsemploy() {
	var msg='';
	if(	document.jobapp.yearsemploy.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide years employed by the company.---\n';
	   document.jobapp.yearsemploy.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}

function validate_yearscur() {
	var msg='';
	if(	document.jobapp.yearscur.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide years in current position..---\n';
	   document.jobapp.yearscur.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}


function validate_resume() {
	var msg='';
	if(	document.jobapp.resume.value.length < 1 )
	   {
	   
	   msg=msg + '--Please provide a resume.---\n';
	   document.jobapp.resume.value="";  

	   }
	
	  if (msg=='')
	  { 
	    return true;
	  }
	  
	  alert(msg);
	 
	  return false;	
	
}

function noShowMil(strElement){
//ifchecked veteranstatus5  hide all military
//ifNotChecked show all military
//ifchecked veteranstatus6  hide all military
//ifNotChecked show all military	


if(strElement=="A")
{
	if(document.jobapp.veteranstatus5.checked==1){
		
		showhide("A");
		showhide("B");
		showhide("C");
		showhide("D");
	}
	if(document.jobapp.veteranstatus5.checked==0){
		showhide("A");
		showhide("B");
		showhide("C");
		showhide("D");
	}	
}
if(strElement=="B")
{
	if(document.jobapp.veteranstatus6.checked==1){ //showing
        showhide("NOMIL");
		showhide("A");
		showhide("B");
		showhide("C");
		showhide("D");
	}
	if(document.jobapp.veteranstatus6.checked==0){//hiding
        showhide("NOMIL");
		showhide("A");
		showhide("B");
		showhide("C");
		showhide("D");		
		
	}	
}	
	
}//End noShowMil();


/**
function showhide(id,state){

obj = document.getElementById(id);
if (state=="none") obj.style.display = "state";
if (state=="") obj.style.display = "";
} 
***/



function showhide(id){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
} 
