/**
 * The Bezurk global namespace
 */
var com = window.com || {};
com.bezurk = window.com.bezurk || {};

/**
 * Returns the namespace specified and creates it if it doesn't exist
 *
 * com.bezurk.namespace('property.package');
 * com.bezurk.namespace('com.bezurk.property.package');
 *
 * Either of the above would create com.bezurk.property, then com.bezurk.property.package
 *
 * @param  {String} ns The name of the namespace
 * @return {Object}    A reference to the namespace object
 */
com.bezurk.namespace = function(ns) {

    if (!ns || !ns.length) {
        return null;
    }

    var levels = ns.split('.');
    var nsobj = com.bezurk;

    // 'com.bezurk' is implied, so it is ignored if it is included
    for (var i=(levels[0] == 'com' && levels.length > 2 && levels[1] == 'bezurk') ? 2 : 0; i<levels.length; ++i) {
        nsobj[levels[i]] = nsobj[levels[i]] || {};
        nsobj = nsobj[levels[i]];
    }

    return nsobj;
};

com.bezurk.namespace('com.bezurk.util');
com.bezurk.namespace('com.bezurk.widget');