
jCore = {
	version: '1'
};

jCore.apply = function(o/*object*/, p/*properties*/, d/*default*/)
{
	if (d) jCore.apply(o, d);
	if (o && p && typeof p == 'object'){
		for(var k in p) o[k] = p[k];
	}
	return o;
};

(function(){
	jCore.apply(jCore, {
		extend: function(childConstructor , baseClass, attr){

			if(typeof baseClass == 'object'){
				attr = baseClass;
				baseClass = childConstructor;
				childConstructor = attr.constructor != Object.prototype.constructor ? attr.constructor : function(){baseClass.apply(this, arguments);};
			}

			var F = function(){};

			F.prototype = baseClass.prototype;
			childConstructor.prototype = new F();
			childConstructor.prototype.constructor=childConstructor;
			childConstructor.superclass=baseClass.prototype;

			if(baseClass.prototype.constructor == Object.prototype.constructor){
				baseClass.prototype.constructor=baseClass;
			}

			childConstructor.override = function(o){
				jCore.override(childConstructor, o);
			};

			childConstructor.prototype.superclass = childConstructor.prototype.supr = (function(){
				return baseClass.prototype;
			});

			childConstructor.prototype.override = function(o){
				for(var m in o){
					this[m] = o[m];
				}
			};

			jCore.override(childConstructor, attr);

			childConstructor.extend = function(o){return jCore.extend(childConstructor, o);};

			return childConstructor;
		},
		override: function(o/*object*/, a/*attributes*/){
			if (a){
				var p = o.prototype;
				jCore.apply(p, a);
			}
		}
	});
})();


