/**
* Create Class
* @usage
var ClassName = Class.create();
ClassName.prototype = {
	initialize: function () {
	
	}
}

var name = new ClassName();
*/
/*
var Class = {
	create: function () {
		return function () {
			this.initialize.apply(this, arguments);
		}
	}
}
*/

function Class (name) {
	
	Class.copyMethods(name, Class);
	if (name.prototype != undefined) {
		name.prototype.superclass = Function();
	}
	return name;
}

Class.copyMethods = function (target, container) {
	
	for (var items in container) {
		if (container[items] instanceof Function) {
			target[items] = container[items];
		}
	}
	
}

Class.extend = function (name) {
	
	if (name.prototype == undefined) {
		//this.prototype = name;
		
		this.copyMethods(this.prototype, name);
		this.prototype.superclass = function () {
			return name;
		};
		
		this.copyMethods(this.prototype.superclass, name);
		this.prototype.contructor = this;
		
	} else {
		this.prototype = name.prototype;
		
		this.prototype.superclass = function () {
			
			if (arguments.length == 0) {
				return new name();
			} else if (arguments.length == 1) {
				return new name(arguments[0]);
			} else {
				return name.apply(this, arguments);
			}
			
		};
		
		this.copyMethods(this.prototype.superclass, name.prototype);
		this.prototype.contructor = this;
	}
}
