   
                var fieldIds = 
                        new Array("firstName", "lastName", "phoneNumber1", "phoneNumber2",
                                  "emailAddress", "taxDebtAmount");
                                  
         var fieldLabels = 
                        new Array("First Name", "Last Name", "Phone Number", "Phone Number",
                                  "Email Address", "Tax Debt Amount");
                                  
         var strHref = window.location.href;
         var paramIndex = strHref.indexOf("?");
         
         if (paramIndex > -1) {
                var paramList = strHref.substr(paramIndex).toLowerCase();
                var params = paramList.split("=");
                
                if (params.length > 1 && params[0] == "?status") {
                        if (params[1] == "ok") {
                                alert("Thank you for requesting a quote.\nSomeone will contact you soon.");
                        } else if (params[1] == "invalidDebtAmount") {
                                alert("The debt amount is an invalid number.");
                        } else if (params[1] == "invalidPhoneNumber") {
                                alert("One of the phone numbers is invalid.");
                        } else if (params[1] == "missingPhoneNumber") {
                                alert("Please provide at least one phone number.");
                        } else if (params[1] == "missingName") {
                                alert("Please provide your first and last name.");
                                }                       
                }
                
         }
                                  
                //-----------------------------------------------------------------------------
                //
                //      Method:
                //              isBlank(
                //                      sString                 - string to check
                //              )
                //
                //      Description:
                //              This method returns whether or not the given string is blank.
                //
                //      Return Values:
                //              true: If given string is not a string object or is made up of
                //                      only white space.
                //              false: If given string has non-white space characters.
                //
                //-----------------------------------------------------------------------------
                function isBlank(sString)
                {
                        return((typeof sString != "string") || (sString.search(/\S/) == -1));
                }
                
                //-----------------------------------------------------------------------------
                //
                //      Method:
                //              isValidPhoneNo(
                //                      sPhoneNo                        - string to check
                //              )
                //
                //      Description:
                //              This method returns whether or not the given string is of a valid
                //              phone number.
                //
                //              This method recognizes the following phone number formats:
                //
                //                      aaapppssss
                //                      (aaa) ppp-ssss
                //                      (aaa) ppp.ssss
                //                      (aaa) ppp ssss
                //                      aaa-ppp-ssss
                //                      aaa ppp-ssss
                //                      aaa.ppp.ssss
                //                      aaa ppp.ssss
                //                      aaa ppp ssss
                //
                //              where
                //                      aaa is a three digit area code
                //                      ppp is a three digit prefix
                //                      ssss is a four digit suffix
                //
                //              White space may appear around the "(", "-", and "." sparator
                //              characters and around the aaa, ppp, and ssss segments.
                //
                //      Return Values:
                //              true: If given string is in a valid phone number format.
                //              false: If given string is not in a valid phone number format.
                //
                //-----------------------------------------------------------------------------
                function isValidPhoneNo(sPhoneNo)
                {
                        // 1112223333
                        var oRegExp1 = /^\s*\d{10}\s*$/;
                
                        // (111) 222-3333 or (111) 222.3333
                        var oRegExp2 = /^\s*\(\s*\d{3}\s*\)\s*\d{3}\s*[\s\-\.]\s*\d{4}\s*$/;
                
                        // 111-222-3333 or 111 222-3333
                        var oRegExp3 = /^\s*\d{3}\s*[\s\-]\s*\d{3}\s*-\s*\d{4}\s*$/;
                
                        // 111.222.3333 or 111 222.3333
                        var oRegExp4 = /^\s*\d{3}\s*[\s\.]\s*\d{3}\s*\.\s*\d{4}\s*$/;
                
                        // 111 222 3333 or 1112223333
                        var oRegExp5 = /^\s*\d{3}\s*\d{3}\s*\d{4}\s*$/;
                
                        return oRegExp1.test(sPhoneNo) ||
                                oRegExp2.test(sPhoneNo) || oRegExp3.test(sPhoneNo) ||
                                oRegExp4.test(sPhoneNo) || oRegExp5.test(sPhoneNo);
                }
                
                //-----------------------------------------------------------------------------
                //
                //      Method:
                //              isValidEMail(
                //                      sEMail                  - string to check
                //              )
                //
                //      Description:
                //              This method returns whether or not the given string is of a valid
                //              e-mail address.
                //
                //              This method recognizes the following e-mail address format:
                //
                //                      addressee@groupname.orgname
                //
                //              where groupname.orgname is the hostname and
                //
                //                      addressee is made up of alphas, digits, and/or the following
                //                      "safe" and "extra" characters $-.&+!*"'().
                //
                //              White space may appear around the e-mail address.
                //
                //      Return Values:
                //              true: If given string is in a valid e-mail format.
                //              false: If given string is not in a valid e-mail format.
                //
                //-----------------------------------------------------------------------------
                function isValidEMail(sEMail)
                {
                        var oRegExp = /^\s*[\w$\-\.&+!*"'()]+@[\w$\-\.&+!*"'()]+\.[\w$\-\.&+!*"'()]+\s*$/;
                        return oRegExp.test(sEMail);
                }

                // Validates the data in the form and if it is valid, submits the form.
                function validate() {
                
                        var firstName = document.getElementById("firstName");
                        var lastName = document.getElementById("lastName");
                        var phoneNumber1 = document.getElementById("phoneNumber1");
                        var phoneNumber2 = document.getElementById("phoneNumber2");
                        
                        if (isBlank(firstName.value)) {
                                alert("Please fill in your first name.");
                                return;
                        }

                        if (isBlank(lastName.value)) {
                                alert("Please fill in your last name.");
                                return;
                        }
                        
                        if (isBlank(phoneNumber1.value) && isBlank(phoneNumber2.value)) {
                                alert("Please provide at least one phone number.");
                                return;
                        }
                        
                        if (!isBlank(phoneNumber1.value) && !isValidPhoneNo(phoneNumber1.value)) {
                                alert("Phone number 1 is not a valid phone number.");
                                return;
                        }
                        
                        if (!isBlank(phoneNumber2.value) && !isValidPhoneNo(phoneNumber2.value)) {
                                alert("Phone number 2 is not a valid phone number.");
                                return;
                        }
                        
                        // Put the URL of this form into the hidden input field.
                        var location = new String(document.location);
                        var lastIndex = location.lastIndexOf('/');
                        var path = location.substring(0, lastIndex);
                        
                        var errorPage = document.getElementById("errorPage");
                        errorPage.value = path + "/quoteRequest.html";
                        
                        var successPage = document.getElementById("successPage");
                        successPage.value = path + "/thanks.html";
                        
                        var form = document.getElementById("quoteRequestForm");
                        form.submit();
                        
                }
                
  