var _dom = 0;

function KeyPressHandler(e)
{
	if (document.all) e = window.event; // for IE
	if (_dom == 3) var EventStatus= e.srcElement.tagName;
	else if(_dom == 1) var EventStatus= e.target.nodeName; // for Mozilla

	var cc = '';
	var ch = '';

	if (_dom == 3) // for IE
	{
		if (e.keyCode > 0)
		{
			ch = String.fromCharCode(e.keyCode);
			cc = e.keyCode;
		}
	}
	else // for Mozilla
	{
		cc = e.keyCode;
		if (e.charCode > 0)
		{
			ch = String.fromCharCode(e.charCode);
		}
	}

	if (e.altKey || e.ctrlKey) return;
	if (_dom == 2) return;
	if (EventStatus == 'INPUT' || EventStatus == 'TEXTAREA') return;

	//-----------------------------------------------------------------------
	// on editing mode
	if (document.forms[0] != null && document.forms[0].elements['memo'] != null && cc == 27)
	{
		document.forms[0].elements['memo'].focus();
	}
	//-----------------------------------------------------------------------

	else
	{
		switch (ch)
		{
			case "a": self.location = "/main.php"; break; // Ã¹ÆäÀÌÁö
			case "h": self.location = "/main.php"; break; // Ã¹ÆäÀÌÁö
			case "f": self.location = "/bbs/zboard.php?id=new_freeboard"; break; // ÀÚÀ¯°Ô½ÃÆÇ
			case "c": self.location = "/bbs/zboard.php?id=new_artgal"; break; // Äð°¶
			case "n": self.location = "/bbs/zboard.php?id=new_notice"; break; // °øÁö»çÇ×
			case "o": self.location = "/bbs/zboard.php?id=new_offboard"; break; // ¿ÀÇÁ¸ðÀÓ
			case "g": self.location = "/gallery/gal1.php"; break; // °¶·¯¸®
			case "m": self.location = "/gallery/gal_mine.php"; break; // ³»°¡ ¿Ã¸° »çÁø
			case "v": self.location = "/gallery/gal_rec.php"; break; // ³»°¡ ÃßÃµÇÑ »çÁø
			default: break;
		}
	}

	/*
	// [C] - Community
	else if (ch == "c")
		self.location = URLPrefix + URLCommunity;

	// [G] - Gallery
	else if (ch == "g")
		self.location = URLPrefix + URLGallery;

	// [F] - Forum
	else if (ch == "f")
		self.location = URLPrefix + URLForum;
	*/

	return;
}

function KeyInput()
{
	_dom = document.all ? 3 : (document.getElementById ? 1 : (document.layers ? 2 : 0));
	document.onkeypress = KeyPressHandler;
}

KeyInput();