/*
 * Michael Norton
 * 
 * The 'object' object provides for manipulation of objects and handles
 * common inheritance issues for us
 * 
 * clone - 
 * 		accepts an object and returns a clone.
 * 		Maintains inheritance tree, but breaks ties to parent properties
 * extend - 
 * 		accepts an object and an additional properties object literal.
 * 		Appends properties literal elements to object.
 * assemble - 
 * 		accepts a hash map of objects { name:object, name:object, ...} 
 * 		returns an object that contains clones of all objects in the hash
 */

// waynedalton = waynedalton || {};

waynedalton.object = {
		clone: function (originalObject) {
			var cloneObject;
			function interstitial() {};
			interstitial.prototype = originalObject;
			cloneObject = new interstitial();
			cloneObject.uber = originalObject;
			
			return cloneObject;
		},
		
		extend: function (originalObject, newProperties) {
			var extendObject = this.clone( originalObject );
			for ( var prop in newProperties ) {
				extendObject[prop] = newProperties[prop];
			}
			
			return extendObject;
		},
		
		assemble: function(objectHash) {
			var assembleObject = {};
			for ( var obj in objectHash ) {
				assembleObject[obj] = this.clone(objectHash[obj]);
			};
			return assembleObject;
		},
		
		update: function(originalObject, propertiesToChange) {
			var updateObject = this.clone(originalObject);
			for ( var property in propertiesToChange ) {
				if ( typeof updateObject[property] !== "undefined" ) {
					updateObject[property] = propertiesToChange[property];
				};
			};
			return updateObject;
		}
};

