function checkEmptyCareer(theForm) {
    var why = "";
	why += isEmptyFname(theForm.fname.value);
	why += isEmptyLname(theForm.lname.value);
	why += isEmptyApFor(theForm.applyfor.value);
	why += isEmptyAddress(theForm.address.value);
	why += isEmptyCity(theForm.city.value);
	why += isEmptyState(theForm.state.value);
	why += isEmptyCountry(theForm.country.value);
	why += isEmptyPhone(theForm.phone.value);
	why += isEmptyCellphone(theForm.cellphone.value);
	why += checkemail(theForm.email.value);	
	why += isEmptyExp(theForm.experience.value);
	why += isEmptyResume(theForm.resume.value);
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkEmptyContactInfo(theForm) {
    var why = "";
	why += isEmptyFname(theForm.fname.value);
	why += isEmptyLname(theForm.lname.value);
	why += isEmptyTPhone(theForm.phone.value);
	why += isEmptyTPhone2(theForm.phone2.value);
	why += isEmptyAddress(theForm.address.value);
	why += isEmptyCity(theForm.city.value);
	why += isEmptyState(theForm.state.value);	
	why += checkemail(theForm.email.value);	
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}

function checkEmptyQuote(theForm) {
    var why = "";
	why += isEmptyFname(theForm.fname.value);
	why += isEmptyLname(theForm.lname.value);
	why += isEmptyCompany(theForm.company.value);
	why += isEmptyPhone(theForm.phone.value);
	why += checkemail(theForm.email.value);	
    if (why != "") {
       alert(why);
       return false;
    }
return true;
}


function isEmptyFname(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Firstname is required. \n"
  }
return error;	  
}

function isEmptyLname(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Lastname is required. \n"
  }
return error;	  
}

function isEmptyApFor(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Apply for is required. \n"
  }
return error;	  
}

function isEmptyAddress(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Address is required. \n"
  }
return error;	  
}

function isEmptyCity(strng) {
var error = "";
  if (strng.length == 0) {
     error = "City is required. \n"
  }
return error;	  
}

function isEmptyState(strng) {
var error = "";
  if (strng.length == 0) {
     error = "State is required. \n"
  }
return error;	  
}

function isEmptyCountry(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Country is required. \n"
  }
return error;	  
}

function isEmptyCellphone(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Cellphone number is required. \n"
  }
return error;	  
}

function isEmptyExp(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Years of Experience number is required. \n"
  }
return error;	  
}

function isEmptyResume(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Resume is required. \n"
  }
return error;	  
}

function isEmptyCity(strng) {
var error = "";
  if (strng.length == 0) {
     error = "City is required. \n"
  }
return error;	  
}

function isEmptyTPhone(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Enter area code. \n"
  }
return error;	  
}

function isEmptyTPhone2(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Enter telephone number. \n"
  }
return error;	  
}

function isEmptyCompany(strng) {
var error = "";
  if (strng.length == 0) {
     error = "Company name is required. \n"
  }
return error;	  
}


//check email
function checkemail (strng) {
var error="";
if (strng == "") {
   error = "email address is required.\n";
}

    var emailFilter=/^.+@.+\..{2,3}$/;
    if (!(emailFilter.test(strng))) { 
       error = "Please enter a valid email address.\n";
    }
    else {
//test email for illegal characters
       var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
         if (strng.match(illegalChars)) {
          error = "The email address contains illegal characters.\n";
       }
    }
return error;    
}
// non-empty textbox

function isEmptyPhone(strng) {
	var error = "";
	if (strng == "") {
	   error = "You didn't enter a phone number.\n";
	}
	
	var stripped = strng.replace(/[\(\)\.\-\ ]/g, ''); //strip out acceptable non-numeric characters
		if (isNaN(parseInt(stripped))) {
		   error = "The phone number contains illegal characters.";
	  
		}
		if (!(stripped.length == 10)) {
		error = "Invalid Telephone Number. \n Make sure you included an area code.\n";
		} 
	return error;
}





