$(function(){
    // Require captcha validation
    $('form[action="/forms/process"]').submit(function(e){
        var that = $(this);
        if (that.find('#recaptcha_widget_div').length !== 0) {
            $.post('/forms/captcha', that.serialize(), function(resp){
                if (resp.valid === false) {
                    $('#recaptcha_widget_div').addClass('error flash');
                    alert('Sorry, the anti-spam text you entered was incorrect.  Pleae try again.');
                } else {
                    that.unbind('submit').trigger('submit');
                }
            }, 'json');
            return false;
        }
    });
});
