function checkEsForm(){
	if (document.getElementById("es_name").value==""){
    alert("You need to enter your name.");
    document.getElementById("es_name").focus();
    return false; 
  }else if (document.getElementById("es_email").value==""){
    alert("You need to enter an email address.");
    document.getElementById("es_email").focus();
    return false;
  }else if (echeck(document.getElementById("es_email").value)==false){
    alert("The email address entered is not a valid email address.");
    document.getElementById("es_email").focus();
    return false;       
  }
}

function checkVForm(){
	if (document.getElementById("company_name").value==""){
    alert("You need to enter your company name.");
    document.getElementById("company_name").focus();
    return false;
  }else if (document.getElementById("name_first").value==""){
    alert("You need to enter your first name.");
    document.getElementById("name_first").focus();
    return false; 
  }else if (document.getElementById("name_last").value==""){
    alert("You need to enter your surname.");
    document.getElementById("name_last").focus();
    return false;
  }else if (document.getElementById("address_1").value==""){
    alert("You need to enter the first line of your address.");
    document.getElementById("address_1").focus();
    return false;
  }else if (document.getElementById("postcode").value==""){
    alert("You need to enter your postcode.");
    document.getElementById("postcode").focus();
    return false;
  }else if (document.getElementById("telephone").value==""){
    alert("You need to enter your telephone.");
    document.getElementById("telephone").focus();
    return false;
  }else if (document.getElementById("email").value==""){
    alert("You need to enter your email address.");
    document.getElementById("email").focus();
    return false;
  }else if (echeck(document.getElementById("email").value)==false){
    alert("The email address entered is not a valid email address.");
    document.getElementById("email").focus();
    return false;
  }else if (document.getElementById("job_title").value==""){
    alert("You need to enter a job title.");
    document.getElementById("job_title").focus();
    return false;
  }else if (document.getElementById("job_location").value==""){
    alert("You need to enter a job location.");
    document.getElementById("job_location").focus();
    return false;
  }else if (document.getElementById("job_salary_from").value==""){
    alert("You need to enter at least a from salary value.");
    document.getElementById("job_salary_from").focus();
    return false;        
  }
}

function checkForm(){
	if (document.getElementById("name_first").value==""){
    alert("You need to enter your first name.");
    document.getElementById("name_first").focus();
    return false; 
  }else if (document.getElementById("name_last").value==""){
    alert("You need to enter your surname.");
    document.getElementById("name_last").focus();
    return false;
  }else if (document.getElementById("address_1").value==""){
    alert("You need to enter the first line of your address.");
    document.getElementById("address_1").focus();
    return false;
  }else if (document.getElementById("postcode").value==""){
    alert("You need to enter your postcode.");
    document.getElementById("postcode").focus();
    return false;
  }else if (document.getElementById("telephone").value==""){
    alert("You need to enter your telephone.");
    document.getElementById("telephone").focus();
    return false;
  }else if (document.getElementById("email").value==""){
    alert("You need to enter your email address.");
    document.getElementById("email").focus();
    return false;
   }else if (echeck(document.getElementById("email").value)==false){
    alert("The email address entered is not a valid email address.");
    document.getElementById("email").focus();
    return false;       
  }
}

function echeck(str){
  var at="@";
  var dot=".";
  var lat=str.indexOf(at);
  var lstr=str.length;
  var ldot=str.indexOf(dot);

  if (str.indexOf(at)==-1){
    return false;
  }else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
    return false;
  }else if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
    return false;
  }else if (str.indexOf(at,(lat+1))!=-1){
    return false;
  }else if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
    return false;
  }else if (str.indexOf(dot,(lat+2))==-1){
    return false;
  }else if (str.indexOf(" ")!=-1){
    return false;
  }else{
    return true;
  }	
}
