Is there anything wrong with encapsulating site wide jquery events and methods in a plugins structure?
<p>I was not happy with the mess of javascript i had for one of my projects so I decided to throw everything in the following plugin structure. Please note I am a C# developer and don't get to do much with jQuery, however it looks like fun.</p>

<pre><code>(function($) {

var methods = {
    init: function(options) {

        if (!cookiesEnabled()) {
            window.location = "http://www.mysite.com/error?msg=nocookies";
        }
        // autosize middle frame if right side has no content
        autosizeframes('#right-side');

        // EVENTS
        $(document).on('submit', '#signin_form', function (event) {
            event.preventDefault();
            postAjaxForm($(this));

        });

        $(document).on('submit', '#register_form', function (event) {
            event.preventDefault();
            postAjaxForm($(this));

        });

        $(document).on('click', '.user-settings', function (e) {
            var menu = $(this).parent().children('#menu');
            if ($(menu).is(':visible')) {
                $(menu).slideUp(500);
            } else {
                $(menu).slideDown(500);
            }
        });
    }

};
// METHODS Commonly Used
var postAjaxForm = function(form) {
    var updateElement = $(form).attr('UpdateElement');

    if (!$(updateElement).length) {
        alert('Unable to find update element');
        return false;
    }

    if ($(form).valid()) {
        $.ajax({
            type: $(form).attr('method'),
            url: $(form).attr('action'),
            data: $(form).serialize(),
            success: function(response) {
                $(updateElement).html(response);
                $.validator.unobtrusive.parse($(updateElement).find('form'));
            },
            error: function(xhr,stats,errorMessage) {

            }
        });
    }
    return true;
};

var checkLength = function(element) {
    if ($.trim(element).length) {
        return true;
    }
    return false;
};
var autosizeframes = function(element) {
    if (!$.trim($(element).len)) {
        $('#middle').width($('#middle').width() + $(element).width());
    }
};

var cookiesEnabled = function() {
    var enabled = (navigator.cookieEnabled) ? true : false;
    if (typeof navigator.enabled == "undefined" &amp;&amp; !enabled) {
        document.cookie = "_test";
        enabled = (document.cookie.indexOf("_test") != -1) ? true : false;
    }
    return enabled;
};

$.fn.site = function(method) {
    if (methods[method]) {
        return methods[method].apply(this,Array.prototype.slice.call(arguments, 1));
    } else if (typeof method == 'object' || !method) {
        return methods.init.apply(this, arguments);
    } else {
        $.error('Method' + method + ' Does not exist');
    }
};
})(jQuery);
</code></pre>

<p>Input appreciated and thanks</p>
