﻿var g = this;

$(function() {
    moc = {
        _global: g
        , copy: function(d, c, b, e) {
            for (var a in c)
                if (b || typeof d[a] === 'undefined')
                d[a] = e ? e(c[a]) : c[a];
            return d;
        }
        , create: function(c, h) {
            var e = window.moc, d = c ? c.split('.') : [], a = d.length;
            for (var b = 0; b < a; b++) {
                var g = d[b];
                var f = e[g];
                if (!f) {
                    f = (h && b + 1 == a) ? h : {};
                    e[g] = f;
                }
                e = f;
            }
            return e;
        }
        , provide: function(c, b, a) {
            return moc.copy(typeof c == 'string' ? moc.create(c) : c, b, a);
        }
    };
});