/*******************************************************************
 This is our core JavaScript library.  This file should be added to all
 HTML pages.  The library creates its own namespace by creating an
 object cfc so our scripts will not interfere with other scripts.
 All variables and functions are properties of this overall object.
 For example, function a() created in this namespace would be
 accessed by cfc.a().
 *******************************************************************/

/*******************************************************************
 
 Global Variables
 *******************************************************************/

// Create the unique namespace.  Test to make sure we don't overwrite
// any existing objects with the same name
if (typeof cfc == "undefined") {
    cfc = new Object();
}

/*******************************************************************
 
 create namespace
 *******************************************************************/
/*
 * Creates namespace where root object is assumed to be 'cfc'.  For example, 
 * to create an object 'cfc.widget', you would...
 * 
 * 
        // Creates a namespace for "myproduct1"
        cfc.namespace("myproduct1");
        cfc.myproduct1.Class1 = function(info) {
             alert(info);
        };
        
        // Creates a namespace for "myproduct2", and for "mysubproject1"
        cfc.namespacek("myproduct2.mysubproject1");
        cfc.myproduct2.mysubproject1.Class1 = function(info) {
             alert(info);
        };
 * 
 */ 
cfc.namespace = function(){
    var a = arguments, o = null, i, j, d;
    for (i = 0; i < a.length; i = i + 1) {
        d = a[i].split(".");
        o = cfc;
        
        for (j = 0; j < d.length; j = j + 1) {
            o[d[j]] = (o[d[j]] || new Object());
            o = o[d[j]];
        }
    }
    return o;
};
