function validateEmpty(fld) {
    var error = "";
	if (fld.value.length == 0) {
        fld.style.background = 'Yellow'; 
        error = "The required field marked in yellow has not been filled in.\n"
    } else {
        fld.style.background = 'White';
    }
return error;
}

function validateFormOnSubmit(i) {
var reason = "";
  reason = validateEmpty(document.form1.fname);
  reason = validateEmpty(document.form1.addr);
  reason = validateEmpty(document.form1.city);
  reason = validateEmpty(document.form1.state);
  reason = validateEmpty(document.form1.country);
  reason = validateEmpty(document.form1.email);
  reason = validateEmpty(document.form1.phone);
  reason = validateEmpty(document.form1.desc);
  reason = validateEmpty(document.form1.asales);
  reason = validateEmpty(document.form1.captcha_code);
 /* reason = validateEmpty(document.form1.captchacode);*/
      
  if (reason != "") {
    alert("Some fields need correction:\n" + reason);
  return false;
  }
document.form1.mode.value = i ; 
document.form1.submit();
}	
