/**********************************************************************
 * 文件: KeyPress.js
 * 依赖文件: browser.js
 * 功能: 一些按键的处理.
 * creator: Mars
 * creat time: 2006-04-10
 **********************************************************************/
 
/*
 * 功能: 回车实现按钮点击.
 * 参数: buttonId-按钮Id号.
 */
function EnterSubmit(buttonId, event)
{
	if (Browser.IsNetscape)
	{
		NetscapeKeyPressProcess(buttonId, event);
	}
	else if (Browser.IsIE)
	{		
		if (event.keyCode == 13)
		{			
			document.getElementById(buttonId).click();
			event.returnValue = false;
		}
	}
}
/*
 * 功能: 在Netscapt中的回车实现按钮点击处理.
 * 参数: buttonId-按钮Id号.
 */
function NetscapeKeyPressProcess(buttonId, event)
{
	document.captureEvents(Event.KEYPRESS);
	document.onkeypress = KeyPressHandler;
	
	function KeyPressHandler(event)
	{
		document.releaseEvents(Event.KEYPRESS);
		document.onkeypress = null;
		
		if (event.which == 13)
		{
			document.getElementById(buttonId).click();
			return false;
		}
		else
		{			
			document.routeEvent(event);			
		}		
	}
}
/*
 * 功能: 得到一个object的全部属性信息.
 * 参数: objectItem-提供属性信息的object.
 * 返回值: 属性信息的字符串.
 */
function GetObjectPropertyInfo(objectItem)
{
	var info = "";
	for (var propertyName in objectItem)
	{
		info += propertyName + ": " + objectItem[propertyName] + "\n";
	}
	return info;
}
