/////////////////////////////////
///When key down fire event to parent frame
var documentKeydownFunction=function() {
	return function() {
		if (event.altKey) {
			if (event.keyCode!=18) {
				try {
					parent.fireHotKey(event.keyCode,event.srcElement);
				}
				catch(e) { }
			}
		}
		else if (event.ctrlKey) {
			if (event.keyCode!=17) {
				try {
					parent.fireCtrlHotKey(event.keyCode,event.srcElement);
				}
				catch(e) { }
			}
		}
		else {
			if (this.aolKeyIsDown) { return; }
			else {
				this.aolKeyIsDown=true;
			}
			if (event.keyCode==38) {
				try {
					parent.fireUpKeyEvent();
				}
				catch(e) { }
			}
			else if (event.keyCode==40) {
				try {
					parent.fireDownKeyEvent();
				}
				catch(e) { }
			}
			else if (event.keyCode==37) {
				try {
					parent.fireLeftKeyEvent();
				}
				catch(e) { }
			}
			else if (event.keyCode==39) {
				try {
					parent.fireRightKeyEvent();
				}
				catch(e) { }
			}
			else if (event.keyCode==13) {
				try {
					parent.fireEnterKeyEvent();
				}
				catch(e) { }
			}
			else if (event.keyCode==27) {
				try {
					parent.fireEscKeyEvent();
				}
				catch(e) { }
			}
			if (event.keyCode==9) {
				try {
					if(parent.isTopSubMenuOpened()==true) {
						return false;
					}
				}
				catch(e){}
			}
			try {
				parent.fireOtherKeyEvent(event.keyCode);
			}
			catch(e) { }
		}
		if (event.keyCode==32) {
			event.srcElement.click();	
		}
	}
}
var documentKeyupFunction=function() {
	return function() {
		this.aolKeyIsDown=false;	
	}
}

function getCloseTopMenuFunction(clickf) {
	return function() {

		try { clickf(); }
		catch(e){}
		try { 
			parent.closeTopSubNenu(); 
			parent.isMove=true;
		}
		catch(e){}
	}
}
document.attachEvent("onclick",getCloseTopMenuFunction(null));
document.attachEvent("onkeydown",documentKeydownFunction());
document.attachEvent("onkeyup",documentKeyupFunction());
document.attachEvent("ondragstart",function(){return false;});