/* ********************************************************************
 **********************************************************************
 * HTML Virtual Keyboard Interface Script - v1.22
 *   Copyright (c) 2009 - GreyWyvern
 *
 *  - Licenced for free distribution under the BSDL
 *          http://www.opensource.org/licenses/bsd-license.php
 *
 * Add a script-driven keyboard interface to text fields, password
 * fields and textareas.
 *
 * See http://www.greywyvern.com/code/javascript/keyboard for examples
 * and usage instructions.
 *
 * Version 1.22 - March 30, 2009
 *   - Added support for max-length on inputs (Olivier Désormeaux)
 *   - Downgrade comma-below forms of S and T to cedilla for IE < 8
 *   - Change exposed attachment function name to VKI_attach
 *   - Exposed keyboard close function as VKI_close
 *   - No longer expose any functions in the userscript version
 *
 */

function VKI_buildKeyboardInputs()
{
	var self = this;

	this.VKI_target = false;
	this.VKI_shift = this.VKI_capslock = this.VKI_alternate = this.VKI_dead = false;
	this.VKI_deadkeysOn = false;
	this.VKI_kt = getCookie("kl") ? getCookie("kl") : "English";

	this.VKI_clickless = false;
	this.VKI_clicklessDelay = 500;
	this.VKI_keyCenter = 3;

	this.VKI_isIE = /*@cc_on!@*/false;
	this.VKI_isIE6 = /*@if(@_jscript_version == 5.6)!@end@*/false;
	this.VKI_isIElt8 = /*@if(@_jscript_version < 5.8)!@end@*/false;
	this.VKI_isMoz = (navigator.product == "Gecko");
	this.VKI_isWebKit = RegExp("KHTML").test(navigator.userAgent);


	/* ***** Create keyboards ************************************** */
	this.VKI_layout = {};
	this.VKI_layoutDDK = {};

	this.VKI_rtl = [['Arabic'], ['Hebrew'], ['Persian']];

// - Lay out each keyboard in rows of sub-arrays.  Each sub-array
//   represents one key.
// 
// - Each sub-array consists of four slots described as follows:
//     example: ["a", "A", "\u00e1", "\u00c1"]
//
//          a) Normal character
//          A) Character + Shift or Caps
//     \u00e1) Character + Alt or AltGr
//     \u00c1) Character + Shift or Caps + Alt or AltGr
//
//   You may include sub-arrays which are fewer than four slots.
//   In these cases, the missing slots will be blanked when the
//   corresponding modifier key (Shift or AltGr) is pressed.
//
// - If the second slot of a sub-array matches one of the following
//   strings:
//       "Tab", "Caps", "Shift", "Enter", "Bksp", "Alt" OR "AltGr"
//   then the function of the key will be the following,
//   respectively:
//     - Insert a tab
//     - Toggle Caps Lock (technically a Shift Lock)
//     - Next entered character will be the shifted character
//     - Insert a newline (textarea), or close the keyboard
//     - Delete the previous character
//     - Next entered character will be the alternate character
//
//   The first slot of this sub-array will be the text to display
//   on the corresponding key.  This allows for easy localisation
//   of key names.
//
// - Layout dead keys (diacritic + letter) should be added as
//   arrays of two item arrays with hash keys equal to the
//   diacritic.  See the "this.VKI_deadkey" object below the layout
//   definitions.  In  each two item child array, the second item
//   is what the diacritic would change the first item to.
//
// - To disable dead keys for a layout, simply assign true to the
//   this.VKI_layoutDDK (DDK = disable dead keys) object of the
//   same name as the layout.  See the Numpad layout below for an
//   example.
//
// - Note that any characters beyond the normal ASCII set should be
//   entered in escaped Unicode format.  (eg \u00a3 = Pound symbol)
//   You can find Unicode values for characters here:
//     http://unicode.org/charts/
//
// - To remove a keyboard, just delete it, or comment it out of the
//   source code

	this.VKI_layout.Arabic = [ // Arabic Keyboard
		[["ذ", "\u0651"], ["1", "!", "\u00a1", "\u00b9"], ["2", "@", "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00a4", "\u00a3"], ["5", "%", "\u20ac"], ["6", "^", "\u00bc"], ["7", "&", "\u00bd"], ["8", "*", "\u00be"], ["9", "(", "\u2018"], ["0", ")", "\u2019"], ["-", "_", "\u00a5"], ["=", "+", "\u00d7", "\u00f7"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["ض", "\u064e"], ["ص", "\u064b"], ["ث", "\u064f"], ["ق", "\u064c"], ["ف", "\u0644"], ["غ", "\u0625"], ["ع", "\u2018"], ["ه", "\u00f7"], ["خ", "\u00d7"], ["ح", "\u061b"], ["ج", "\u003c"], ["د", "\u003e"], ["\u005c", "\u007c"]],
		[["Caps", "Caps"], ["ش", "\u0650"], ["س", "\u064d"], ["ي", "\u005d"], ["ب", "\u005b"], ["ل", "\u0644"], ["ا", "\u0623"], ["ت", "\u0640"], ["ن", "\u060c"], ["م", "\u002f"], ["ك", "\u003a"], ["ط", "\u0022"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["ئ", "~"], ["ء", "\u0652"], ["ؤ", "}"], ["ر", "{"], ["ل", "ل"], ["ى", "آ"], ["ة", "’"], ["و", ","], ["ز", "."], ["ظ", "؟"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["Alt", "Alt"]]
	];

	this.VKI_layout.Armenian = [ // Armenian Standard Keyboard
		[["՝", "՝"], [":", ":"], ["ձ", "Ձ"], ["յ", "Յ"], ["՛", "՛"], [",", ","], ["-", "-"], [".", "."], ["«", "«"], ["»", "»"], ["օ", "Օ"], ["ռ", "Ռ"], ["ժ", "Ժ"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["խ", "Խ"], ["ւ", "Ւ"], ["է", "Է"], ["ր", "Ր"], ["տ", "Տ"], ["ե", "Ե"], ["ը", "Ը"], ["ի", "Ի"], ["ո", "Ո"], ["պ", "Պ"], ["չ", "Չ"], ["ջ", "Ջ"], ["'", "՞"]],
		[["Caps", "Caps"], ["ա", "Ա"], ["ս", "Ս"], ["դ", "Դ"], ["ֆ", "Ֆ"], ["ք", "Ք"], ["հ", "Հ"], ["ճ", "Ճ"], ["կ", "Կ"], ["լ", "Լ"], ["թ", "Թ"], ["փ", "Փ"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["զ", "Զ"], ["ց", "Ց"], ["գ", "Գ"], ["վ", "Վ"], ["բ", "Բ"], ["ն", "Ն"], ["մ", "Մ"], ["շ", "Շ"], ["ղ", "Ղ"], ["ծ", "Ծ"], [".", ","], ["Shift", "Shift"]],
		[[" ", " "]]
	];

	this.VKI_layout.Belarusian = [ // Belarusian Standard Keyboard
		[["ё", "Ё"], ["1", "!"], ["2", '"'], ["3", "№"], ["4", ";"], ["5", "%"], ["6", ":"], ["7", "?"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["й", "Й"], ["ц", "Ц"], ["у", "У"], ["к", "К"], ["е", "Е"], ["н", "Н"], ["г", "Г"], ["ш", "Ш"], ["ў", "Ў"], ["з", "З"], ["х", "Х"], ["'", "'"], ["\\", "/"]],
		[["Caps", "Caps"], ["ф", "Ф"], ["ы", "Ы"], ["в", "В"], ["а", "А"], ["п", "П"], ["р", "Р"], ["о", "О"], ["л", "Л"], ["д", "Д"], ["ж", "Ж"], ["э", "Э"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["/", "|"], ["я", "Я"], ["ч", "Ч"], ["с", "С"], ["м", "М"], ["і", "І"], ["т", "Т"], ["ь", "Ь"], ["б", "Б"], ["ю", "Ю"], [".", ","], ["Shift", "Shift"]],
		[[" ", " "]]
	];

	this.VKI_layout.Belgian = [ // Belgian Standard Keyboard
		[["²", "³"], ["&", "1", "|"], ["é", "2", "@"], ['"', "3", "#"], ["'", "4"], ["(", "5"], ["§", "6", "^"], ["è", "7"], ["!", "8"], ["ç", "9", "{"], ["à", "0", "}"], [")", "\u00b0"], ["-", "_"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["a", "A"], ["z", "Z"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["^", "¨", "["], ["$", "*", "]"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["q", "Q"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["m", "M"], ["ù", "%", "´"], ["μ", "£", "`"]],
		[["Shift", "Shift"], ["<", ">", "\\"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["=", "+", "~"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Bulgarian = [ // Bulgarian Keyboard
		[["`", "~"], ["1", "!"], ["2", "?"], ["3", "+"], ["4", '"'], ["5", "%"], ["6", "="], ["7", ":"], ["8", "/"], ["9", "_"], ["0", "№"], ["-", "І"], [".", "V"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], [",", "ы"], ["у", "У"], ["е", "Е"], ["и", "И"], ["ш", "Ш"], ["щ", "Щ"], ["к", "К"], ["с", "С"], ["д", "Д"], ["з", "З"], ["ц", "Ц"], [";", "§"], [".", ","]],
		[["Caps", "Caps"], ["ь", "Ь"], ["я", 'Я'], ["а", "А"], ["о", "О"], ["ж", "Ж"], ["г", "Г"], ["т", "Т"], ["н", "Н"], ["в", "В"], ["м", "М"], ["ч", "Ч"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["ю", "Ю"], ["й", "Й"], ["ъ", "Ъ"], ["э", "Э"], ["ф", "Ф"], ["х", "Х"], ["п", "П"], ["р", "Р"], ["л", "Л"], ["б", "Б"], ["Shift", "Shift"]],
		[[" ", " "]]
	];

	this.VKI_layout.Czech = [ // Czech Keyboard
		[[";", "°", "`", "~"], ["+", "1", "!"], ["ě", "2", "@"], ["š", "3", "#"], ["č", "4", "$"], ["ř", "5", "%"], ["ž", "6", "^"], ["ý", "7", "&"], ["á", "8", "*"], ["í", "9", "("], ["é", "0", ")"], ["=", "%", "-", "_"], ["´", "ˇ", "=", "+"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["ú", "/", "[", "{"], [")", "(", "]", "}"], ["¨", "'", "\\", "|"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ů", '"', ";", ":"], ["§", "!", "¤", "^"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["\\", "|", "", "˝"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "?", "<", "×"], [".", ":", ">", "÷"], ["-", "_", "/", "?"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["Alt", "Alt"]]
	];

    this.VKI_layout.Danish = [ // Danish Standard Keyboard
		[["½", "§"], ["1", "!"], ["2", '"', "@"], ["3", "#", "£"], ["4", "¤", "$"], ["5", "%", "€"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?"], ["´", "`", "|"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["å", "Å"], ["¨", "^", "~"], ["'", "*"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["æ", "Æ"], ["ø", "Ø"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["<", ">", "\\"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "μ", "Μ"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

	this.VKI_layout.Dutch = [ // Dutch Standard Keyboard
		[["@", "§", "¬"], ["1", "!", "¹"], ["2", '"', "²"], ["3", "#", "³"], ["4", "$", "¼"], ["5", "%", "½"], ["6", "&", "¾"], ["7", "_", "£"], ["8", "(", "{"], ["9", ")", "}"], ["0", "'"], ["/", "?", "\\"], ["°", "~", "¸"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R", "¶"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["¨", "^"], ["*", "|"], ["<", ">"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S", "ß"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["+", "±"], ["´", "`"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["]", "[", "¦"], ["z", "Z", "«"], ["x", "X", "»"], ["c", "C", "¢"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "µ"], [",", ";"], [".", ":", "·"], ["-", "="], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.English = [ // English Keyboard
		[["`", "~"], ["1", "!", "¡", "¹"], ["2", "@", "²"], ["3", "#", "³"], ["4", "$", "¤", "£"], ["5", "%", "€"], ["6", "^", "¼"], ["7", "&", "½"], ["8", "*", "¾"], ["9", "(", "‘"], ["0", ")", "’"], ["-", "_", "¥"], ["=", "+", "×", "÷"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q", "ä", "Ä"], ["w", "W", "å", "Å"], ["e", "E", "é", "É"], ["r", "R", "®"], ["t", "T", "þ", "Þ"], ["y", "Y", "ü", "Ü"], ["u", "U", "ú", "Ú"], ["i", "I", "í", "Í"], ["o", "O", "ó", "Ó"], ["p", "P", "ö", "Ö"], ["[", "{", "«"], ["]", "}", "»"], ["\\", "|", "¬", "¦"]],
		[["Caps", "Caps"], ["a", "A", "á", "Á"], ["s", "S", "ß", "§"], ["d", "D", "ð", "Ð"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "ø", "Ø"], [";", ":", "¶", "°"], ["'", '"', "´", "¨"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["z", "Z", "æ", "Æ"], ["x", "X"], ["c", "C", "©", "¢"], ["v", "V"], ["b", "B"], ["n", "N", "ñ", "Ñ"], ["m", "M", "µ"], [",", "<", "ç", "Ç"], [".", ">"], ["/", "?", "¿"], ["Shift", "Shift"]],
		[["Alt", "Alt"], [" ", " ", " ", " "], ["Alt", "Alt"]]
	];

	this.VKI_layout.Farsi = [ // Farsi Keyboard
		[["پ", "َ"], ["1", "!", "¡", "¹"], ["2", "@", "²"], ["3", "#", "³"], ["4", "$", "¤", "£"], ["5", "%", "€"], ["6", "^", "¼"], ["7", "&", "½"], ["8", "*", "¾"], ["9", "(", "‘"], ["0", ")", "’"], ["-", "_", "¥"], ["=", "+", "×", "÷"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["ض", "\u064e"], ["ص", "\u064b"], ["ث", "\u064f"], ["ق", "\u064c"], ["ف", "\u0644"], ["غ", "\u0625"], ["ع", "\u2018"], ["ه", "\u00f7"], ["خ", "\u00d7"], ["ح", "\u061b"], ["ج", "\u003c"], ["چ", "\u003e"], ["ژ", "\u007c"]],
		[["Caps", "Caps"], ["ش", "\u0650"], ["س", "\u064d"], ["ي", "\u005d"], ["ب", "\u005b"], ["ل", "\u0644"], ["ا", "\u0623"], ["ت", "\u0640"], ["ن", "\u060c"], ["م", "\u005c"], ["گ", ":"], ["ك", "\u0022"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["ئ", "~"], ["ء", "\u0652"], ["ز", "}"], ["ر", "{"], ["ذ", "ل"], ["د", "آ"], ["ئ", "ء"], ["و", ","], [".", "."], ["/", "؟"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["Alt", "Alt"]]
	];

	this.VKI_layout.Finnish = [ // Finnish Keyboard
		[["§", "½"], ["1", "!"], ["2", '"', "@"], ["3", "#", "£"], ["4", "¤", "$"], ["5", "%", "€"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?", "\\"], ["´", "`"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["å", "Å"], ["¨", "^", "~"], ["'", "*", "½"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S", "š"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ö", "Ö"], ["ä", "Ä", "^"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["z", "Z", "|"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "µ"], [",", ";"], [".", ":"], ["-", "_", "©"], ["Shift", "Shift"]],
		[["Alt", "Alt"], [" ", " ", " ", " "], ["Alt", "Alt"]]
	];

	this.VKI_layout.French = [ // French Standard Keyboard
		[["²", "³"], ["&", "1"], ["é", "2", "~"], ['"', "3", "#"], ["'", "4", "{"], ["(", "5", "["], ["-", "6", "|"], ["è", "7", "`"], ["_", "8", "\\"], ["ç", "9", "^"], ["à", "0", "@"], [")", "°", "]"], ["=", "+", "}"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["a", "A"], ["z", "Z"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["^", "¨"], ["$", "£", "¤"], ["*", "μ"]],
		[["Caps", "Caps"], ["q", "Q"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["m", "M"], ["ù", "%"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["<", ">"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["!", "§"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.German = [ // German Standard Keyboard
		[["^", "°"], ["1", "!"], ["2", '"', "²"], ["3", "§", "³"], ["4", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["ß", "?", "\\"], ["´", "`"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q", "@"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["ü", "Ü"], ["+", "*", "~"], ["#", "'"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ö", "Ö"], ["ä", "Ä"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["<", ">", "¦"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "µ"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Greek = [ // Greek Standard Keyboard
		[["`", "~"], ["1", "!"], ["2", "@", "²"], ["3", "#", "³"], ["4", "$", "£"], ["5", "%", "§"], ["6", "^", "¶"], ["7", "&"], ["8", "*", "¤"], ["9", "(", "¦"], ["0", ")", "º"], ["-", "_", "±"], ["=", "+", "½"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], [";", ":"], ["ς", "^"], ["ε", "Ε"], ["ρ", "Ρ"], ["τ", "Τ"], ["υ", "Υ"], ["θ", "Θ"], ["ι", "Ι"], ["ο", "Ο"], ["π", "Π"], ["[", "{", "“"], ["]", "}", "”"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["α", "Α"], ["σ", "Σ"], ["δ", "Δ"], ["φ", "Φ"], ["γ", "Γ"], ["η", "Η"], ["ξ", "Ξ"], ["κ", "Κ"], ["λ", "Λ"], ["΄", "¨", "΅"], ["'", '"'], ["\\", "|", "¬"]],
		[["Shift", "Shift"], ["<", ">"], ["ζ", "Ζ"], ["χ", "Χ"], ["ψ", "Ψ"], ["ω", "Ω"], ["β", "Β"], ["ν", "Ν"], ["μ", "Μ"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Hebrew = [ // Hebrew Standard Keyboard
		[["~", "`"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$", "₪"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", ")"], ["0", "("], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["/", "Q"], ["'", "W"], ["ק", "E", "€"], ["ר", "R"], ["א", "T"], ["ט", "Y"], ["ו", "U", "װ"], ["ן", "I"], ["ם", "O"], ["פ", "P"], ["]", "}"], ["[", "{"]],
		[["Caps", "Caps"], ["ש", "A"], ["ד", "S"], ["ג", "D"], ["כ", "F"], ["ע", "G"], ["י", "H", "ײ"], ["ח", "J", "ױ"], ["ל", "K"], ["ך", "L"], ["ף", ":"], [",", '"'], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["ז", "Z"], ["ס", "X"], ["ב", "C"], ["ה", "V"], ["נ", "B"], ["מ", "N"], ["צ", "M"], ["ת", ">"], ["ץ", "<"], [".", "?"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Hungarian = [ // Hungarian Standard Keyboard
		[["0", "§"], ["1", "'", "~"], ["2", '"', "ˇ"], ["3", "+", "ˆ"], ["4", "!", "˘"], ["5", "%", "°"], ["6", "/", "˛"], ["7", "=", "`"], ["8", "(", "˙"], ["9", ")", "´"], ["ö", "Ö", "˝"], ["ü", "Ü", "¨"], ["ó", "Ó", "¸"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q", "\\"], ["w", "W", "|"], ["e", "E", "Ä"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U", "€"], ["i", "I", "Í"], ["o", "O"], ["p", "P"], ["ő", "Ő", "÷"], ["ú", "Ú", "×"], ["ű", "Ű", "¤"]],
		[["Caps", "Caps"], ["a", "A", "ä"], ["s", "S", "đ"], ["d", "D", "Đ"], ["f", "F", "["], ["g", "G", "]"], ["h", "H"], ["j", "J","í"], ["k", "K", "Ł"], ["l", "L", "ł"], ["é", "É","$"], ["á", "Á", "ß"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["í", "Í","<"], ["y", "Y", ">"], ["x", "X","#"], ["c", "C", "&"], ["v", "V","@"], ["b", "B","{"], ["n", "N","}"], ["m", "M","<"], [",", "?",";"], [".", ":", ">"], ["-", "_","*"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Italian = [ // Italian Standard Keyboard
		[["\\", "|"], ["1", "!"], ["2", '"'], ["3", "£"], ["4", "$", "€"], ["5", "%"], ["6", "&"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["ì", "^"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["è", "é", "[", "{"], ["+", "*", "]", "}"], ["ù", "§"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ò", "ç", "@"], ["à", "°", "#"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Korean = [ // Korean Standard Keyboard
		[["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$", "€"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", ")"], ["0", "("], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["ᄇ", "ᄈ"], ["ᄌ", "ᄍ"], ["ᄃ", "ᄄ"], ["ᄀ", "ᄁ"], ["ᄉ", "ᄊ"], ["ᅭ"], ["ᅧ"], ["ᅣ"], ["ᅢ", "ᅤ"], ["ᅦ", "ᅨ"], ["[", "{"], ["]", "}"], ["\\", "|"]],
		[["Caps", "Caps"], ["ᄆ"], ["ᄂ"], ["ᄋ"], ["ᄅ"], ["ᄒ"], ["ᅩ"], ["ᅥ"], ["ᅡ"], ["ᅵ"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
		[["Shift", "Shift"], [""], ["ᄏ"], ["ᄐ"], ["ᄎ"], ["ᄑ"], ["ᅲ"], ["ᅮ"], ["ᅳ"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
		[[" ", " "]]
	];

	this.VKI_layout.Latvian = [ // Latvian Keyboard
		[["", "?"], ["1", "!", "«"], ["2", "«", "", "@"], ["3", "»", "", "#"], ["4", "$", "€", "$"], ["5", "%", '"', "~"], ["6", "/", "’", "^"], ["7", "&", "", "±"], ["8", "×", ":"], ["9", "("], ["0", ")"], ["-", "_", "–", "—"], ["f", "F", "=", ";"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["ū", "Ū", "q", "Q"], ["g", "G", "ģ", "Ģ"], ["j", "J", "€"], ["r", "R", "ŗ", "Ŗ"], ["m", "M", "w", "W"], ["v", "V", "y", "Y"], ["n", "N"], ["z", "Z"], ["ē", "Ē"], ["č", "Č"], ["ž", "Ž", "[", "{"], ["h", "H", "]", "}"], ["ķ", "Ķ"]],
		[["Caps", "Caps"], ["š", "Š"], ["u", "U"], ["s", "S"], ["i", "I"], ["l", "L"], ["d", "D"], ["a", "A"], ["t", "T"], ["e", "E", "€"], ["c", "C"], ["´", "´", "´", "¨"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["", ""], ["ņ", "Ņ"], ["b", "B", "x", "X"], ["ī", "Ī"], ["k", "K", "ķ", "Ķ"], ["p", "P"], ["o", "O", "õ", "Õ"], ["ā", "Ā"], [",", ","], [".", "."], ["ļ", "Ļ", "©"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Lithuanian = [ // Lithuanian Standard Keyboard
		[["`", "~"], ["ą", "Ą"], ["č", "Č"], ["ę", "Ę"], ["ė", "Ė"], ["į", "Į"], ["š", "Š"], ["ų", "Ų"], ["ū", "Ū"], ["„", "("], ["“", ")"], ["-", "_"], ["ž", "Ž"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["[", "{"], ["]", "}"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], [";", ":"], ["'", '"'], ["\\", "|"]],
		[["Shift", "Shift"], ["–", "€"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
		[[" ", " "]]
	];

	this.VKI_layout.Norwegian = [ // Norwegian Standard Keyboard
		[["|", "§"], ["1", "!"], ["2", '"', "@"], ["3", "#", "£"], ["4", "¤", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?"], ["\\", "`", "´"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["å", "Å"], ["¨", "^", "~"], ["'", "*"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ø", "Ø"], ["æ", "Æ"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "μ", "Μ"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Polish = [ // Polish Keyboard
		[["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "ę", "Ę"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O", "ó", "Ó"], ["p", "P"], ["[", "{"], ["]", "}"], ["\\", "|"]],
		[["Caps", "Caps"], ["a", "A", "ą", "Ą"], ["s", "S", "ś", "Ś"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "ł", "Ł"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["z", "Z", "ż", "Ż"], ["x", "X", "ź", "Ź"], ["c", "C", "ć", "Ć"], ["v", "V"], ["b", "B"], ["n", "N", "ń", "Ń"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["Alt", "Alt"]]
	];

	this.VKI_layout.Portuguese = [ // Portuguese Standard Keyboard
		[["`", "¬", "¦"], ["1", "!"], ["2", '"'], ["3", "£"], ["4", "$", "€"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "é", "É"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U", "ú", "Ú"], ["i", "I", "í", "Í"], ["o", "O", "ó", "Ó"], ["p", "P"], ["[", "{"], ["]", "}"], ["#", "~"]],
		[["Caps", "Caps"], ["a", "A", "á", "Á"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ç", "Ç"], [";", ":"], ["'", "@"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Romanian = [ // Romanian Standard Keyboard
		[["„", "”", "`", "~"], ["1", "!", "~"], ["2", "@", "ˇ"], ["3", "#", "^"], ["4", "$", "˘"], ["5", "%", "°"], ["6", "^", "˛"], ["7", "&", "`"], ["8", "*", "˙"], ["9", "(", "´"], ["0", ")", "˝"], ["-", "_", "¨"], ["=", "+", "¸", "±"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P", "§"], ["ă", "Ă", "[", "{"], ["î", "Î", "]","}"], ["â", "Â", "\\", "|"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S", "ß"], ["d", "D", "ð", "Ð"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "ł", "Ł"], [(this.VKI_isIElt8) ? "\u015F" : "\u0219", (this.VKI_isIElt8) ? "\u015E" : "\u0218", ";", ":"], [(this.VKI_isIElt8) ? "\u0163" : "\u021B", (this.VKI_isIElt8) ? "\u0162" : "\u021A", "\'", "\""], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C", "©"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";", "<", "«"], [".", ":", ">", "»"], ["/", "?"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Russian = [ // Russian Standard Keyboard
		[["ё", "Ё"], ["1", "!"], ["2", '"'], ["3", "№"], ["4", ";"], ["5", "%"], ["6", ":"], ["7", "?"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["й", "Й"], ["ц", "Ц"], ["у", "У"], ["к", "К"], ["е", "Е"], ["н", "Н"], ["г", "Г"], ["ш", "Ш"], ["щ", "Щ"], ["з", "З"], ["х", "Х"], ["ъ", "Ъ"], ["\\", "/"]],
		[["Caps", "Caps"], ["ф", "Ф"], ["ы", "Ы"], ["в", "В"], ["а", "А"], ["п", "П"], ["р", "Р"], ["о", "О"], ["л", "Л"], ["д", "Д"], ["ж", "Ж"], ["э", "Э"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["/", "|"], ["я", "Я"], ["ч", "Ч"], ["с", "С"], ["м", "М"], ["и", "И"], ["т", "Т"], ["ь", "Ь"], ["б", "Б"], ["ю", "Ю"], [".", ","], ["Shift", "Shift"]],
		[[" ", " "]]
	];

	this.VKI_layout.SerbianCyr = [ // Serbian Cyr Standard Keyboard
		[["`", "~"], ["1", "!"], ["2", '"'], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "&"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["+", "*"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["љ", "Љ"], ["њ", "Њ"], ["е", "Е", "€"], ["р", "Р"], ["т", "Т"], ["з", "З"], ["у", "У"], ["и", "И"], ["о", "О"], ["п", "П"], ["ш", "Ш"], ["ђ", "Ђ"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["а", "А"], ["с", "С"], ["д", "Д"], ["ф", "Ф"], ["г", "Г"], ["х", "Х"], ["ј", "Ј"], ["к", "К"], ["л", "Л"], ["ч", "Ч"], ["ћ", "Ћ"], ["ж", "Ж"]],
		[["Shift", "Shift"], ["<", ">"], ["ѕ", "Ѕ"], ["џ", "Џ"], ["ц", "Ц"], ["в", "В"], ["б", "Б"], ["н", "Н"], ["м", "М"], [",", ";", "<"], [".", ":", ">"], ["-", "_", "©"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.SerbianLat = [ // Serbian Lat Standard Keyboard
		[["`", "~"], ["1", "!", "~"], ["2", '"', "ˇ"], ["3", "#", "^"], ["4", "$", "˘"], ["5", "%", "°"], ["6", "&", "˛"], ["7", "/", "`"], ["8", "(", "·"], ["9", ")", "´"], ["0", "=", '″'], ["'", "?", "¨"], ["+", "*", "¸"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q", "\\"], ["w", "W","|"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["š", "Š", "÷"], ["đ", "Đ", "×"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F", "["], ["g", "G", "]"], ["h", "H"], ["j", "J"], ["k", "K", "ł"], ["l", "L", "Ł"], ["č", "Č"], ["ć", "Ć", "ß"], ["ž", "Ž", "¤"]],
		[["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{",], ["n", "N", "}"], ["m", "M", "§"], [",", ";", "<"], [".", ":", ">"], ["-", "_", "©"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Slovak = [ // Slovak Keyboard
		[[";", "°"], ["+", "1", "~"], ["ľ", "2", "ˇ"], ["š", "3", "^"], ["č", "4", "˘"], ["ť", "5", "°"], ["ž", "6", "˛"], ["ý", "7", "`"], ["á", "8", "˙"], ["í", "9", "´"], ["é", "0", "˝"], ["=", "%", "¨"], ["´", "ˇ", "¸"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q","\\"], ["w", "W","|"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P","'"], ["ú", "/", "÷"], ["ä", "(", "×"], ["ň", ")","¤"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S","đ"], ["d", "D","Đ"], ["f", "F","["], ["g", "G","]"], ["h", "H"], ["j", "J"], ["k", "K","ł"], ["l", "L","Ł"], ["ô", '"', "$"], ["§", "!", "ß",], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["&", "*", "<"], ["y", "Y",">"], ["x", "X","#"], ["c", "C","&"], ["v", "V","@"], ["b", "B","{"], ["n", "N","}"], ["m", "M"], [",", "?", "<"], [".", ":", ">"], ["-", "_", "*"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Slovenian = [ // Slovenian Standard Keyboard
		[["¨", "¨", "¸"], ["1", "!", "~"], ["2", '"', "ˇ"], ["3", "#", "^"], ["4", "$", "˘"], ["5", "%", "°"], ["6", "&", "˛"], ["7", "/", "`"], ["8", "(", "·"], ["9", ")", "´"], ["0", "=", '″'], ["'", "?", "¨"], ["+", "*", "¸"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q", "\\"], ["w", "W","|"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["š", "Š", "÷"], ["đ", "Đ", "×"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F", "["], ["g", "G", "]"], ["h", "H"], ["j", "J"], ["k", "K", "ł"], ["l", "L", "Ł"], ["č", "Č"], ["ć", "Ć", "ß"], ["ž", "Ž", "¤"]],
		[["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{",], ["n", "N", "}"], ["m", "M", "§"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout["Spanish-SP"] = [ // Spanish (Spain) Standard Keyboard
		[["º", "ª", "\\"], ["1", "!", "|"], ["2", '"', "@"], ["3", "'", "#"], ["4", "$", "~"], ["5", "%", "€"], ["6", "&","¬"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["¡", "¿"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["`", "^", "["], ["+", "*", "]"], ["ç", "Ç", "}"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ñ", "Ñ"], ["´", "¨", "{"], ["Enter", "Enter"]],
		[["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout.Swedish = [ // Swedish Standard Keyboard
		[["§", "½"], ["1", "!"], ["2", '"', "@"], ["3", "#", "£"], ["4", "¤", "$"], ["5", "%", "€"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?", "\\"], ["´", "`"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["å", "Å"], ["¨", "^", "~"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ö", "Ö"], ["ä", "Ä"], ["'", "*"]],
		[["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "μ", "Μ"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout["Turkish-F"] = [ // Turkish F Keyboard Layout
		[['+', "*", "¬"], ["1", "!", "¹", "¡"], ["2", '"', "²"], ["3", "^", "#", "³"], ["4", "$", "¼", "¤"], ["5", "%", "½"], ["6", "&", "¾"], ["7", "'", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["/", "?", "\\", "¿"], ["-", "_", "|"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["f", "F", "@"], ["g", "G"], ["ğ", "Ğ"], ["ı", "I", "¶", "®"], ["o", "O"], ["d", "D", "¥"], ["r", "R"], ["n", "N"], ["h", "H", "ø", "Ø"], ["p", "P", "£"], ["q", "Q", "¨"], ["w", "W", "~"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["u", "U", "æ", "Æ"], ["i", "İ", "ß", "§"], ["e", "E", "€"], ["a", "A", " ", "ª"], ["ü", "Ü"], ["t", "T"], ["k", "K"], ["m", "M"], ["l", "L"], ["y", "Y", "´"], ["ş", "Ş"], ["x", "X", "`"]],
		[["Shift", "Shift"], ["<", ">", "|", "¦"], ["j", "J", "«", "<"], ["ö", "Ö", "»", ">"], ["v", "V", "¢", "©"], ["c", "C"], ["ç", "Ç"], ["z", "Z"], ["s", "S", "µ", "º"], ["b", "B", "×"], [".", ":", "÷"], [",", ";", "-"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
	];

	this.VKI_layout["Turkish-Q"] = [ // Turkish Q Keyboard Layout
		[['"', "é", "<"], ["1", "!", ">"], ["2", "'", "£"], ["3", "^", "#"], ["4", "+", "$"], ["5", "%", "½"], ["6", "&"], ["7", "/", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["*", "?", "\\"], ["-", "_", "|"], ["Bksp", "Bksp"]],
		[["Tab", "Tab"], ["q", "Q", "@"], ["w", "W"], ["e", "E", "€"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["ı", "I", "i", "İ"], ["o", "O"], ["p", "P"], ["ğ", "Ğ", "i"], ["ü", "Ü", "~"], ["Enter", "Enter"]],
		[["Caps", "Caps"], ["a", "A", "æ", "Æ"], ["s", "S", "ß"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["ş", "Ş", "´"], ["i", "İ"], [",", ";", "`"]],
		[["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], ["ö", "Ö"], ["ç", "Ç"], [".", ":"], ["Shift", "Shift"]],
		[[" ", " ", " ", " "],  ["AltGr", "AltGr"]]
	];


	/* ***** Define Dead Keys ************************************** */
	this.VKI_deadkey = {};

	// - Lay out each dead key set in one row of sub-arrays.  The rows
	//   below are wrapped so uppercase letters are below their
	//   lowercase equivalents.
	//
	// - The first letter in each sub-array is the letter pressed after
	//   the diacritic.  The second letter is the letter this key-combo
	//   will generate.
	//
	// - Note that if you have created a new keyboard layout and want
	//   it included in the distributed script, PLEASE TELL ME if you
	//   have added additional dead keys to the ones below.

	this.VKI_deadkey['"'] = this.VKI_deadkey['\u00a8'] = [ // Umlaut / Diaeresis / Greek Dialytika
		["a", "ä"], ["e", "ë"], ["i", "ï"], ["o", "ö"], ["u", "ü"], ["y", "ÿ"], ["\u03b9", "\u03ca"], ["\u03c5", "\u03cb"],
		["A", "Ä"], ["E", "Ë"], ["I", "Ï"], ["O", "Ö"], ["U", "Ü"], ["Y", "Ÿ"], ["\u0399", "\u03aa"], ["\u03a5", "\u03ab"]
	];
	this.VKI_deadkey['~'] = [ // Tilde
		["a", "ã"], ["o", "õ"], ["n", "ñ"],
		["A", "Ã"], ["O", "Õ"], ["N", "Ñ"]
	];
	this.VKI_deadkey['^'] = [ // Circumflex
		["a", "â"], ["e", "ê"], ["i", "î"], ["o", "ô"], ["u", "û"], ["w", "ŵ"], ["y", "ŷ"],
		["A", "Â"], ["E", "Ê"], ["I", "Î"], ["O", "Ô"], ["U", "Û"], ["W", "Ŵ "], ["Y", "Ŷ"]
	];
	this.VKI_deadkey['ˇ'] = [ // Baltic caron
		["c", "č"], ["s", "š"], ["z", "ž"], ["r", "ř"], ["d", "ď"], ["t", "ť"], ["n", "ň"], ["l", "ľ"], ["e", "ě"],
		["C", "Č"], ["S", "Š"], ["Z", "Ž"], ["R", "Ř"], ["D", "Ď"], ["T", "Ť"], ["N", "Ň"], ["L", "Ľ"], ["E", "Ě"]
	];
	this.VKI_deadkey['˘'] = [ // Romanian and Turkish breve
		["a", "ă"], ["g", "ğ"],
		["A", "Ă"], ["G", "Ğ"]
	];
	this.VKI_deadkey['`'] = [ // Grave
		["a", "à"], ["e", "è"], ["i", "ì"], ["o", "ò"], ["u", "ù"],
		["A", "À"], ["E", "È"], ["I", "Ì"], ["O", "Ò"], ["U", "Ù"]
	];
	this.VKI_deadkey["'"] = this.VKI_deadkey['\u00b4'] = this.VKI_deadkey['\u0384'] = [ // Acute / Greek Tonos
		["a", "á"], ["e", "é"], ["i", "í"], ["o", "ó"], ["u", "ú"], ["y", "ý"], ["\u03b1", "\u03ac"], ["\u03b5", "\u03ad"], ["\u03b7", "\u03ae"], ["\u03b9", "\u03af"], ["\u03bf", "\u03cc"], ["\u03c5", "\u03cd"], ["\u03c9", "\u03ce"],
		["A", "Á"], ["E", "É"], ["I", "Í"], ["O", "Ó"], ["U", "Ú"], ["Y", "Ý"], ["\u0391", "\u0386"], ["\u0395", "\u0388"], ["\u0397", "\u0389"], ["\u0399", "\u038a"], ["\u039f", "\u038c"], ["\u03a5", "\u038e"], ["\u03a9", "\u038f"]
	];
	this.VKI_deadkey['˝'] = [ // Hungarian Double Acute Accent
		["o", "ő"], ["u", "ű"],
		["O", "Ő"], ["U", "Ű"]
	];
	this.VKI_deadkey['\u0385'] = [ // Greek Dialytika + Tonos
		["\u03b9", "\u0390"], ["\u03c5", "\u03b0"]
	];
	this.VKI_deadkey['\u00b0'] = this.VKI_deadkey['\u00ba'] = [ // Ring
		["a", "å"], ["u", "ů"],
		["A", "Å"], ["U", "Ů"]
	];
	this.VKI_deadkey['˛'] = [ // Ogonek
		["a", "\u0106"], ["e", "ę"], ["i", "į"], ["o", "\u01eb"], ["u", "ų"], ["y", "\u0177"],
		["A", "\u0105"], ["E", "Ę"], ["I", "Į"], ["O", "\u01ea"], ["U", "Ų"], ["Y", "\u0176"]
	];
	this.VKI_deadkey['˙'] = [ // Dot-above
		["c", "ċ"], ["e", "ė"], ["g", "ġ"], ["z", "ż"],
		["C", "Ċ"], ["E", "Ė"], ["G", "Ġ"], ["Z", "Ż"]
	];
	this.VKI_deadkey['\u00B8'] = [ // Cedilla
		["c", "ç"], ["s", "ş"],
		["C", "Ç"], ["S", "Ş"]
	];
	this.VKI_deadkey[','] = [ // Comma
		["s", (this.VKI_isIElt8) ? "ş" : "\u0219"], ["t", (this.VKI_isIElt8) ? "ţ" : "\u021B"],
		["S", (this.VKI_isIElt8) ? "Ş" : "\u0218"], ["T", (this.VKI_isIElt8) ? "Ţ" : "\u021A"]
	];


	/* ***** Build the keyboard interface ************************** */
	this.VKI_keyboard = document.createElement('table');
	this.VKI_keyboard.id = "keyboardInputMaster";
	this.VKI_keyboard.dir = "ltr";
	this.VKI_keyboard.cellSpacing = this.VKI_keyboard.border = "0";

	var thead = document.createElement('thead');
	var tr = document.createElement('tr');
	var th = document.createElement('th');
	var kblist = document.createElement('select');

	for (ktype in this.VKI_layout)
	{
		if (typeof this.VKI_layout[ktype] == "object")
		{
			var opt = document.createElement('option');
			opt.value = ktype;
			opt.appendChild(document.createTextNode(ktype));

			kblist.appendChild(opt);
		}
	}

	if (kblist.options.length)
	{
		kblist.value = this.VKI_kt;
		kblist.onchange = function()
		{
			self.VKI_kt = this.value;
			self.VKI_buildKeys();
			setCookie("kl", this.value, "Mon, 01-Jan-2020 00:00:00 GMT", "/");
		};
		th.appendChild(kblist);
	}

	var label = document.createElement('label');
	var checkbox = document.createElement('input');
	checkbox.type = "checkbox";
	checkbox.title = "Dead keys: " + ((this.VKI_deadkeysOn) ? "On" : "Off");
	checkbox.defaultChecked = this.VKI_deadkeysOn;
	checkbox.onclick = function()
	{
		self.VKI_deadkeysOn = this.checked;
		this.title = "Dead keys: " + ((this.checked) ? "On" : "Off");
		self.VKI_modify("");
		return true;
	};
	label.appendChild(this.VKI_deadkeysElem = checkbox);
	checkbox.checked = this.VKI_deadkeysOn;

	var label2 = document.createElement('label');
	label2.innerHTML = "Dead keys";
	label.appendChild(label2);

	th.appendChild(label);
	tr.appendChild(th);

	var td = document.createElement('td');

	var clearer = document.createElement('span');
	clearer.id = "keyboardInputClear";
	clearer.appendChild(document.createTextNode(getI18n('clear')));
	clearer.title = "Clear this input";
	clearer.onmousedown = function(){this.className = "pressed";};
	clearer.onmouseup = function(){this.className = "";};
	clearer.onclick = function()
	{
		selKeybInput.value = "";
		selKeybInput.focus();
		$.countLen();
		return false;
	};
	td.appendChild(clearer);

	tr.appendChild(td);
	thead.appendChild(tr);
	this.VKI_keyboard.appendChild(thead);

	var tbody = document.createElement('tbody');
	var tr = document.createElement('tr');
	var td = document.createElement('td');
	td.colSpan = "2";

	var div = document.createElement('div');
	div.id = "keyboardInputLayout";

	td.appendChild(div);
	tr.appendChild(td);
	tbody.appendChild(tr);
	this.VKI_keyboard.appendChild(tbody);

	if (this.VKI_isIE6)
	{
		this.VKI_iframe = document.createElement('iframe');
		this.VKI_iframe.style.position = "absolute";
		this.VKI_iframe.style.border = "0px none";
		this.VKI_iframe.style.filter = "mask()";
		this.VKI_iframe.style.zIndex = "999999";
	}


    /* ****************************************************************
     * Build or rebuild the keyboard keys
     *
     */
	this.VKI_buildKeys = function()
	{
		this.VKI_shift = this.VKI_capslock = this.VKI_alternate = this.VKI_dead = false;
		this.VKI_deadkeysOn = (this.VKI_layoutDDK[this.VKI_kt]) ? false : this.VKI_keyboard.getElementsByTagName('label')[0].getElementsByTagName('input')[0].checked;

		var container = this.VKI_keyboard.tBodies[0].getElementsByTagName('div')[0];
		while (container.firstChild) container.removeChild(container.firstChild);

		for (var x = 0, hasDeadKey = false, lyt; lyt = this.VKI_layout[this.VKI_kt][x++];)
		{
			var table = document.createElement('table');
			table.cellSpacing = table.border = "0";

			if (lyt.length <= this.VKI_keyCenter) table.className = "keyboardInputCenter";
			var tbody = document.createElement('tbody');
			var tr = document.createElement('tr');

			for (var y = 0, lkey; lkey = lyt[y++];)
			{
				var td = document.createElement('td');
				td.appendChild(document.createTextNode(lkey[0]));

				var className = [];
				if (this.VKI_deadkeysOn)
					for (key in this.VKI_deadkey)
						if (key === lkey[0]) {className.push("alive"); break;}

				if (lyt.length > this.VKI_keyCenter && y == lyt.length) className.push("last");
				if (lkey[0] == " ") className.push("space");
				td.className = className.join(" ");

				td.VKI_clickless = 0;
				if (!td.click)
				{
					td.click = function()
					{
						var evt = this.ownerDocument.createEvent('MouseEvents');  
						evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
						this.dispatchEvent(evt); 
					};
				}
				td.onmouseover = function()
				{
					if (self.VKI_clickless)
					{
						var _self = this;
						clearTimeout(this.VKI_clickless);
						this.VKI_clickless = setTimeout(function() {_self.click();}, self.VKI_clicklessDelay);
					}
					if (this.firstChild.nodeValue != "\xa0") this.className += " hover";
				};
				td.onmouseout = function()
				{
					if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
					this.className = this.className.replace(/ ?(hover|pressed)/g, "");
				};
				td.onmousedown = function()
				{
					if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
					if (this.firstChild.nodeValue != "\xa0") this.className += " pressed";
				};
				td.onmouseup = function()
				{
					if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
					this.className = this.className.replace(/ ?pressed/g, "");
				};
				td.ondblclick = function() {return false;};

				switch (lkey[1])
				{
					case "Caps":
					case "Shift":
					case "Alt":
					case "AltGr":
						td.onclick = (function(type){return function() {self.VKI_modify(type); return false;};})(lkey[1]);
						break;
					case "Tab":
						td.onclick = function(){self.VKI_insert("\t"); return false;};
						break;
					case "Bksp":
						td.onclick = function()
						{
							self.VKI_target = selKeybInput;
							self.VKI_target.focus();
							if (self.VKI_target.setSelectionRange)
							{
								if (self.VKI_target.readOnly && self.VKI_isWebKit)
								{
									var rng = [self.VKI_target.selStart || 0, self.VKI_target.selEnd || 0];
								}
								else var rng = [self.VKI_target.selectionStart, self.VKI_target.selectionEnd];

								if (rng[0] < rng[1]) rng[0]++;
								self.VKI_target.value = self.VKI_target.value.substr(0, rng[0] - 1) + self.VKI_target.value.substr(rng[1]);
								self.VKI_target.setSelectionRange(rng[0] - 1, rng[0] - 1);
								if (self.VKI_target.readOnly && self.VKI_isWebKit)
								{
									var range = window.getSelection().getRangeAt(0);
									self.VKI_target.selStart = range.startOffset;
									self.VKI_target.selEnd = range.endOffset;
								}
							}
							else if (self.VKI_target.createTextRange)
							{
								try
								{
									self.VKI_target.range.select();
								}
								catch(e) {self.VKI_target.range = document.selection.createRange();}
								if (!self.VKI_target.range.text.length) self.VKI_target.range.moveStart('character', -1);
								self.VKI_target.range.text = "";
							}
							else self.VKI_target.value = self.VKI_target.value.substr(0, self.VKI_target.value.length - 1);
							if (self.VKI_shift) self.VKI_modify("Shift");
							if (self.VKI_alternate) self.VKI_modify("AltGr");
							self.VKI_target.focus();

							$.countLen();

							return true;
						};
						break;

					case "Enter":
						td.onclick = function()
						{
							$('#form').submit();
							//this.className = this.className.replace(/ ?(hover|pressed)/g, "");

							return true;
						};
						break;

					default:
						td.onclick = function()
						{
							if (self.VKI_deadkeysOn && self.VKI_dead)
							{
								if (self.VKI_dead != this.firstChild.nodeValue)
								{
									for (key in self.VKI_deadkey)
									{
										if (key == self.VKI_dead)
										{
											if (this.firstChild.nodeValue != " ")
											{
												for (var z = 0, rezzed = false, dk; dk = self.VKI_deadkey[key][z++];)
												{
													if (dk[0] == this.firstChild.nodeValue)
													{
														self.VKI_insert(dk[1]);
														rezzed = true;
														break;
													}
												}
											}
											else
											{
												self.VKI_insert(self.VKI_dead);
												rezzed = true;
											}
											break;
										}
									}
								}
								else rezzed = true;
							}
							self.VKI_dead = false;

							if (!rezzed && this.firstChild.nodeValue != "\xa0")
							{
								if (self.VKI_deadkeysOn)
								{
									for (key in self.VKI_deadkey)
									{
										if (key == this.firstChild.nodeValue)
										{
											self.VKI_dead = key;
											this.className += " dead";
											if (self.VKI_shift) self.VKI_modify("Shift");
											if (self.VKI_alternate) self.VKI_modify("AltGr");
											break;
										}
									}
									if (!self.VKI_dead) self.VKI_insert(this.firstChild.nodeValue);
								} else self.VKI_insert(this.firstChild.nodeValue);
							}

							self.VKI_modify("");
							return false;
						};
				}
				tr.appendChild(td);
				tbody.appendChild(tr);
				table.appendChild(tbody);

				for (var z = 0; z < 4; z++)
					if (this.VKI_deadkey[lkey[z] = lkey[z] || "\xa0"]) hasDeadKey = true;
			}
			container.appendChild(table);
		}
		this.VKI_deadkeysElem.style.display = (!this.VKI_layoutDDK[this.VKI_kt] && hasDeadKey) ? "inline" : "none";
	};

	this.VKI_buildKeys();
	VKI_disableSelection(this.VKI_keyboard);


	/* ****************************************************************
	 * Controls modifier keys
	 *
	 */
	this.VKI_modify = function(type)
	{
		switch (type)
		{
			case "Alt":
			case "AltGr": this.VKI_alternate = !this.VKI_alternate; break;
			case "Caps": this.VKI_capslock = !this.VKI_capslock; break;
			case "Shift": this.VKI_shift = !this.VKI_shift; break;
		}

		var vchar = 0;
		if (!this.VKI_shift != !this.VKI_capslock) vchar += 1;

		var tables = this.VKI_keyboard.getElementsByTagName('table');
		for (var x = 0; x < tables.length; x++)
		{
			var tds = tables[x].getElementsByTagName('td');
			for (var y = 0; y < tds.length; y++)
			{
				var className = [];
				var lkey = this.VKI_layout[this.VKI_kt][x][y];

				if (tds[y].className.indexOf('hover') > -1) className.push("hover");

				switch (lkey[1])
				{
					case "Alt":
					case "AltGr":
						if (this.VKI_alternate) className.push("dead");
						break;
					case "Shift":
						if (this.VKI_shift) className.push("dead");
						break;
					case "Caps":
						if (this.VKI_capslock) className.push("dead");
						break;
					case "Tab": case "Enter": case "Bksp": break;
					default:
						if (type) tds[y].firstChild.nodeValue = lkey[vchar + ((this.VKI_alternate && lkey.length == 4) ? 2 : 0)];

						if (this.VKI_deadkeysOn)
						{
							var char = tds[y].firstChild.nodeValue;
							if (this.VKI_dead)
							{
								if (char == this.VKI_dead) className.push("dead");
								for (var z = 0; z < this.VKI_deadkey[this.VKI_dead].length; z++)
								{
									if (char == this.VKI_deadkey[this.VKI_dead][z][0])
									{
										className.push("target");
										break;
									}
								}
							}
							for (key in this.VKI_deadkey)
								if (key === char){className.push("alive"); break;}
						}
				}

				if (y == tds.length - 1 && tds.length > this.VKI_keyCenter) className.push("last");
				if (lkey[0] == " ") className.push("space");
				tds[y].className = className.join(" ");
			}
		}
	};


	/* ****************************************************************
	 * Insert text at the cursor
	 *
	 */
	this.VKI_insert = function(text)
	{
		if (selKeybInput == undefined) return false;

		if (this.VKI_isIE)
		{
			selKeybInput.onclick = selKeybInput.onselect = selKeybInput.onkeyup = function(e)
			{
				if ((e || event).type != "keyup" || !this.readOnly) this.range = document.selection.createRange();
			};
		}

		this.VKI_target = selKeybInput;
		this.VKI_target.focus();
		if (typeof this.VKI_target.maxLength == "undefined" || this.VKI_target.maxLength < 0 || this.VKI_target.value.length < this.VKI_target.maxLength)
		{
			if (this.VKI_target.setSelectionRange)
			{
				if (this.VKI_target.readOnly && this.VKI_isWebKit)
				{
					var rng = [this.VKI_target.selStart || 0, this.VKI_target.selEnd || 0];
				}
				else var rng = [this.VKI_target.selectionStart, this.VKI_target.selectionEnd];

				this.VKI_target.value = this.VKI_target.value.substr(0, rng[0]) + text + this.VKI_target.value.substr(rng[1]);
				if (text == "\n" && window.opera) rng[0]++;
				this.VKI_target.setSelectionRange(rng[0] + text.length, rng[0] + text.length);

				if (this.VKI_target.readOnly && this.VKI_isWebKit)
				{
					var range = window.getSelection().getRangeAt(0);
					this.VKI_target.selStart = range.startOffset;
					this.VKI_target.selEnd = range.endOffset;
				}
			}
			else if (this.VKI_target.createTextRange)
			{
				try
				{
					this.VKI_target.range.select();
				}
				catch(e)
				{
					this.VKI_target.range = document.selection.createRange();
				}

				this.VKI_target.range.text = text;
				this.VKI_target.range.collapse(true);
				this.VKI_target.range.select();
			}
			else this.VKI_target.value += text;

			$.countLen();

			if (this.VKI_shift) this.VKI_modify("Shift");
			if (this.VKI_alternate) this.VKI_modify("AltGr");
			this.VKI_target.focus();
		}
		else if (this.VKI_target.createTextRange) this.VKI_target.range.select();
	};


	/* ****************************************************************
	 * Show the keyboard interface
	 *
	 */

	document.getElementById('keyboard').appendChild(this.VKI_keyboard);
};

function VKI_disableSelection(elem)
{
	elem.onselectstart = function(){return false;};
	elem.unselectable = "on";
	elem.style.MozUserSelect = "none";
	elem.style.cursor = "default";
	if (window.opera) elem.onmousedown = function(){return false;};
}


/* ***** Attach this script to the onload event ****************** */
if (window.addEventListener) window.addEventListener('load', VKI_buildKeyboardInputs, false); 
else if (window.attachEvent) window.attachEvent('onload', VKI_buildKeyboardInputs);


function setCookie(name, value, expires, path, domain, secure)
{
	document.cookie = name + "=" + escape(value) +
		((expires) ? "; expires=" + expires : "") +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		((secure) ? "; secure" : "");
}

function getCookie(name)
{
	var cookie = " " + document.cookie;
	var search = " " + name + "=";
	var setStr = null;
	var offset = 0;
	var end = 0;
	if (cookie.length > 0)
	{
		offset = cookie.indexOf(search);
		if (offset != -1)
		{
			offset += search.length;
			end = cookie.indexOf(";", offset)
			if (end == -1) end = cookie.length;
			setStr = unescape(cookie.substring(offset, end));
		}
	}
	return setStr;
}
