var EmptyFunction = function() {};

function Class (t, base) {
	var q = function() {
		this.__construct.apply (this, arguments);
	};
	
	if (base) {
		for (var property in base.prototype) {
			q.prototype[property] = base.prototype[property];
		}
		q.prototype.__parent = base;
	}
	
	for (var property in t) {
		q.prototype[property] = t[property];
	}

	q.prototype.__callParent = function() {
		return this.__parent.prototype[arguments[0]].apply (this, 
			Array.prototype.slice.apply (arguments, [1]));
	}
	
	q.prototype.__callBase = function() {
		var obj = eval ("window." + arguments[0]);
		return obj.prototype[arguments[1]].apply (this, 
			Array.prototype.slice.apply (arguments, [2]));
	}
	
	if (!q.prototype.__construct) q.prototype.__construct = EmptyFunction;
	return q;
}