(function($){
	if (typeof window.SE == "undefined"){
        var SE = window.SE = function(){
            // We have a dependency on jQuery:
            if (typeof jQuery == "undefined"){
                alert("Please load jQuery library first");
            }
            
			this.fn = {};
            this.extend = function(namespace,obj){
                if (typeof this[namespace] == "undefined"){
					if (typeof this.fn[namespace] === "undefined"){
						// extend each namespace with core functionality
						$.extend(obj,this.fn.extFN);

						// load the new libary in the namespaces:
						this.fn[namespace] = obj;
						//this.fn[namespace] = tmp;
						this[namespace] = this.fn[namespace];

						// initialize the new library
						if (typeof this[namespace].init === "function"){
							this[namespace].init();
						}
					} else {
						alert("The namespace '" + namespace + "' is already taken...");
					}
				}
			};
            
            this.setObjectData = function(obj1, obj2) {
				for (var p in obj2) {
					try {
						// Property in destination object set; update its value.
						if ( obj2[p].constructor == Object ) {
							obj1[p] = window.SE.setObjectData(obj1[p], obj2[p]);
						} else {
							obj1[p] = obj2[p];
						}
					} catch(e) {
						// Property in destination object not set; create it and set its value.
						obj1[p] = obj2[p];
					}
				}
				
				return obj1;
            };
		};
		window.SE = new SE();

		window.SE.extFN = window.SE.fn.extFN = {
            setConfig:function(settings) {
                window.SE.setObjectData(this.settings, settings);
                return this;
            }
		};
	}
})(jQuery);
