var objLeadForm = {

    showForm: function() {
        strURL = 'callmethod=showForm'
        PassAjaxResponseToFunctionUsingPost('/lib/ajax/leadform_ajax.asp', strURL, 'objLeadForm.showForm_return', 'null');
        return true;
    },

    showForm_return: function(str_response) {
        arr_response = str_response.split('||');
        if (arr_response[0] == '1') {
            document.getElementById('divLeadForm').innerHTML = arr_response[1];
        } else {
            alert(arr_response[1]);
        }
        return true;
    },
    
    submitForm: function() {
        vError = '';
        if (document.frmLead.fldFirstName.value == '') { vError = vError + '- Missing First Name\n'; }
        if (document.frmLead.fldLastName.value == '') { vError = vError + '- Missing Last Name\n'; }
        if (document.frmLead.fldEmail.value == '') { vError = vError + '- Missing E-mail Address\n'; }
        if (document.frmLead.fldPhone.value == '') { vError = vError + '- Missing Phone Number\n'; }
        if (vError == '') {
            strURL = 'callmethod=submitForm'
            strURL = strURL + '&fldfirstname=' + encodeURIComponent(document.frmLead.fldFirstName.value);
            strURL = strURL + '&fldlastname=' + encodeURIComponent(document.frmLead.fldLastName.value);
            strURL = strURL + '&fldemail=' + encodeURIComponent(document.frmLead.fldEmail.value);
            strURL = strURL + '&fldphone=' + encodeURIComponent(document.frmLead.fldPhone.value);
            strURL = strURL + '&fldshoottype=' + encodeURIComponent(document.frmLead.fldShootType.value);
            strURL = strURL + '&fldtimeframe=' + encodeURIComponent(document.frmLead.fldTimeframe.value);
            PassAjaxResponseToFunctionUsingPost('/lib/ajax/leadform_ajax.asp', strURL, 'objLeadForm.submitForm_return', 'null');
        } else {
            alert('Please correct the following errors in your submission:\n\n'+vError);
        }
        return true;
    },

    submitForm_return: function(str_response) {
        arr_response = str_response.split('||');
        if (arr_response[0] == '1') {
            document.getElementById('divLeadForm').innerHTML = arr_response[1];
        } else {
            alert(arr_response[1]);
        }
        return true;
    },
    
}

function createEL(vUser) {
    document.write('<a href="mailto:'+vUser+'@inspyre.com">'+vUser+'@inspyre.com<\/a>');
}
