jQuery(function ($) {
    $.fn.extend({
        /**
         * Triggers a custom event on an element and returns the event result
         * this is used to get around not being able to ensure callbacks are placed
         * at the end of the chain.
         *
         * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our
         *       own events and placing ourselves at the end of the chain.
         */
        triggerAndReturn: function (name, data) {
            var event = new jQuery.Event(name);
            this.trigger(event, data);

            return event.result !== false;
        },

        /**
         * Handles execution of remote calls firing overridable events along the way
         *
         */
        callRemote: function () {
            var el      = $(this),
                data    = [],
                method  = el.attr('method') || el.attr('data-method') || 'GET',
                url     = el.attr('action') || el.attr('href') || el.attr('data-url');

            if (el.context.tagName.toUpperCase() === 'FORM') {
                data = el.serializeArray();
            }

            // TODO: should let the developer know no url was found
            if (url !== undefined) {
                if (el.triggerAndReturn('ajax:before')) {
                    $.ajax({
                        url: url,
                        data: data,
                        type: method.toUpperCase(),
                        beforeSend: function (xhr) {
                            xhr.setRequestHeader("Accept", "text/javascript");
                            el.trigger('ajax:loading', xhr);
                        },
                        success: function (data, status, xhr) {
                            if (el.triggerAndReturn('ajax:success', [data, status, xhr])) {
                                var contentType = xhr.getResponseHeader('Content-Type');
                                if (contentType && contentType.indexOf('text/javascript') !== false) {
                                    // TODO: cleaner way of doing this without eval script tag?
                                    eval(data);
                                }
                            }
                        },
                        complete: function (xhr) {
                            el.trigger('ajax:complete', xhr);
                        },
                        error: function (xhr, status, error) {
                            el.trigger('ajax:failure', [xhr, status, error]);
                        }
                    });
                }

                el.trigger('ajax:after');
            }
        }
    });

    /**
     *  confirmation handler
     */
    $('a[data-confirm],input[data-confirm]').live('click', function () {
        var el = $(this);
        if (el.triggerAndReturn('confirm')) {
            if (!confirm(el.attr('data-confirm'))) {
                return false;
            }
        }
    });

    /**
     * remote handlers
     */
    $('form[data-remote="true"]').live('submit', function () {
        $(this).callRemote();        
        return false;
    });

    $('a[data-remote="true"],input[data-remote="true"]').live('click', function () {
        $(this).callRemote();        
        return false;
    });
});

@@ -1746,36 +1746,32 @@
                 
-if (
 el.triggerAndRet
@@ -1760,33 +1760,24 @@
   el.trigger
-AndReturn
 ('ajax:succe
@@ -1805,411 +1805,9 @@
 hr%5D)
-) %7B%0A                                var contentType = xhr.getResponseHeader('Content-Type');%0A                                if (contentType && contentType.indexOf('text/javascript') !== false) %7B%0A                                    // TODO: cleaner way of doing this without eval script tag?%0A                                    eval(data);%0A                                %7D%0A                            %7D
+;
 %0A   

revert resonse eval, this is done for us