//Defines the top level Class
function Class() { }
	Class.prototype.construct = function() {};
	Class.extend = function(def) {
    	var classDef = function() {
        	if (arguments[0] !== Class) {
        		this.construct.apply(this, arguments);
        	}
    };

    var proto = new this(Class);
    var superClass = this.prototype;

    for (var n in def) {
        var item = def[n];
        if (item instanceof Function) item.$ = superClass;
        proto[n] = item;
    }

    classDef.prototype = proto;

    //Give this new class the same static extend method
    classDef.extend = this.extend;
    return classDef;
};




// created delegate funtionality for use in classes

// created delegate funtionality for use in classes
function delegate( that, thatMethod) {
	if(window.opera) {
		return function() { return thatMethod.call(that); }
	}else{
		if(arguments.length > 2) {
	    	var _params = [];
	    	for(var n = 2; n < arguments.length; ++n) _params.push(arguments[n]);

	    	return function() {
	    		return thatMethod.apply(that,_params);
	    		}
	    }else if (xIE4Up) {
		    if(xIE6|| xIE7 || xIE8) {

		    }else{
				thatMethod.call(that);
			}
	 	}
		return function() { return thatMethod.call(that); }
	}
}