(function ($) {
    $.namespace = function() {
        var a=arguments, o=null, i, j, d;
        for (i=0; i<a.length; i=i+1) {
            d=a[i].split(".");
            o=window;
            for (j=0; j<d.length; j=j+1) {
                o[d[j]]=o[d[j]] || {};
                o=o[d[j]];
            }
        }
        return o;
    };
    $.namespace('registry');

    $.registry = (function () {
        var store = {};
        return {
            set: function (key, val) {
                store[key] = val;
            },
            get : function (key) {
                if ( !store[ key ] ) {
                    return false;
                }
                return store[ key ];
            },
            option : function (key, val) {
                if (!val) {
                    return this.get(key);
                }
                return this.set(key, val);
            }
        };
    })()
})(jQuery);

