﻿function checkForm(f) {

    //check first name
    if ( isEmptyOrWhitespace(f.f_fName.value) ) {
        alert("Please provide your First Name in the space provided.");
        f.f_fName.focus();
        return false;
    }
    //check last name
    if (isEmptyOrWhitespace(f.f_lName.value)) {
        alert("Please provide your Last Name in the space provided.");
        f.f_lName.focus();
        return false;
    }
    // check company
    if (isEmptyOrWhitespace(f.f_Company.value)) {
        alert("Please provide your Comapny Name in the space provided.");
        f.f_Company.focus();
        return false;
    }
    // check title
    if (isEmptyOrWhitespace(f.f_Title.value)) {
        alert("Please provide your Title in the space provided.");
        f.f_Title.focus();
        return false;
    }
    // check email
    if (f.f_Email.value == "" || f.f_Email.value == "null" || f.f_Email.value == "NULL") {
        alert("Please provide your E-Mail Address in the space provided.");
        f.f_Email.value = "";
        f.f_Email.focus();
        return false;
    } else if (f.f_Email.value.indexOf("@") == -1 || f.f_Email.value.indexOf(".") == -1) {
        alert("Please provide a valid E-Mail Address in the space provided.");
        f.f_Email.value = "";
        f.f_Email.focus();
        return false;
    }
    // check phone
    if (isEmptyOrWhitespace(f.f_Phone.value)) {
        alert("Please provide your Phone Number in the space provided.");
        f.f_Phone.focus();
        return false;
    }
    // check atCustomer
    if (!isRadioSelected(f.f_atCustomer)) {
        alert("Please indicate if you are a current Autotask Customer.");
        return false;
    }
    // check atUserName if atCustomer is Yes
    if (getCheckedValue(f.f_atCustomer) == "Yes" && isEmptyOrWhitespace(f.f_atUserName.value)) {
        alert("Please provide your Autotask Username in the space provided.");
        f.f_atUserName.focus();
        return false;
    }
    // check taskfire partner status
    if (f.f_partnerStatus.value == "") {
        alert("Please select your Taskfire Partner Status.");
        f.f_partnerStatus.focus();
        return false;
    }
    //return false // debugging only
    return true;
}
