function validateFormOnSubmit(theForm) {
var reason = "";

  reason += validateauthor(theForm.author);
  reason += validatemonth_of_stay(theForm.month_of_stay);
  reason += validateyear_of_stay(theForm.year_of_stay);
  reason += validateproperty(theForm.property);

if (reason != "") {
    alert("Some fields need correction:\n" + reason);
    return false;
  }

  return true;
}

function validateauthor(fld) {
    var error = "";
 
    if (fld.value.length == 0) {
        fld.style.background = 'yellow'; 
        error = "Your Name is required.\n"
    } 

    return error;  
}

function validatemonth_of_stay(fld) {
    var error = "";
 
    if (fld.value == "month") {
        fld.style.background = 'yellow'; 
        error = "Month of Stay is required.\n"
    } 

    return error;  
}

function validateyear_of_stay(fld) {
    var error = "";
 
    if (fld.value == "year") {
        fld.style.background = 'yellow'; 
        error = "Year of Stay is required.\n"
    } 

    return error;  
}

function validateproperty(fld) {
    var error = "";
 
    if (fld.value == "property") {
        fld.style.background = 'yellow'; 
        error = "Property is required.\n"
    } 

    return error;  
}
