function fnGetTable( oEl )
{
	try{ 
		while( null != oEl  &&  oEl.type != "text" )
		{
			oEl = oEl.parentElement;
		}
		return oEl;
	} catch(e) {
		return null;
	}
}


function clicks() {
	oElement = document.elementFromPoint(event.x,event.y);
	oElement = fnGetTable(oElement);

	if(oElement != null)
		return true;
	else
		return false;
}
 
function CtrlKeyDown() { 
	oElement = document.elementFromPoint(event.x,event.y);
	oElement = fnGetTable(oElement);
	if(oElement != null) {
		return true;
	} else {
		if (event.keyCode==67&&event.ctrlKey) { 
			clipboardData.setData('text','');
			
			return false;	
		}
	}  
}

function nocontextmenu(){
	oElement = document.elementFromPoint(event.x,event.y);
	oElement = fnGetTable(oElement);

	if(oElement == null) {
		
		event.cancelBubble = true 
		event.returnValue = false; 
		return false; 
	} 
}

function norightclick(e){ 
		if (window.Event){ 
			if (e.which == 2 || e.which == 3) 
				return false; 
		} 
		else if (event.button == 2 || event.button == 3) { 
			event.cancelBubble = true; 
			event.returnValue = false;
			return false;
		}
} 
  

document.onkeydown = CtrlKeyDown;          //¼üÅÌ
document.onselectstart = clicks;           //Ñ¡È¡
document.oncontextmenu = nocontextmenu;    //ÓÒ¼ü for IE5+ 
document.onmousedown = norightclick;       //for all others 
