var Class = {
	create: function() {
		return function() {
			this.init.apply(this,arguments);
		}
	}
}

Function.prototype.inScope = function(scope) {
	var __method = this;
	return function() {
		return __method.apply(scope,arguments);
	}
}

extendObject = function(dest, source) {
	for (var key in source) {
		dest[key] = source[key];
	}
	return dest;
}

EmptyHandler = function() {};

extendObject(Array.prototype, {
	indexOf: function(entry) {
		for (var i = 0, len = this.length; i < len; i++) {
			if (this[i] == entry) {
				return i;
			}
		}
		return -1;
	},
	removeAt: function(index) {
		this.splice(index,1);
	}
});

function popup(url,name,width,height) {
	width = width || 600;
	height = height || 350;
	var pop = window.open(url,name,"scrollbars=1,width=" + width + ",height=" + height);
	if (!pop) {
		alert("Your popup manager is blocking a window used by the backend.");
	} else {
		if (pop.focus) {
			pop.focus();
		}
	}
}

function trim(str) {
		return str.replace(/^\s*|\s*$/g,"");
}