/*
 * process the comment form
 */
jQuery(document).ready(function() {
    $("#message").hide();
    $('#frmComment').submit(function() {

        var action = $(this).attr('action');

        $("#message").slideUp(750, function() {

            $("#message").hide();

            $("#submit")
            .after('<img src="images/loading.gif" class="loader" />')
            .attr('disabled', 'disabled');

            /*
             * these are the fields posted to the processor
             * they must match up with whatever fields are in the form
             */
            $.post(action, {
                name: $('#name').val(),
                email: $('#email').val(),
                comment: $('#comment').val(),
                website: $('#website').val()
            },
                function(data) {
                    document.getElementById('message').innerHTML = data;
                    $("#message").slideDown('slow');
                    $('#frmComment img.loader').fadeOut('slow',function(){$(this).remove()});
                    $('#frmComment #submit').attr('disabled','');
                    if(data.match('success') != null) {
                        $('#frmComment').slideUp('slow');
                    } // end if
                } // end function
            ); // end post
        }); // end slideUp

       return false;

    }); // end submit
}); // end ready
