/////////////////////////////////////////////////////////////////////
// FILE:  /include/js/CCMailForm.js
// DESC: Client side validation for the email form
// JScript source code
// $Author: Sean Alisea$
// $Revision: 5$
// $Date: 6/8/2007 9:13:02 AM$
/////////////////////////////////////////////////////////////////////

///////////////////////////////////////
// CCMF_ValidateCareEmailForm
// Validates the short or long form checking 
// for a invoice number when needed.
// Params
//        [in]
//            oForm               --  the form object
//            bLongForm           --  True if the long form is to be validated
//            bCheckInvoiceNumber --  True if the invoice # is to be validated
//       [out]
//            Client alerts with a description of the error message
//   [returns]
//            true if the form has no errors or false if it has errors
///////////////////////////////////////
function CCMF_ValidateCareEmailForm( oForm, bLongForm, bCheckInvoiceNumber ) {
    var sErrorMessage = "";
    // invoice number check
    if (bCheckInvoiceNumber == true) {
        if (oForm.txtInvoiceNumber.value == "") {
            sErrorMessage = "Please enter the invoice number that is on your bill.";
            return GEN_FieldError(oForm.txtInvoiceNumber, sErrorMessage);
        }
    }
    // The long and the short of it
    if (bLongForm == true) {
        // name
        if (oForm.txtName.value == "") {
            sErrorMessage = "Please enter your name.";
            return GEN_FieldError(oForm.txtName, sErrorMessage);
        }
        // phoneNumber
        if (GEN_ValidateAC34(oForm) == false) 
        {
            return false;
        }
    }
    // email address
    if (GEN_ValidateEmail(oForm.txtEmailAddress) == false)
    {
        return false;
    }
    // problem
    if (oForm.txtQuestion.value == "") {
        sErrorMessage = "Please enter a question.";
        return GEN_FieldError(oForm.txtQuestion, sErrorMessage);
    }
    return true;
}