
window.onerror = function() {
	//return false;
};

//document.oncontextmenu = function() {
	//return false;
//};
window.onhelp = function() {
	return false;
};

document.onkeydown = function(e) 
{
	var e = e || window.event; 
	
	var key = e.keyCode;
	
	if(key==40)//向下箭头
	{
		if(undefined!=dataTbl)
			changRowBgColor(dataTbl.rows[selTrIndex+1]);
	}
	
	if(key==38)//向上箭头
	{
		if(undefined!=dataTbl)
			changRowBgColor(dataTbl.rows[selTrIndex-1]);
	}
	/**
	F5 ---(key == 116)
	F11---(key == 122)
	',"---(key == 222);
	ctrl+'N'---'(event.ctrlKey)&&(key==78)
	ctrl+'R'---'(event.ctrlKey)&&(key==82)'��ˢ��
	**/
	if(key==116 || key==122 || (e.ctrlKey&&key==78) || (e.ctrlKey&&key==82)) {
		invalidateKey(e);
		return false;
	}
	//BackSpace
	if(key==8 && isback(e)) {
		invalidateKey(e);
		return false;
	}
	//shift+link
	if(e.shiftKey && e.srcElement.tagName=='A') {
		invalidateKey(e);
		return false;
	}
	//Alt+F4
	if(e.altKey && key==115) {
		window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px");
		invalidateKey(e);
		return false;
	}
	//��ʾ�쳣��Ϣ
	if(e.altKey && key==80) {
		if(BASEFLAG_ERRORMSG==undefined || BASEFLAG_ERRORMSG==null) return ;
			//window.showModalDialog(ContextPath+"/framework/jsp/Error.jsp?BASEFLAG_ERRORMSG="+BASEFLAG_ERRORMSG,"","dialogWidth:800px;dialogHeight:600px; edge:Raised; center:yes; help:no; resizable:no; status:no;");
	}
};

/** ʹ������Ч **/
function invalidateKey(e) {
	e.keyCode = 0;
    e.cancelBubble = true;
    e.returnvalue = false;
}
/** �ж�event���ڵ�����Ƿ���Ҫ���λ��˼� **/
function isback(e) {
	return !((e.srcElement.type=='text' || e.srcElement.type=='textarea' || e.srcElement.type=='password')
				&& !e.srcElement.readOnly);
}

var dataTbl;
var selTrIndex;
//页面点击变色
function changRowBgColor(trObj) 
{ 
	if( null!=trObj && undefined !=trObj )
	{
		dataTbl = trObj.parentNode;
		selTrIndex = trObj.rowIndex;
		var len = dataTbl.rows.length;
		for(i=1;i<len;i++)
		{
			if(dataTbl.rows[i].rowIndex == selTrIndex)
			{
				dataTbl.rows[i].style.backgroundColor='#00ccff';
			}
			else
	        {
				if((i+1)%2==0)
				{
					
					dataTbl.rows[i].style.backgroundColor='#eef8fb';
				}
				else
				{
					dataTbl.rows[i].style.backgroundColor='';
				}
	        }
		}
	}
   
}

