Common javascript for web pages

Here goes some basic Javascripts common web pages scripts to run methods on document ready and window loaded with try catch condition and optional on error message display (for debugging scripts).

These scripts use common methods from Jquery.min library for maximum cross browser functionality.

// Common javascript web pages
var C = {
    T: function (MethodToTryCatch, CustomErrorMessage) {
        if (MethodToTryCatch === undefined)
            return;

        try {
            return MethodToTryCatch();
        }
        catch (e) {
            if (CustomErrorMessage !== undefined)
                alert("Error (" + CustomErrorMessage + ") : " + e);
        }
    },
    R: function (MethodToStartOnDocumentReady, CustomErrorMessage) {
        if (MethodToStartOnDocumentReady === undefined)
            return;

        $(document).ready(function () {
            try {
                return MethodToStartOnDocumentReady();
            }
            catch (e) {
                if (CustomErrorMessage !== undefined)
                    alert("Error (" + CustomErrorMessage + ") : " + e);
            }
        });
    },
    L: function (MethodToStartOnWindowLoad, CustomErrorMessage) {
        if (MethodToStartOnWindowLoad === undefined)
            return;

        $(window).load(function () {
            try {
                return MethodToStartOnWindowLoad();
            }
            catch (e) {
                if (CustomErrorMessage !== undefined)
                    alert("Error (" + CustomErrorMessage + ") : " + e);
            }
        });
    }
};

Usage is very simple :

C.R(function () {
    // Run MyCustomFunction on document ready
    MyCustomFunction();
});

C.L(function () {
    // Run My Custom code on window loaded
    // My Custom code .... 
});