//Copyright (C) Ben Parbury - All Rights Reserved. Unauthorized copying of this file, via any medium is strictly prohibited. Written by Ben Parbury <ben@gridlockinteractive.com> 2014
function KeyCodeToString(keycode)
{
	var text = gKeyCodeToString[keycode];
	if(!text)
	{
		text = String.fromCharCode(keycode);
	}
	return text;
}

function KeyToString(key)
{
	var unmap = gKeyboard.GetUnmap(key);
	if(unmap)
	{
		return  KeyCodeToString(unmap);
	}
	
	return KeyCodeToString(key);
}

var gKeyCodeToString = new Array();
gKeyCodeToString[8] = "Backspace"
gKeyCodeToString[9] = "Tab"
gKeyCodeToString[13] = "Enter"
gKeyCodeToString[16] = "Shift"
gKeyCodeToString[17] = "Ctrl"
gKeyCodeToString[18] = "Alt"
gKeyCodeToString[19] = "Break"
gKeyCodeToString[20] = "Caps Lock"
gKeyCodeToString[27] = "Esc"
gKeyCodeToString[32] = "Space"
gKeyCodeToString[33] = "Page Up"
gKeyCodeToString[34] = "Page Down"
gKeyCodeToString[35] = "End"
gKeyCodeToString[36] = "Home"
gKeyCodeToString[37] = String.fromCharCode(8592) /*"Left Arrow"*/
gKeyCodeToString[38] = String.fromCharCode(8593) /*"Up Arrow"*/
gKeyCodeToString[39] = String.fromCharCode(8594) /*"Right Arrow"*/
gKeyCodeToString[40] = String.fromCharCode(8595) /*"Down Arrow"*/
gKeyCodeToString[45] = "Insert"
gKeyCodeToString[46] = "Delete"
gKeyCodeToString[91] = "Left Window"
gKeyCodeToString[92] = "Right Window"
gKeyCodeToString[93] = "Select Key"
gKeyCodeToString[96] = "Numpad 0"
gKeyCodeToString[97] = "Numpad 1"
gKeyCodeToString[98] = "Numpad 2"
gKeyCodeToString[99] = "Numpad 3"
gKeyCodeToString[100] = "Numpad 4"
gKeyCodeToString[101] = "Numpad 5"
gKeyCodeToString[102] = "Numpad 6"
gKeyCodeToString[103] = "Numpad 7"
gKeyCodeToString[104] = "Numpad 8"
gKeyCodeToString[105] = "Numpad 9"
gKeyCodeToString[106] = "Numpad *"
gKeyCodeToString[107] = "Numpad +"
gKeyCodeToString[109] = "Numpad -"
gKeyCodeToString[110] = "Numpad ."
gKeyCodeToString[111] = "Numpad /"
gKeyCodeToString[112] = "F1"
gKeyCodeToString[113] = "F2"
gKeyCodeToString[114] = "F3"
gKeyCodeToString[115] = "F4"
gKeyCodeToString[116] = "F5"
gKeyCodeToString[117] = "F6"
gKeyCodeToString[118] = "F7"
gKeyCodeToString[119] = "F8"
gKeyCodeToString[120] = "F9"
gKeyCodeToString[121] = "F10"
gKeyCodeToString[122] = "F11"
gKeyCodeToString[123] = "F12"
gKeyCodeToString[144] = "Num Lock"
gKeyCodeToString[145] = "Scroll Lock"
gKeyCodeToString[186] = ";"
gKeyCodeToString[187] = "="
gKeyCodeToString[188] = ","
gKeyCodeToString[189] = "-"
gKeyCodeToString[190] = "."
gKeyCodeToString[191] = "/"
gKeyCodeToString[192] = "'"
gKeyCodeToString[219] = "["
gKeyCodeToString[220] = "\\"
gKeyCodeToString[221] = "]"
gKeyCodeToString[222] = "#"
