/**
 * @author Márcio d'Ávila
 * @version 1.0, 2004
 *
 * PROTÓTIPOS:
 * construtor CrossEvent(Event pEvent)
 *
 * String inspectObject(Object pObj)
 */


function CrossEvent(evt)
{
	evt = evt? evt: (window.event? window.event: null);
	if (evt)
	{
		this.originalEvent = evt;
		this.type = evt.type;
		this.screenX = evt.screenX;
		this.screenY = evt.screenY;

		// IE: srcElement
		this.target = evt.target? evt.target: evt.srcElement;

		// N4: modifiers
		if (evt.modifiers)
		{
			this.altKey   = evt.modifiers & Event.ALT_MASK;
			this.ctrlKey  = evt.modifiers & Event.CONTROL_MASK;
			this.shiftKey = evt.modifiers & Event.SHIFT_MASK;
			this.metaKey  = evt.modifiers & Event.META_MASK;
		}
		else
		{
			this.altKey   = evt.altKey;
			this.ctrlKey  = evt.ctrlKey;
			this.shiftKey = evt.shiftKey;
			this.metaKey  = evt.metaKey;
		}

		// N4: which // N6+: charCode
		this.charCode = !isNaN(evt.charCode)? evt.charCode: !isNaN(evt.keyCode)? evt.keyCode: evt.which;
		this.keyCode = !isNaN(evt.keyCode)? evt.keyCode: evt.which;
		this.button = !isNaN(evt.button)? evt.button: !isNaN(evt.which)? evt.which-1: null;
		this.debug = "c:" + evt.charCode + " k:" + evt.keyCode
			+ " b:" + evt.button + " w:" + evt.which;
	}
} // CrossEvent


function inspectObject(obj) {
	var result = "";
	var objName = obj.name? obj.name: "object";
	for (var i in obj) {
		result += objName + "." + i + " = " + obj[i] + "\n";
	}
	return result;
} // inspectObject
