$.ajaxSetup({
    error: function (x, e) {
        if (x.status == 0) {
            alert('You are offline!!\n Please Check Your Network.');
        } else if (x.status == 404) {
            alert('Requested URL not found.');
        } else if (x.status == 500) {
            alert('Internal Server Error. ' + x.responseText);
        } else if (e == 'parsererror') {
            alert('Error.\nParsing JSON Request failed.');
        } else if (e == 'timeout') {
            alert('Request Time out.');
        } else {
            alert('Unknow Error.\n' + x.responseText);
        }
    }
});

var objProfile = {

    addProfile: function () {

        vError = '';

        if ($('#frmProfile input[name=fldFirstName]').val() == '') { vError += '- First Name\n'; }
        if ($('#frmProfile input[name=fldLastName]').val() == '') { vError += '- Last Name\n'; }
        if ($('#frmProfile input[name=fldEmail]').val() == '') { vError += '- E-mail Address\n'; }

        if (vError == '') {
            $.post('/lib/services/profileService.asp', $('#frmProfile').serialize(), function (vResponse) { 
                alert(vResponse)
            });
        } else {
            alert('Please fill in all of the fields and submit your information.');
        }

    }

}
