//Hierarchy:
// -Base
// --Primal
// ---Extension
// ----Specialized
// -Optimised ( basically a final version of the base->extension including all common class libraries, it wont have a prerequesite )

/*
--------------------
Type:Optimised/Base
Name: Javascript Extensions
Source File Name: class.js
Desc:	Adds "Class" functionality without appending ".prototype"
		Allows Inheritance and selective method import from other classes/objects

Author:	Joe Mieszczur
		Concept/Code:	"Class"		Douglas Crockford www.crockford.com
--------------------
*/
//allows you to add methods 
Function.prototype.method=	function(name,func)	{this.prototype[name] = func;return this;};
//allows you to inherit
Function.method('inherits', function(parent)	{
	var d={},p=(this.prototype=new parent());
	this.method('uber',function uber(name){
		if(!(name in d)){d[name] = 0;}
		var f,r,t=d[name],v=parent.prototype;
		if(t){
			while(t){v=v.constructor.prototype;t-=1;}
			f=v[name];
		}else{
			f=p[name];
			if(f==this[name]){
				f=v[name];
			}
		}
		d[name]+=1;
		r=f.apply(this,Array.prototype.slice.apply(arguments,[1]));
		d[name]-=1;
		return r;
	});
	return this;
});
//allows you to selectivly inherit methods
Function.method('swiss', 	function(parent) 	{for(var i=1;i<arguments.length;i+=1){var name=arguments[i];this.prototype[name]=parent.prototype[name];}return this;});
