
// Create a package for UIB javascript
var UIB = window.UIB || {};

/**
 * Method is stolen from YAHOO.namespace.
 * Returns the namespace specified and creates it if it doesn't exist.  
 *
 * UIB.namespace("property.package");
 * UIB.namespace("UIB.property.package");
 *
 * Either of the above would create UIB.property, then
 * UIB.property.package
 *
 * @param  {String} ns The name of the namespace
 * @return {Object}    A reference to the namespace object
 */
UIB.namespace = function(ns) {

    if (!ns || !ns.length) {
        return null;
    }

    var levels = ns.split(".");
    var nsobj = UIB;

    // UIB is implied, so it is ignored if it is included
    for (var i=(levels[0] == "UIB") ? 1 : 0; i<levels.length; ++i) {
        nsobj[levels[i]] = nsobj[levels[i]] || {};
        nsobj = nsobj[levels[i]];
    }

    return nsobj;
};

// Declare namespaces availabe here.
UIB.namespace("UIB.catalogItem");
UIB.namespace("UIB.cart");
UIB.namespace("UIB.cookie");
UIB.namespace("UIB.checkout");
UIB.namespace("UIB.creditcard");
UIB.namespace("UIB.editable");
UIB.namespace("UIB.login");
UIB.namespace("UIB.resizer");
UIB.namespace("UIB.util");
