var ControlMapping = new Object();
var ControlWithFocus = "";
			
function EventInit()
{
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1)
	{
		document.onkeypress = ProcessEvent;
    //does work for netscape 7.1 and 7.0
		//document.captureEvents(Event.KEYPRESS);
		//document.onkeypress = ProcessNetscapeEvent;
    //does not work for netscape 7.1 ask Janusz for details;
	}
	else
	{
		document.onkeypress = ProcessEvent;
	}
}

function ProcessNetscapeEvent(eve)
{
	var controls = document.getElementsByName("ControlToUse");
	if ((controls != null) && (controls.length > 0))
	{
		var controlToUse = controls[0];

		var c = document.getElementById(controlToUse.value);
		
		if (c != null)
		{
			if (eve.keyCode == 13)
			{
				eve.preventDefault();
				c.focus();
				document.forms[0].submit();
			}
		}
	}
	
	return false;
}

function ProcessEvent()
{
	if (event.keyCode == 13)
	{
		if (ControlWithFocus.length > 0)
		{
			var controlToUse = ControlMapping[ControlWithFocus];
			
			if (controlToUse != null)
			{
				var c = document.getElementById(controlToUse);
				if (c != null)
				{
					c.focus();
					document.forms[0].submit();
				}
			}
		}
	}
	/*
	var controlToUse = document.getElementById("ControlToUse");

	if (controlToUse != null)
	{
		var c = document.getElementById(controlToUse.value);
		
		if (c != null)
		{
			if (event.keyCode == 13)
			{
				c.focus();
				document.forms[0].submit();
			}
		}
	}
	*/
}
