// Crowne Atlantic Form Validation //
function validate(f){

    var checked = new Array();
    var errors = new Array();

    a = document.getElementsByTagName('input');
    for(i = 0; i < a.length; i++) {
        if(a[i].type == 'checkbox' && a[i].checked==true) {
            checked.push(a[i]);
        }
    }
    if(f.firstName.value == "") {
        errors.push('You forgot to enter your <span class="errorstxt">FIRST NAME</span>.');
        f.firstName.focus();
    }
    if (f.lastName.value == ""){
        errors.push('You forgot to enter your <span class="errorstxt">LAST NAME</span>.');
        f.lastName.focus();
    }
    if(f.email.value == "") {
        errors.push('You forgot to enter your <span class="errorstxt">EMAIL ADDRESS</span>.');
        f.email.focus();
    }
    if(f.phone.value == "") {
        errors.push('You forgot to enter a <span class="errorstxt">PHONE NUMBER</span>.');
        f.phone.focus();
    }
    if(errors.length == 0) {
        return true;
    }
    else {
        document.getElementById("errors").innerHTML = errors.join("<br />")
        return false;
    }
}
