/* Novusoft */	
var Novusoft = Novusoft || {};

/**
 * Simple function to register a namespace. Usage: Novusoft.registerNamespace("Novusoft.Utils");
 *
 * @param {string} ns Name of namespace seperated by periods to denote different namespace levels
 * @return {object} Reference to last created namespace.
 */
Novusoft.registerNamespace = function(ns) { 
	var namespaces = ns.split(".");	
	var last = window[namespaces[0]] = window[namespaces[0]] || {};
	for(var i = 1; i < namespaces.length; i++) { 
		last = last[namespaces[i]] = last[namespaces[i]] || {};
	}
	return last;
}

/**
 * A function to create types;
 *
 * @param {object} body The body of the created type
 * @return {function} A new type.
 */
Novusoft.Type = function(body) { 
	return Novusoft.Type.extend(Object,body);
};

Novusoft.Type.extend = function(type,body) {		
	if(arguments.length == 1) { //when only the type argument is provided, for extending
		return function(b) {
			return shine.Type.extend(type,b);
		}
	}

	var t = body.constructor;		

	var dummy = function() {};
	dummy.prototype = type.prototype; 
	t.prototype = new dummy; // creates the link between the parent prototype and __proto__ 

	Novusoft.Type.augment(t,body); //extend the body
	t.extend = Novusoft.Type.extend(t); //set the Curry

	return t;
};

Novusoft.Type.augment = function(type, body) {		
	for(key in body) {
		type.prototype[key] = body[key];				
	}
};


/* Settings */

/* Novusoft.Settings */
Novusoft.registerNamespace("Novusoft.Settings");

/* AddPrototypes defines whether prototypes should be added to default types */
Novusoft.Settings.AddPrototypes = true;