// Einstein Industries Core JS Library
//
// Author: 	Brian Smith (bsmith@einsteinindustries.com)
// Date: 	June 2007
 

// Set the global namespace
if(typeof EI == "undefined") {
	var EI = {};
}

// We can automatically create namespaces under EI with this function.
// Note: It assumes the EI prefix already, but will still work if you add it.
EI.namespace = function(new_namespace) {
	
 	var obj = EI;
 	var sub_objects = new_namespace.split(".");
	var i, j;
    
    // EI is implied, so it is ignored if it is included
    for (j = (sub_objects[0] == "EI") ? 1 : 0; j < sub_objects.length; j = j+1) {
        obj[ sub_objects[j] ] = obj[ sub_objects[j] ] || {};
        obj = obj[ sub_objects[j] ];
    }

    return obj;
}