// firebugx.js
if (!window.console || !console.firebug)
{
    var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
    "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];

    window.console = {};
    for (var i = 0; i < names.length; ++i)
        window.console[names[i]] = function() {};
};

function createPackage(name){
	var t		= window;
	var pkgs	= name.split(".");
	for(p in pkgs){
		if(!t[pkgs[p]]){
			t[pkgs[p]] = {};
		}else{
			if(typeof t[pkgs[p]] == 'function'){
				alert(name+': '+pkgs[p]+' is a Class and cannot be package name!');
			}
		};
		t = t[pkgs[p]];
	};
	return t;
};

function createClass(pkgName, constr, impl, extend){
	constr	= constr || function(){};
	impl	= impl||{};
	var pkgNameAr = pkgName.split('.');
	var className = pkgNameAr.pop();
	var extended = extend?(extend.prototype?extend.prototype:{}):{};
	
	var pkg = createPackage(pkgNameAr.join('.'));
	pkg[className] = constr;
	pkg[className].prototype = $.extend({}, pkg[className].prototype, extended, impl, true);
	return pkg[className];
};