function validateFormOnSubmit(theForm) {
var reason = "";

  reason += validateFirstname(theForm.first_name);
  reason += validateLastname(theForm.last_name);
  reason += validateTitle(theForm.job_title);
  reason += validateCompany(theForm.company);
    reason += validateIndustry(theForm.industry);
      reason += validateEmail(theForm.email);
        reason += validatePhone(theForm.phone);
  reason += validateAddress(theForm.address);
  reason += validateCity(theForm.city);
  reason += validateState(theForm.state);
    reason += validateCountry(theForm.country);
  reason += validateZip(theForm.zip);
    reason += validateCaptcha(theForm.__ec_s);
 
      
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }

  return true;
}

function validateFirstname(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'first name' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateLastname(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'last name' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateTitle(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'job title' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateCompany(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'company' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateIndustry(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'industry' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}
function validateEmail(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'email' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validatePhone(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'phone' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateAddress(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'address' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateCity(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'city' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateState(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'state' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateCountry(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'country' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}

function validateZip(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'zip code' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}
function validateCaptcha(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field 'captcha code' has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
    return error;  
}