// Used by Nav and DebugConsole

// This is a hack to fix JavaScript's prototyped
// methods' problem handling DOM events.
// see http://missig.org/julian/blog/2005/06/22/javascript-events/
function createEventHandler(obj, methodName) {
	var args = [];
	for(var i = 2; i < arguments.length; i++) {
		args.push(arguments[i]);
	}
	return function() {
		// This anonymous function's arguments mask createEventHandler's.
		// The arguments at each scope can be necessary, so we concatenate them.
		for(var i = 0; i < arguments.length; i++) {
			args.push(arguments[i]);
		}
		try {
			obj[methodName].apply(obj, args);
		} catch(e) {
			_handler(e);
		}
	}
}
