Subversion Repositories wimsdev

Rev

Rev 1220 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /* ********************************************************************
  2.  **********************************************************************
  3.  * HTML Virtual Keyboard Interface Script - v1.22
  4.  *   Copyright (c) 2009 - GreyWyvern
  5.  *
  6.  *  - Licenced for free distribution under the BSDL
  7.  *          http://www.opensource.org/licenses/bsd-license.php
  8.  *
  9.  * Add a script-driven keyboard interface to text fields, password
  10.  * fields and textareas.
  11.  *
  12.  * See http://www.greywyvern.com/code/javascript/keyboard for examples
  13.  * and usage instructions.
  14.  *
  15.  * Version 1.22 - March 30, 2009
  16.  *   - Added support for max-length on inputs (Olivier Désormeaux)
  17.  *   - Downgrade comma-below forms of S and T to cedilla for IE < 8
  18.  *   - Change exposed attachment function name to VKI_attach
  19.  *   - Exposed keyboard close function as VKI_close
  20.  *   - No longer expose any functions in the userscript version
  21.  *
  22.  *   See full changelog at:
  23.  *     http://www.greywyvern.com/code/javascript/keyboard.changelog.txt
  24.  *
  25.  * Keyboard Credits
  26.  *   - Swedish keyboard layout by Håkan Sandberg
  27.  *   - Romanian keyboard layout by Aurel
  28.  *   - Farsi (Persian) keyboard layout by Kaveh Bakhtiyari (www.bakhtiyari.com)
  29.  *   - Burmese keyboard layout by Cetanapa
  30.  *   - Slovenian keyboard layout by Miran Zeljko
  31.  *   - Hungarian keyboard layout by Antal Sall 'Hiromacu'
  32.  *   - Arabic keyboard layout by Srinivas Reddy
  33.  *   - Italian and Spanish (Spain) keyboard layouts by dictionarist.com
  34.  *   - Lithuanian and Russian keyboard layouts by Ramunas
  35.  *   - German keyboard layout by QuHno
  36.  *   - French keyboard layout by Hidden Evil
  37.  *   - Polish Programmers layout by moose
  38.  *   - Turkish keyboard layouts by offcu
  39.  *   - Dutch and US Int'l keyboard layouts by jerone
  40.  *   - Portuguese keyboard layout by clisboa
  41.  *
  42.  */
  43. var VKI_attach, VKI_close;
  44.   function VKI_buildKeyboardInputs() {
  45.     var self = this;
  46.  
  47.     this.VKI_version = "1.22";
  48.     this.VKI_target = this.VKI_visible = false;
  49.     this.VKI_shift = this.VKI_capslock = this.VKI_alternate = this.VKI_dead = false;
  50.     this.VKI_deadkeysOn = false;
  51.     this.VKI_kt = "French";  // Default keyboard layout
  52.     this.VKI_clearPasswords = false;  // Clear password fields on focus
  53.     this.VKI_showVersion = true;
  54.     this.VKI_clickless = false;
  55.     this.VKI_clicklessDelay = 500;
  56.     this.VKI_keyCenter = 3;
  57.  
  58.     this.VKI_isIE = /*@cc_on!@*/false;
  59.     this.VKI_isIE6 = /*@if(@_jscript_version == 5.6)!@end@*/false;
  60.     this.VKI_isIElt8 = /*@if(@_jscript_version < 5.8)!@end@*/false;
  61.     this.VKI_isMoz = (navigator.product == "Gecko");
  62.     this.VKI_isWebKit = RegExp("KHTML").test(navigator.userAgent);
  63.  
  64.  
  65.     /* ***** Create keyboards ************************************** */
  66.     this.VKI_layout = {};
  67.     this.VKI_layoutDDK = {};
  68.  
  69.     // - Lay out each keyboard in rows of sub-arrays.  Each sub-array
  70.     //   represents one key.
  71.     //
  72.     // - Each sub-array consists of four slots described as follows:
  73.     //     example: ["a", "A", "\u00e1", "\u00c1"]
  74.     //
  75.     //          a) Normal character
  76.     //          A) Character + Shift or Caps
  77.     //     \u00e1) Character + Alt or AltGr
  78.     //     \u00c1) Character + Shift or Caps + Alt or AltGr
  79.     //
  80.     //   You may include sub-arrays which are fewer than four slots.
  81.     //   In these cases, the missing slots will be blanked when the
  82.     //   corresponding modifier key (Shift or AltGr) is pressed.
  83.     //
  84.     // - If the second slot of a sub-array matches one of the following
  85.     //   strings:
  86.     //       "Tab", "Caps", "Shift", "Enter", "Bksp", "Alt" OR "AltGr"
  87.     //   then the function of the key will be the following,
  88.     //   respectively:
  89.     //     - Insert a tab
  90.     //     - Toggle Caps Lock (technically a Shift Lock)
  91.     //     - Next entered character will be the shifted character
  92.     //     - Insert a newline (textarea), or close the keyboard
  93.     //     - Delete the previous character
  94.     //     - Next entered character will be the alternate character
  95.     //
  96.     //   The first slot of this sub-array will be the text to display
  97.     //   on the corresponding key.  This allows for easy localisation
  98.     //   of key names.
  99.     //
  100.     // - Layout dead keys (diacritic + letter) should be added as
  101.     //   arrays of two item arrays with hash keys equal to the
  102.     //   diacritic.  See the "this.VKI_deadkey" object below the layout
  103.     //   definitions.  In  each two item child array, the second item
  104.     //   is what the diacritic would change the first item to.
  105.     //
  106.     // - To disable dead keys for a layout, simply assign true to the
  107.     //   this.VKI_layoutDDK (DDK = disable dead keys) object of the
  108.     //   same name as the layout.  See the Numpad layout below for an
  109.     //   example.
  110.     //
  111.     // - Note that any characters beyond the normal ASCII set should be
  112.     //   entered in escaped Unicode format.  (eg \u00a3 = Pound symbol)
  113.     //   You can find Unicode values for characters here:
  114.     //     http://unicode.org/charts/
  115.     //
  116.     // - To remove a keyboard, just delete it, or comment it out of the
  117.     //   source code
  118.  
  119.     this.VKI_layout.Arabic = [ // Arabic Keyboard
  120.       [["\u0630", "\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"]],
  121.       [["Tab", "Tab"], ["\u0636", "\u064e"], ["\u0635", "\u064b"], ["\u062b", "\u064f"], ["\u0642", "\u064c"], ["\u0641", "\u0644"], ["\u063a", "\u0625"], ["\u0639", "\u2018"], ["\u0647", "\u00f7"], ["\u062e", "\u00d7"], ["\u062d", "\u061b"], ["\u062c", "\u003c"], ["\u062f", "\u003e"], ["\u005c", "\u007c"]],
  122.       [["Caps", "Caps"], ["\u0634", "\u0650"], ["\u0633", "\u064d"], ["\u064a", "\u005d"], ["\u0628", "\u005b"], ["\u0644", "\u0644"], ["\u0627", "\u0623"], ["\u062a", "\u0640"], ["\u0646", "\u060c"], ["\u0645", "\u002f"], ["\u0643", "\u003a"], ["\u0637", "\u0022"], ["Enter", "Enter"]],
  123.       [["Shift", "Shift"], ["\u0626", "\u007e"], ["\u0621", "\u0652"], ["\u0624", "\u007d"], ["\u0631", "\u007b"], ["\u0644", "\u0644"], ["\u0649", "\u0622"], ["\u0629", "\u2019"], ["\u0648", "\u002c"], ["\u0632", "\u002e"], ["\u0638", "\u061f"], ["Shift", "Shift"]],
  124.       [[" ", " ", " ", " "], ["Alt", "Alt"]]
  125.     ];
  126.  
  127.     this.VKI_layout.Belgian = [ // Belgian Standard Keyboard
  128.       [["\u00b2", "\u00b3"], ["&", "1", "|"], ["\u00e9", "2", "@"], ['"', "3", "#"], ["'", "4"], ["(", "5"], ["\u00a7", "6", "^"], ["\u00e8", "7"], ["!", "8"], ["\u00e7", "9", "{"], ["\u00e0", "0", "}"], [")", "\u00b0"], ["-", "_"], ["Bksp", "Bksp"]],
  129.       [["Tab", "Tab"], ["a", "A"], ["z", "Z"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u005e", "\u00a8", "["], ["$", "*", "]"], ["Enter", "Enter"]],
  130.       [["Caps", "Caps"], ["q", "Q"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["m", "M"], ["\u00f9", "%", "\u00b4"], ["\u03bc", "\u00a3", "`"]],
  131.       [["Shift", "Shift"], ["<", ">", "\\"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["=", "+", "~"], ["Shift", "Shift"]],
  132.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  133.     ];
  134.  
  135.     this.VKI_layout.Burmese = [ // Burmese Keyboard
  136.       [["\u1039`", "~"], ["\u1041", "\u100D"], ["\u1042", "\u100E"], ["\u1043", "\u100B"], ["\u1044", "\u1000\u103B\u1015\u103A"], ["\u1045", "%"], ["\u1046", "\u002F"], ["\u1047", "\u101B"], ["\u1048", "\u1002"], ["\u1049", "("], ["\u1040", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
  137.       [["Tab", "Tab"], ["\u1006", "\u1029"], ["\u1010", "\u1040"], ["\u1014", "\u103F"], ["\u1019", "\u1023"], ["\u1021", "\u1024"], ["\u1015", "\u104C"], ["\u1000", "\u1009"], ["\u1004", "\u104D"], ["\u101E", "\u1025"], ["\u1005", "\u100F"], ["\u101F", "\u1027"], ["\u2018", "\u2019"], ["\u104F", "\u100B\u1039\u100C"]],
  138.       [["Caps", "Caps"], ["\u200B\u1031", "\u1017"], ["\u200B\u103B", "\u200B\u103E"], ["\u200B\u102D", "\u200B\u102E"], ["\u200B\u103A","\u1004\u103A\u1039\u200B"], ["\u200B\u102B", "\u200B\u103D"], ["\u200B\u1037", "\u200B\u1036"], ["\u200B\u103C", "\u200B\u1032"], ["\u200B\u102F", "\u200B\u102F"], ["\u200B\u1030", "\u200B\u1030"], ["\u200B\u1038", "\u200B\u102B\u103A"], ["\u1012", "\u1013"], ["Enter", "Enter"]],
  139.       [["Shift", "Shift"], ["\u1016", "\u1007"], ["\u1011", "\u100C"], ["\u1001", "\u1003"], ["\u101C", "\u1020"], ["\u1018", "\u1026"], ["\u100A", "\u1008"], ["\u200B\u102C", "\u102A"], ["\u101A", "\u101B"], ["\u002E", "\u101B"], ["\u104B", "\u104A"], ["Shift", "Shift"]],
  140.       [[" ", " "]]
  141.     ];
  142.  
  143.     this.VKI_layout.Czech = [ // Czech Keyboard
  144.      [[";", "\u00b0", "`", "~"], ["+", "1", "!"], ["\u011B", "2", "@"], ["\u0161", "3", "#"], ["\u010D", "4", "$"], ["\u0159", "5", "%"], ["\u017E", "6", "^"], ["\u00FD", "7", "&"], ["\u00E1", "8", "*"], ["\u00ED", "9", "("], ["\u00E9", "0", ")"], ["=", "%", "-", "_"], ["\u00B4", "\u02c7", "=", "+"], ["Bksp", "Bksp"]],
  145.      [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20AC"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00FA", "/", "[", "{"], [")", "(", "]", "}"], ["Enter", "Enter"]],
  146.      [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u016F", '"', ";", ":"], ["\u00A7", "!", "\u00a4", "^"], ["\u00A8", "'", "\\", "|"]],
  147.      [["Shift", "Shift"], ["\\", "|", "", "\u02dd"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "?", "<", "\u00d7"], [".", ":", ">", "\u00f7"], ["-", "_", "/", "?"], ["Shift", "Shift"]],
  148.      [[" ", " ", " ", " "], ["Alt", "Alt"]]
  149.     ];
  150.  
  151.     this.VKI_layout.Dutch = [ // Dutch Standard Keyboard
  152.       [["@", "\u00a7", "\u00ac"], ["1", "!", "\u00b9"], ["2", '"', "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00bc"], ["5", "%", "\u00bd"], ["6", "&", "\u00be"], ["7", "_", "\u00a3"], ["8", "(", "{"], ["9", ")", "}"], ["0", "'"], ["/", "?", "\\"], ["\u00b0", "~", "\u00b8"], ["Bksp", "Bksp"]],
  153.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R", "\u00b6"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00a8", "^"], ["*", "|"], ["<", ">"]],
  154.       [["Caps", "Caps"], ["a", "A"], ["s", "S", "\u00df"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["+", "\u00b1"], ["\u00b4", "\u0060"], ["Enter", "Enter"]],
  155.       [["Shift", "Shift"], ["]", "[", "\u00a6"], ["z", "Z", "\u00ab"], ["x", "X", "\u00bb"], ["c", "C", "\u00a2"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u00b5"], [",", ";"], [".", ":", "\u00b7"], ["-", "="], ["Shift", "Shift"]],
  156.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  157.     ];
  158.  
  159.     this.VKI_layout.Dvorak = [ // Dvorak Keyboard
  160.       [["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["[", "{"], ["]", "}"], ["Bksp", "Bksp"]],
  161.       [["Tab", "Tab"],["'", '"'], [",", "<"], [".", ">"], ["p", "P"], ["y", "Y"], ["f", "F"], ["g", "G"], ["c", "C"], ["r", "R"], ["l", "L"], ["/", "?"], ["=", "+"], ["\\", "|"]],
  162.       [["Caps", "Caps"], ["a", "A"], ["o", "O"], ["e", "E"], ["u", "U"], ["i", "I"], ["d", "D"], ["h", "H"], ["t", "T"], ["n", "N"], ["s", "S"], ["-", "_"], ["Enter", "Enter"]],
  163.       [["Shift", "Shift"], [";", ":"], ["q", "Q"], ["j", "J"], ["k", "K"], ["x", "X"], ["b", "B"], ["m", "M"], ["w", "W"], ["v", "V"], ["z", "Z"], ["Shift", "Shift"]],
  164.       [[" ", " "]]
  165.     ];
  166.  
  167.     this.VKI_layout.Farsi = [ // Farsi Keyboard
  168.       [["\u067e", "\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"]],
  169.       [["Tab", "Tab"], ["\u0636", "\u064e"], ["\u0635", "\u064b"], ["\u062b", "\u064f"], ["\u0642", "\u064c"], ["\u0641", "\u0644"], ["\u063a", "\u0625"], ["\u0639", "\u2018"], ["\u0647", "\u00f7"], ["\u062e", "\u00d7"], ["\u062d", "\u061b"], ["\u062c", "\u003c"], ["\u0686", "\u003e"], ["\u0698", "\u007c"]],
  170.       [["Caps", "Caps"], ["\u0634", "\u0650"], ["\u0633", "\u064d"], ["\u064a", "\u005d"], ["\u0628", "\u005b"], ["\u0644", "\u0644"], ["\u0627", "\u0623"], ["\u062a", "\u0640"], ["\u0646", "\u060c"], ["\u0645", "\u005c"], ["\u06af", "\u003a"], ["\u0643", "\u0022"], ["Enter", "Enter"]],
  171.       [["Shift", "Shift"], ["\u0626", "\u007e"], ["\u0621", "\u0652"], ["\u0632", "\u007d"], ["\u0631", "\u007b"], ["\u0630", "\u0644"], ["\u062f", "\u0622"], ["\u0626", "\u0621"], ["\u0648", "\u002c"], [".", "\u002e"], ["/", "\u061f"], ["Shift", "Shift"]],
  172.       [[" ", " ", " ", " "], ["Alt", "Alt"]]
  173.     ];
  174.  
  175.     this.VKI_layout.French = [ // French Standard Keyboard
  176.       [["\u00b2", "\u00b3"], ["&", "1"], ["\u00e9", "2", "~"], ['"', "3", "#"], ["'", "4", "{"], ["(", "5", "["], ["-", "6", "|"], ["\u00e8", "7", "\u0060"], ["_", "8", "\\"], ["\u00e7", "9", "\u005e"], ["\u00e0", "0", "\u0040"], [")", "\u00b0", "]"], ["=", "+", "}"], ["Bksp", "Bksp"]],
  177.       [["Tab", "Tab"], ["a", "A"], ["z", "Z"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["^", "\u00a8"], ["$", "\u00a3", "\u00a4"], ["Enter", "Enter"]],
  178.       [["Caps", "Caps"], ["q", "Q"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["m", "M"], ["\u00f9", "%"], ["*", "\u03bc"]],
  179.       [["Shift", "Shift"], ["<", ">"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["!", "\u00a7"], ["Shift", "Shift"]],
  180.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  181.     ];
  182.  
  183.     this.VKI_layout.German = [ // German Standard Keyboard
  184.       [["\u005e", "\u00b0"], ["1", "!"], ["2", '"', "\u00b2"], ["3", "\u00a7", "\u00b3"], ["4", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["\u00df", "?", "\\"], ["\u00b4", "\u0060"], ["Bksp", "Bksp"]],
  185.       [["Tab", "Tab"], ["q", "Q", "\u0040"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00fc", "\u00dc"], ["+", "*", "~"], ["Enter", "Enter"]],
  186.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f6", "\u00d6"], ["\u00e4", "\u00c4"], ["#", "'"]],
  187.       [["Shift", "Shift"], ["<", ">", "\u00a6"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u00b5"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  188.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  189.     ];
  190.  
  191.     this.VKI_layout.Greek = [ // Greek Standard Keyboard
  192.       [["`", "~"], ["1", "!"], ["2", "@", "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00a3"], ["5", "%", "\u00a7"], ["6", "^", "\u00b6"], ["7", "&"], ["8", "*", "\u00a4"], ["9", "(", "\u00a6"], ["0", ")", "\u00ba"], ["-", "_", "\u00b1"], ["=", "+", "\u00bd"], ["Bksp", "Bksp"]],
  193.       [["Tab", "Tab"], [";", ":"], ["\u03c2", "^"], ["\u03b5", "\u0395"], ["\u03c1", "\u03a1"], ["\u03c4", "\u03a4"], ["\u03c5", "\u03a5"], ["\u03b8", "\u0398"], ["\u03b9", "\u0399"], ["\u03bf", "\u039f"], ["\u03c0", "\u03a0"], ["[", "{", "\u201c"], ["]", "}", "\u201d"], ["Enter", "Enter"]],
  194.       [["Caps", "Caps"], ["\u03b1", "\u0391"], ["\u03c3", "\u03a3"], ["\u03b4", "\u0394"], ["\u03c6", "\u03a6"], ["\u03b3", "\u0393"], ["\u03b7", "\u0397"], ["\u03be", "\u039e"], ["\u03ba", "\u039a"], ["\u03bb", "\u039b"], ["\u0384", "\u00a8", "\u0385"], ["'", '"'], ["\\", "|", "\u00ac"]],
  195.       [["Shift", "Shift"], ["<", ">"], ["\u03b6", "\u0396"], ["\u03c7", "\u03a7"], ["\u03c8", "\u03a8"], ["\u03c9", "\u03a9"], ["\u03b2", "\u0392"], ["\u03bd", "\u039d"], ["\u03bc", "\u039c"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
  196.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  197.     ];
  198.  
  199.     this.VKI_layout.Hebrew = [ // Hebrew Standard Keyboard
  200.       [["~", "`"], ["1", "!"], ["2", "@"], ["3", "#"], ["4" , "$", "\u20aa"], ["5" , "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", ")"], ["0", "("], ["-", "_"], ["=", "+"], ["\\", "|"], ["Bksp", "Bksp"]],
  201.       [["Tab", "Tab"], ["/", "Q"], ["'", "W"], ["\u05e7", "E", "\u20ac"], ["\u05e8", "R"], ["\u05d0", "T"], ["\u05d8", "Y"], ["\u05d5", "U", "\u05f0"], ["\u05df", "I"], ["\u05dd", "O"], ["\u05e4", "P"], ["]", "}"], ["[", "{"]],
  202.       [["Caps", "Caps"], ["\u05e9", "A"], ["\u05d3", "S"], ["\u05d2", "D"], ["\u05db", "F"], ["\u05e2", "G"], ["\u05d9", "H", "\u05f2"], ["\u05d7", "J", "\u05f1"], ["\u05dc", "K"], ["\u05da", "L"], ["\u05e3", ":"], ["," , '"'], ["Enter", "Enter"]],
  203.       [["Shift", "Shift"], ["\u05d6", "Z"], ["\u05e1", "X"], ["\u05d1", "C"], ["\u05d4", "V"], ["\u05e0", "B"], ["\u05de", "N"], ["\u05e6", "M"], ["\u05ea", ">"], ["\u05e5", "<"], [".", "?"], ["Shift", "Shift"]],
  204.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  205.     ];
  206.  
  207.     this.VKI_layout.Hungarian = [ // Hungarian Standard Keyboard
  208.       [["0", "\u00a7"], ["1", "'", "\u007e"], ["2", '"', "\u02c7"], ["3", "+", "\u02c6"], ["4", "!", "\u02d8"], ["5", "%", "\u00b0"], ["6", "/", "\u02db"], ["7", "=", "\u0060"], ["8", "(", "\u02d9"], ["9", ")", "\u00b4"], ["\u00f6", "\u00d6", "\u02dd"], ["\u00fc", "\u00dc", "\u00a8"], ["\u00f3", "\u00d3", "\u00b8"], ["Bksp", "Bksp"]],
  209.       [["Tab", "Tab"], ["q", "Q", "\u005c"], ["w", "W", "\u007c"], ["e", "E", "\u00c4"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U", "\u20ac"], ["i", "I", "\u00cd"], ["o", "O"], ["p", "P"], ["\u0151", "\u0150", "\u00f7"], ["\u00fa", "\u00da", "\u00d7"], ["Enter", "Enter"]],
  210.       [["Caps", "Caps"], ["a", "A", "\u00e4"], ["s", "S","\u0111"], ["d", "D","\u0110"], ["f", "F","\u005b"], ["g", "G","\u005d"], ["h", "H"], ["j", "J","\u00ed"], ["k", "K","\u0141"], ["l", "L","\u0142"], ["\u00e9", "\u00c9","\u0024"], ["\u00e1", "\u00c1","\u00df"], ["\u0171", "\u0170","\u00a4"]],
  211.       [["Shift", "Shift"], ["\u00ed", "\u00cd","\u003c"], ["y", "Y","\u003e"], ["x", "X","\u0023"], ["c", "C","\u0026"], ["v", "V","\u0040"], ["b", "B","\u007b"], ["n", "N","\u007d"], ["m", "M","\u003c"], [",", "?","\u003b"], [".", ":","\u003e"], ["-", "_","\u002a"], ["Shift", "Shift"]],
  212.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  213.     ];
  214.  
  215.     this.VKI_layout.Italian = [ // Italian Standard Keyboard
  216.       [["\u005c", "\u007c"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "&"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["\u00ec", "\u005e"], ["Bksp", "Bksp"]],
  217.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00e8", "\u00e9", "[", "{"], ["+", "*", "]", "}"], ["Enter", "Enter"]],
  218.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f2", "\u00e7", "@"], ["\u00e0", "\u00b0", "#"], ["\u00f9", "\u00a7"]],
  219.       [["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  220.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  221.     ];
  222.  
  223.     this.VKI_layout.Lithuanian = [ // Lithuanian Standard Keyboard
  224.       [["`", "~"], ["\u0105", "\u0104"], ["\u010D", "\u010C"], ["\u0119", "\u0118"], ["\u0117", "\u0116"], ["\u012F", "\u012E"], ["\u0161", "\u0160"], ["\u0173", "\u0172"], ["\u016B", "\u016A"], ["\u201E", "("], ["\u201C", ")"], ["-", "_"], ["\u017E", "\u017D"], ["Bksp", "Bksp"]],
  225.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["[", "{"], ["]", "}"], ["Enter", "Enter"]],
  226.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], [";", ":"], ["'", '"'], ["\\", "|"]],
  227.       [["Shift", "Shift"], ["\u2013", "\u20AC"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
  228.       [[" ", " "]]
  229.     ];
  230.  
  231.     this.VKI_layout.Norwegian = [ // Norwegian Standard Keyboard
  232.       [["|", "\u00a7"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00a3"], ["4", "\u00a4", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?"], ["\\", "`", "\u00b4"], ["Bksp", "Bksp"]],
  233.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00e5", "\u00c5"], ["\u00a8", "^", "~"], ["Enter", "Enter"]],
  234.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f8", "\u00d8"], ["\u00e6", "\u00c6"], ["'", "*"]],
  235.       [["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u03bc", "\u039c"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  236.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  237.     ];
  238.  
  239.     this.VKI_layout.Numpad = [ // Number pad
  240.       [["$"], ["\u00a3"], ["\u20ac"], ["\u00a5"], ["/"], ["^"], ["Bksp", "Bksp"]],
  241.       [["."], ["7"], ["8"], ["9"], ["*"], ["<"], ["("], ["["]],
  242.       [["="], ["4"], ["5"], ["6"], ["-"], [">"], [")"], ["]"]],
  243.       [["0"], ["1"], ["2"], ["3"], ["+"], ["Enter", "Enter"]],
  244.       [[" "]]
  245.     ];
  246.     this.VKI_layoutDDK.Numpad = true;
  247.  
  248.     this.VKI_layout["Polish Prog"] = [ // Polish Programmers Keyboard
  249.       [["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
  250.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u0119", "\u0118"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P"], ["[", "{"], ["]", "}"], ["\\", "|"]],
  251.       [["Caps", "Caps"], ["a", "A", "\u0105", "\u0104"], ["s", "S", "\u015b", "\u015a"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "\u0142", "\u0141"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
  252.       [["Shift", "Shift"], ["z", "Z", "\u017c", "\u017b"], ["x", "X", "\u017a", "\u0179"], ["c", "C", "\u0107", "\u0106"], ["v", "V"], ["b", "B"], ["n", "N", "\u0144", "\u0143"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
  253.       [[" ", " ", " ", " "], ["Alt", "Alt"]]
  254.     ];
  255.  
  256.     this.VKI_layout.Portuguese = [ // Portuguese Standard Keyboard
  257.       [["`", "\u00ac", "\u00a6"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
  258.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u00e9", "\u00c9"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U", "\u00fa", "\u00da"], ["i", "I", "\u00ed", "\u00cd"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P"], ["[", "{"], ["]", "}"], ["Enter", "Enter"]],
  259.       [["Caps", "Caps"], ["a", "A", "\u00e1", "\u00c1"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00e7", "\u00c7"], [";", ":"], ["'", "@"], ["#", "~"]],
  260.       [["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
  261.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  262.     ];
  263.  
  264.     this.VKI_layout.Romanian = [ // Romanian Standard Keyboard
  265.      [["\u201E", "\u201D", "\u0060", "~"], ["1", "!","~"], ["2", "\u0040", "\u02C7"], ["3", "#","\u005E"], ["4", "$", "\u02D8"], ["5", "%", "\u00B0"], ["6", "\u005E", "\u02DB"], ["7", "&", "\u0060"], ["8", "*", "\u02D9"], ["9", "(", "\u00B4"], ["0", ")", "\u02DD"], ["-", "_", "\u00A8"], ["=", "+", "\u00B8", "\u00B1"], ["Bksp", "Bksp"]],
  266.      [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20AC"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P", "\u00A7"], ["\u0103", "\u0102", "[", "{"], ["\u00EE", "\u00CE", "]","}"], ["\u00E2", "\u00C2", "\\", "|"]],
  267.      [["Caps", "Caps"], ["a", "A"], ["s", "S", "\u00df"], ["d", "D", "\u00f0", "\u00D0"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "\u0142", "\u0141"], [(this.VKI_isIElt8) ? "\u015F" : "\u0219", (this.VKI_isIElt8) ? "\u015E" : "\u0218", ";", ":"], [(this.VKI_isIElt8) ? "\u0163" : "\u021B", (this.VKI_isIElt8) ? "\u0162" : "\u021A", "\'", "\""], ["Enter", "Enter"]],
  268.      [["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C", "\u00A9"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";", "<", "\u00AB"], [".", ":", ">", "\u00BB"], ["/", "?"], ["Shift", "Shift"]],
  269.      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  270.     ];
  271.  
  272.     this.VKI_layout.Russian = [ // Russian Standard Keyboard
  273.       [["\u0451", "\u0401"], ["1", "!"], ["2", '"'], ["3", "\u2116"], ["4", ";"], ["5", "%"], ["6", ":"], ["7", "?"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
  274.       [["Tab", "Tab"], ["\u0439", "\u0419"], ["\u0446", "\u0426"], ["\u0443", "\u0423"], ["\u043A", "\u041A"], ["\u0435", "\u0415"], ["\u043D", "\u041D"], ["\u0433", "\u0413"], ["\u0448", "\u0428"], ["\u0449", "\u0429"], ["\u0437", "\u0417"], ["\u0445", "\u0425"], ["\u044A", "\u042A"], ["Enter", "Enter"]],
  275.       [["Caps", "Caps"], ["\u0444", "\u0424"], ["\u044B", "\u042B"], ["\u0432", "\u0412"], ["\u0430", "\u0410"], ["\u043F", "\u041F"], ["\u0440", "\u0420"], ["\u043E", "\u041E"], ["\u043B", "\u041B"], ["\u0434", "\u0414"], ["\u0436", "\u0416"], ["\u044D", "\u042D"], ["\\", "/"]],
  276.       [["Shift", "Shift"], ["/", "|"], ["\u044F", "\u042F"], ["\u0447", "\u0427"], ["\u0441", "\u0421"], ["\u043C", "\u041C"], ["\u0438", "\u0418"], ["\u0442", "\u0422"], ["\u044C", "\u042C"], ["\u0431", "\u0411"], ["\u044E", "\u042E"], [".", ","], ["Shift", "Shift"]],
  277.       [[" ", " "]]
  278.     ];
  279.  
  280.     this.VKI_layout.Slovenian = [ // Slovenian Standard Keyboard
  281.       [["\u00a8", "\u00a8", "\u00b8"], ["1", "!", "~"], ["2", '"', "\u02c7"], ["3", "#", "^"], ["4", "$", "\u02d8"], ["5", "%", "\u00b0"], ["6", "&", "\u02db"], ["7", "/", "\u0060"], ["8", "(", "\u00B7"], ["9", ")", "\u00b4"], ["0", "=", "\u2033"], ["'", "?", "\u00a8"], ["+", "*", "\u00b8"], ["Bksp", "Bksp"]],
  282.       [["Tab", "Tab"], ["q", "Q", "\\"], ["w", "W","|"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u0161", "\u0160", "\u00f7"], ["\u0111", "\u0110", "\u00d7"], ["Enter", "Enter"]],
  283.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F", "["], ["g", "G", "]"], ["h", "H"], ["j", "J"], ["k", "K", "\u0142"], ["l", "L", "\u0141"], ["\u010D", "\u010C"], ["\u0107", "\u0106", "\u00df"], ["\u017E", "\u017D", "\u00a4"]],
  284.       [["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{",], ["n", "N", "}"], ["m", "M", "\u00a7"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  285.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  286.     ];
  287.  
  288.     this.VKI_layout["Spanish-SP"] = [ // Spanish (Spain) Standard Keyboard
  289.       [["\u00ba", "\u00aa", "\\"], ["1", "!", "|"], ["2", '"', "@"], ["3", "'", "#"], ["4", "$", "~"], ["5", "%", "\u20ac"], ["6", "&","\u00ac"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["\u00a1", "\u00bf"], ["Bksp", "Bksp"]],
  290.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u0060", "^", "["], ["\u002b", "\u002a", "]"], ["Enter", "Enter"]],
  291.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f1", "\u00d1"], ["\u00b4", "\u00a8", "{"], ["\u00e7", "\u00c7", "}"]],
  292.       [["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  293.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  294.     ];
  295.  
  296.     this.VKI_layout.Swedish = [ // Swedish Standard Keyboard
  297.       [["\u00a7", "\u00bd"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00a3"], ["4", "\u00a4", "$"], ["5", "%", "\u20ac"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?", "\\"], ["\u00b4", "`"], ["Bksp", "Bksp"]],
  298.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00e5", "\u00c5"], ["\u00a8", "^", "~"], ["Enter", "Enter"]],
  299.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f6", "\u00d6"], ["\u00e4", "\u00c4"], ["'", "*"]],
  300.       [["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u03bc", "\u039c"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  301.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  302.     ];
  303.  
  304.     this.VKI_layout["Turkish-F"] = [ // Turkish F Keyboard Layout
  305.       [['+', "*", "\u00ac"], ["1", "!", "\u00b9", "\u00a1"], ["2", '"', "\u00b2"], ["3", "^", "#", "\u00b3"], ["4", "$", "\u00bc", "\u00a4"], ["5", "%", "\u00bd"], ["6", "&", "\u00be"], ["7", "'", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["/", "?", "\\", "\u00bf"], ["-", "_", "|"], ["Bksp", "Bksp"]],
  306.       [["Tab", "Tab"], ["f", "F", "@"], ["g", "G"], ["\u011f", "\u011e"], ["\u0131", "\u0049", "\u00b6", "\u00ae"], ["o", "O"], ["d", "D", "\u00a5"], ["r", "R"], ["n", "N"], ["h", "H", "\u00f8", "\u00d8"], ["p", "P", "\u00a3"], ["q", "Q", "\u00a8"], ["w", "W", "~"], ["Enter", "Enter"]],
  307.       [["Caps", "Caps"], ["u", "U", "\u00e6", "\u00c6"], ["i", "\u0130", "\u00df", "\u00a7"], ["e", "E", "\u20ac"], ["a", "A", " ", "\u00aa"], ["\u00fc", "\u00dc"], ["t", "T"], ["k", "K"], ["m", "M"], ["l", "L"], ["y", "Y", "\u00b4"], ["\u015f", "\u015e"], ["x", "X", "`"]],
  308.       [["Shift", "Shift"], ["<", ">", "|", "\u00a6"], ["j", "J", "\u00ab", "<"], ["\u00f6", "\u00d6", "\u00bb", ">"], ["v", "V", "\u00a2", "\u00a9"], ["c", "C"], ["\u00e7", "\u00c7"], ["z", "Z"], ["s", "S", "\u00b5", "\u00ba"], ["b", "B", "\u00d7"], [".", ":", "\u00f7"], [",", ";", "-"], ["Shift", "Shift"]],
  309.       [[" ", " ", " ", " "],  ["AltGr", "AltGr"]]
  310.     ];
  311.  
  312.     this.VKI_layout["Turkish-Q"] = [ // Turkish Q Keyboard Layout
  313.       [['"', "\u00e9", "<"], ["1", "!", ">"], ["2", "'", "\u00a3"], ["3", "^", "#"], ["4", "+", "$"], ["5", "%", "\u00bd"], ["6", "&"], ["7", "/", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["*", "?", "\\"], ["-", "_", "|"], ["Bksp", "Bksp"]],
  314.       [["Tab", "Tab"], ["q", "Q", "@"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["\u0131", "\u0049", "\u0069", "\u0130"], ["o", "O"], ["p", "P"], ["\u011f", "\u011e", "\u00a8"], ["\u00fc", "\u00dc", "~"], ["Enter", "Enter"]],
  315.       [["Caps", "Caps"], ["a", "A", "\u00e6", "\u00c6"], ["s", "S", "\u00df"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u015f", "\u015e", "\u00b4"], ["\u0069", "\u0130"], [",", ";", "`"]],
  316.       [["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], ["\u00f6", "\u00d6"], ["\u00e7", "\u00c7"], [".", ":"], ["Shift", "Shift"]],
  317.       [[" ", " ", " ", " "],  ["AltGr", "AltGr"]]
  318.     ];
  319.  
  320.     this.VKI_layout.UK = [ // UK Standard Keyboard
  321.       [["`", "\u00ac", "\u00a6"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
  322.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u00e9", "\u00c9"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U", "\u00fa", "\u00da"], ["i", "I", "\u00ed", "\u00cd"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P"], ["[", "{"], ["]", "}"], ["Enter", "Enter"]],
  323.       [["Caps", "Caps"], ["a", "A", "\u00e1", "\u00c1"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], [";", ":"], ["'", "@"], ["#", "~"]],
  324.       [["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
  325.       [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
  326.     ];
  327.  
  328.     this.VKI_layout.US = [ // US Standard Keyboard
  329.       [["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
  330.       [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["[", "{"], ["]", "}"], ["\\", "|"]],
  331.       [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
  332.       [["Shift", "Shift"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
  333.       [[" ", " "]]
  334.     ];
  335.  
  336.     this.VKI_layout["US Int'l"] = [ // US International Keyboard
  337.       [["`", "~"], ["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"]],
  338.       [["Tab", "Tab"], ["q", "Q", "\u00e4", "\u00c4"], ["w", "W", "\u00e5", "\u00c5"], ["e", "E", "\u00e9", "\u00c9"], ["r", "R", "\u00ae"], ["t", "T", "\u00fe", "\u00de"], ["y", "Y", "\u00fc", "\u00dc"], ["u", "U", "\u00fa", "\u00da"], ["i", "I", "\u00ed", "\u00cd"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P", "\u00f6", "\u00d6"], ["[", "{", "\u00ab"], ["]", "}", "\u00bb"], ["\\", "|", "\u00ac", "\u00a6"]],
  339.       [["Caps", "Caps"], ["a", "A", "\u00e1", "\u00c1"], ["s", "S", "\u00df", "\u00a7"], ["d", "D", "\u00f0", "\u00d0"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "\u00f8", "\u00d8"], [";", ":", "\u00b6", "\u00b0"], ["'", '"', "\u00b4", "\u00a8"], ["Enter", "Enter"]],
  340.       [["Shift", "Shift"], ["z", "Z", "\u00e6", "\u00c6"], ["x", "X"], ["c", "C", "\u00a9", "\u00a2"], ["v", "V"], ["b", "B"], ["n", "N", "\u00f1", "\u00d1"], ["m", "M", "\u00b5"], [",", "<", "\u00e7", "\u00c7"], [".", ">"], ["/", "?", "\u00bf"], ["Shift", "Shift"]],
  341.       [[" ", " ", " ", " "], ["Alt", "Alt"]]
  342.     ];
  343.  
  344.  
  345.     /* ***** Define Dead Keys ************************************** */
  346.     this.VKI_deadkey = {};
  347.  
  348.     // - Lay out each dead key set in one row of sub-arrays.  The rows
  349.     //   below are wrapped so uppercase letters are below their
  350.     //   lowercase equivalents.
  351.     //
  352.     // - The first letter in each sub-array is the letter pressed after
  353.     //   the diacritic.  The second letter is the letter this key-combo
  354.     //   will generate.
  355.     //
  356.     // - Note that if you have created a new keyboard layout and want
  357.     //   it included in the distributed script, PLEASE TELL ME if you
  358.     //   have added additional dead keys to the ones below.
  359.  
  360.     this.VKI_deadkey['"'] = this.VKI_deadkey['\u00a8'] = [ // Umlaut / Diaeresis / Greek Dialytika
  361.       ["a", "\u00e4"], ["e", "\u00eb"], ["i", "\u00ef"], ["o", "\u00f6"], ["u", "\u00fc"], ["y", "\u00ff"], ["\u03b9", "\u03ca"], ["\u03c5", "\u03cb"],
  362.       ["A", "\u00c4"], ["E", "\u00cb"], ["I", "\u00cf"], ["O", "\u00d6"], ["U", "\u00dc"], ["Y", "\u0178"], ["\u0399", "\u03aa"], ["\u03a5", "\u03ab"]
  363.     ];
  364.     this.VKI_deadkey['~'] = [ // Tilde
  365.       ["a", "\u00e3"], ["o", "\u00f5"], ["n", "\u00f1"],
  366.       ["A", "\u00c3"], ["O", "\u00d5"], ["N", "\u00d1"]
  367.     ];
  368.     this.VKI_deadkey['^'] = [ // Circumflex
  369.       ["a", "\u00e2"], ["e", "\u00ea"], ["i", "\u00ee"], ["o", "\u00f4"], ["u", "\u00fb"], ["w", "\u0175"], ["y", "\u0177"],
  370.       ["A", "\u00c2"], ["E", "\u00ca"], ["I", "\u00ce"], ["O", "\u00d4"], ["U", "\u00db"], ["W", "\u0174"], ["Y", "\u0176"]
  371.     ];
  372.     this.VKI_deadkey['\u02c7'] = [ // Baltic caron
  373.       ["c", "\u010D"], ["s", "\u0161"], ["z", "\u017E"], ["r", "\u0159"], ["d", "\u010f"], ["t", "\u0165"], ["n", "\u0148"], ["l", "\u013e"], ["e", "\u011b"],
  374.       ["C", "\u010C"], ["S", "\u0160"], ["Z", "\u017D"], ["R", "\u0158"], ["D", "\u010e"], ["T", "\u0164"], ["N", "\u0147"], ["L", "\u013d"], ["E", "\u011a"]
  375.     ];
  376.     this.VKI_deadkey['\u02d8'] = [ // Romanian and Turkish breve
  377.       ["a", "\u0103"], ["g", "\u011f"],
  378.       ["A", "\u0102"], ["G", "\u011e"]
  379.     ];
  380.     this.VKI_deadkey['`'] = [ // Grave
  381.       ["a", "\u00e0"], ["e", "\u00e8"], ["i", "\u00ec"], ["o", "\u00f2"], ["u", "\u00f9"],
  382.       ["A", "\u00c0"], ["E", "\u00c8"], ["I", "\u00cc"], ["O", "\u00d2"], ["U", "\u00d9"]
  383.     ];
  384.     this.VKI_deadkey["'"] = this.VKI_deadkey['\u00b4'] = this.VKI_deadkey['\u0384'] = [ // Acute / Greek Tonos
  385.       ["a", "\u00e1"], ["e", "\u00e9"], ["i", "\u00ed"], ["o", "\u00f3"], ["u", "\u00fa"], ["y", "\u00fd"], ["\u03b1", "\u03ac"], ["\u03b5", "\u03ad"], ["\u03b7", "\u03ae"], ["\u03b9", "\u03af"], ["\u03bf", "\u03cc"], ["\u03c5", "\u03cd"], ["\u03c9", "\u03ce"],
  386.       ["A", "\u00c1"], ["E", "\u00c9"], ["I", "\u00cd"], ["O", "\u00d3"], ["U", "\u00da"], ["Y", "\u00dd"], ["\u0391", "\u0386"], ["\u0395", "\u0388"], ["\u0397", "\u0389"], ["\u0399", "\u038a"], ["\u039f", "\u038c"], ["\u03a5", "\u038e"], ["\u03a9", "\u038f"]
  387.     ];
  388.     this.VKI_deadkey['\u02dd'] = [ // Hungarian Double Acute Accent
  389.       ["o", "\u0151"], ["u", "\u0171"],
  390.       ["O", "\u0150"], ["U", "\u0170"]
  391.     ];
  392.     this.VKI_deadkey['\u0385'] = [ // Greek Dialytika + Tonos
  393.       ["\u03b9", "\u0390"], ["\u03c5", "\u03b0"]
  394.     ];
  395.     this.VKI_deadkey['\u00b0'] = this.VKI_deadkey['\u00ba'] = [ // Ring
  396.       ["a", "\u00e5"], ["u", "\u016f"],
  397.       ["A", "\u00c5"], ["U", "\u016e"]
  398.     ];
  399.     this.VKI_deadkey['\u02DB'] = [ // Ogonek
  400.       ["a", "\u0106"], ["e", "\u0119"], ["i", "\u012f"], ["o", "\u01eb"], ["u", "\u0173"], ["y", "\u0177"],
  401.       ["A", "\u0105"], ["E", "\u0118"], ["I", "\u012e"], ["O", "\u01ea"], ["U", "\u0172"], ["Y", "\u0176"]
  402.     ];
  403.     this.VKI_deadkey['\u02D9'] = [ // Dot-above
  404.       ["c", "\u010B"], ["e", "\u0117"], ["g", "\u0121"], ["z", "\u017C"],
  405.       ["C", "\u010A"], ["E", "\u0116"], ["G", "\u0120"], ["Z", "\u017B"]
  406.     ];
  407.     this.VKI_deadkey['\u00B8'] = [ // Cedilla
  408.       ["c", "\u00e7"], ["s", "\u015F"],
  409.       ["C", "\u00c7"], ["S", "\u015E"]
  410.     ];
  411.     this.VKI_deadkey[','] = [ // Comma
  412.       ["s", (this.VKI_isIElt8) ? "\u015F" : "\u0219"], ["t", (this.VKI_isIElt8) ? "\u0163" : "\u021B"],
  413.       ["S", (this.VKI_isIElt8) ? "\u015E" : "\u0218"], ["T", (this.VKI_isIElt8) ? "\u0162" : "\u021A"]
  414.     ];
  415.  
  416.  
  417.  
  418.     /* ****************************************************************
  419.      * Attach the keyboard to an element
  420.      *
  421.      */
  422.     this.VKI_attachKeyboard = VKI_attach = function(elem) {
  423.       if (elem.VKI_attached) return false;
  424.       var keybut = document.createElement('img');
  425.           keybut.src = "scripts/js/keyboard/keyboard.png";
  426.           keybut.alt = "Keyboard interface";
  427.           keybut.className = "keyboardInputInitiator";
  428.           keybut.title = "Display graphical keyboard interface";
  429.           keybut.elem = elem;
  430.           keybut.onclick = function() { self.VKI_show(this.elem); };
  431.       elem.VKI_attached = true;
  432.       elem.parentNode.insertBefore(keybut, elem.nextSibling);
  433.       if (this.VKI_isIE) {
  434.         elem.onclick = elem.onselect = elem.onkeyup = function(e) {
  435.           if ((e || event).type != "keyup" || !this.readOnly)
  436.             this.range = document.selection.createRange();
  437.         };
  438.       }
  439.     };
  440.  
  441.  
  442.     /* ***** Find tagged input & textarea elements ***************** */
  443.     var inputElems = [
  444.       document.getElementsByTagName('input'),
  445.       document.getElementsByTagName('textarea')
  446.     ];
  447.     for (var x = 0, elem; elem = inputElems[x++];)
  448.       for (var y = 0, ex; ex = elem[y++];)
  449.         if ((ex.nodeName == "TEXTAREA" || ex.type == "text" || ex.type == "password") && ex.className.indexOf("keyboardInput") > -1)
  450.           this.VKI_attachKeyboard(ex);
  451.  
  452.  
  453.     /* ***** Build the keyboard interface ************************** */
  454.     this.VKI_keyboard = document.createElement('table');
  455.     this.VKI_keyboard.id = "keyboardInputMaster";
  456.     this.VKI_keyboard.dir = "ltr";
  457.     this.VKI_keyboard.cellSpacing = this.VKI_keyboard.border = "0";
  458.  
  459.     var thead = document.createElement('thead');
  460.       var tr = document.createElement('tr');
  461.         var th = document.createElement('th');
  462.           var kblist = document.createElement('select');
  463.             for (ktype in this.VKI_layout) {
  464.               if (typeof this.VKI_layout[ktype] == "object") {
  465.                 var opt = document.createElement('option');
  466.                     opt.value = ktype;
  467.                     opt.appendChild(document.createTextNode(ktype));
  468.                   kblist.appendChild(opt);
  469.               }
  470.             }
  471.             if (kblist.options.length) {
  472.                 kblist.value = this.VKI_kt;
  473.                 kblist.onchange = function() {
  474.                   self.VKI_kt = this.value;
  475.                   self.VKI_buildKeys();
  476.                   self.VKI_position();
  477.                 };
  478.               th.appendChild(kblist);
  479.             }
  480.  
  481.             var label = document.createElement('label');
  482.               var checkbox = document.createElement('input');
  483.                   checkbox.type = "checkbox";
  484.                   checkbox.title = "Dead keys: " + ((this.VKI_deadkeysOn) ? "On" : "Off");
  485.                   checkbox.defaultChecked = this.VKI_deadkeysOn;
  486.                   checkbox.onclick = function() {
  487.                     self.VKI_deadkeysOn = this.checked;
  488.                     this.title = "Dead keys: " + ((this.checked) ? "On" : "Off");
  489.                     self.VKI_modify("");
  490.                     return true;
  491.                   };
  492.                 label.appendChild(this.VKI_deadkeysElem = checkbox);
  493.                   checkbox.checked = this.VKI_deadkeysOn;
  494.             th.appendChild(label);
  495.           tr.appendChild(th);
  496.  
  497.         var td = document.createElement('td');
  498.           var clearer = document.createElement('span');
  499.               clearer.id = "keyboardInputClear";
  500.               clearer.appendChild(document.createTextNode("Clear"));
  501.               clearer.title = "Clear this input";
  502.               clearer.onmousedown = function() { this.className = "pressed"; };
  503.               clearer.onmouseup = function() { this.className = ""; };
  504.               clearer.onclick = function() {
  505.                 self.VKI_target.value = "";
  506.                 self.VKI_target.focus();
  507.                 return false;
  508.               };
  509.             td.appendChild(clearer);
  510.  
  511.           var closer = document.createElement('span');
  512.               closer.id = "keyboardInputClose";
  513.               closer.appendChild(document.createTextNode('X'));
  514.               closer.title = "Close this window";
  515.               closer.onmousedown = function() { this.className = "pressed"; };
  516.               closer.onmouseup = function() { this.className = ""; };
  517.               closer.onclick = function() { self.VKI_close(); };
  518.             td.appendChild(closer);
  519.  
  520.           tr.appendChild(td);
  521.         thead.appendChild(tr);
  522.     this.VKI_keyboard.appendChild(thead);
  523.  
  524.     var tbody = document.createElement('tbody');
  525.       var tr = document.createElement('tr');
  526.         var td = document.createElement('td');
  527.             td.colSpan = "2";
  528.           var div = document.createElement('div');
  529.               div.id = "keyboardInputLayout";
  530.             td.appendChild(div);
  531.           if (this.VKI_showVersion) {
  532.             var div = document.createElement('div');
  533.               var ver = document.createElement('var');
  534.                   ver.appendChild(document.createTextNode("v" + this.VKI_version));
  535.                 div.appendChild(ver);
  536.               td.appendChild(div);
  537.           }
  538.           tr.appendChild(td);
  539.         tbody.appendChild(tr);
  540.     this.VKI_keyboard.appendChild(tbody);      
  541.  
  542.     if (this.VKI_isIE6) {
  543.       this.VKI_iframe = document.createElement('iframe');
  544.       this.VKI_iframe.style.position = "absolute";
  545.       this.VKI_iframe.style.border = "0px none";
  546.       this.VKI_iframe.style.filter = "mask()";
  547.       this.VKI_iframe.style.zIndex = "999999";
  548.     }
  549.  
  550.  
  551.     /* ****************************************************************
  552.      * Build or rebuild the keyboard keys
  553.      *
  554.      */
  555.     this.VKI_buildKeys = function() {
  556.       this.VKI_shift = this.VKI_capslock = this.VKI_alternate = this.VKI_dead = false;
  557.       this.VKI_deadkeysOn = (this.VKI_layoutDDK[this.VKI_kt]) ? false : this.VKI_keyboard.getElementsByTagName('label')[0].getElementsByTagName('input')[0].checked;
  558.  
  559.       var container = this.VKI_keyboard.tBodies[0].getElementsByTagName('div')[0];
  560.       while (container.firstChild) container.removeChild(container.firstChild);
  561.  
  562.       for (var x = 0, hasDeadKey = false, lyt; lyt = this.VKI_layout[this.VKI_kt][x++];) {
  563.         var table = document.createElement('table');
  564.             table.cellSpacing = table.border = "0";
  565.         if (lyt.length <= this.VKI_keyCenter) table.className = "keyboardInputCenter";
  566.           var tbody = document.createElement('tbody');
  567.             var tr = document.createElement('tr');
  568.             for (var y = 0, lkey; lkey = lyt[y++];) {
  569.               var td = document.createElement('td');
  570.                   td.appendChild(document.createTextNode(lkey[0]));
  571.  
  572.                 var className = [];
  573.                 if (this.VKI_deadkeysOn)
  574.                   for (key in this.VKI_deadkey)
  575.                     if (key === lkey[0]) { className.push("alive"); break; }
  576.                 if (lyt.length > this.VKI_keyCenter && y == lyt.length) className.push("last");
  577.                 if (lkey[0] == " ") className.push("space");
  578.                   td.className = className.join(" ");
  579.  
  580.                   td.VKI_clickless = 0;
  581.                   if (!td.click) {
  582.                     td.click = function() {
  583.                       var evt = this.ownerDocument.createEvent('MouseEvents');  
  584.                       evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);  
  585.                       this.dispatchEvent(evt);
  586.                     };
  587.                   }
  588.                   td.onmouseover = function() {
  589.                     if (self.VKI_clickless) {
  590.                       var _self = this;
  591.                       clearTimeout(this.VKI_clickless);
  592.                       this.VKI_clickless = setTimeout(function() { _self.click(); }, self.VKI_clicklessDelay);
  593.                     }
  594.                     if (this.firstChild.nodeValue != "\xa0") this.className += " hover";
  595.                   };
  596.                   td.onmouseout = function() {
  597.                     if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
  598.                     this.className = this.className.replace(/ ?(hover|pressed)/g, "");
  599.                   };
  600.                   td.onmousedown = function() {
  601.                     if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
  602.                     if (this.firstChild.nodeValue != "\xa0") this.className += " pressed";
  603.                   };
  604.                   td.onmouseup = function() {
  605.                     if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
  606.                     this.className = this.className.replace(/ ?pressed/g, "");
  607.                   };
  608.                   td.ondblclick = function() { return false; };
  609.  
  610.                 switch (lkey[1]) {
  611.                   case "Caps":
  612.                   case "Shift":
  613.                   case "Alt":
  614.                   case "AltGr":
  615.                     td.onclick = (function(type) { return function() { self.VKI_modify(type); return false; }; })(lkey[1]);
  616.                     break;
  617.                   case "Tab":
  618.                     td.onclick = function() { self.VKI_insert("\t"); return false; };
  619.                     break;
  620.                   case "Bksp":
  621.                     td.onclick = function() {
  622.                       self.VKI_target.focus();
  623.                       if (self.VKI_target.setSelectionRange) {
  624.                         if (self.VKI_target.readOnly && self.VKI_isWebKit) {
  625.                           var rng = [self.VKI_target.selStart || 0, self.VKI_target.selEnd || 0];
  626.                         } else var rng = [self.VKI_target.selectionStart, self.VKI_target.selectionEnd];
  627.                         if (rng[0] < rng[1]) rng[0]++;
  628.                         self.VKI_target.value = self.VKI_target.value.substr(0, rng[0] - 1) + self.VKI_target.value.substr(rng[1]);
  629.                         self.VKI_target.setSelectionRange(rng[0] - 1, rng[0] - 1);
  630.                         if (self.VKI_target.readOnly && self.VKI_isWebKit) {
  631.                           var range = window.getSelection().getRangeAt(0);
  632.                           self.VKI_target.selStart = range.startOffset;
  633.                           self.VKI_target.selEnd = range.endOffset;
  634.                         }
  635.                       } else if (self.VKI_target.createTextRange) {
  636.                         try {
  637.                           self.VKI_target.range.select();
  638.                         } catch(e) { self.VKI_target.range = document.selection.createRange(); }
  639.                         if (!self.VKI_target.range.text.length) self.VKI_target.range.moveStart('character', -1);
  640.                         self.VKI_target.range.text = "";
  641.                       } else self.VKI_target.value = self.VKI_target.value.substr(0, self.VKI_target.value.length - 1);
  642.                       if (self.VKI_shift) self.VKI_modify("Shift");
  643.                       if (self.VKI_alternate) self.VKI_modify("AltGr");
  644.                       self.VKI_target.focus();
  645.                       return true;
  646.                     };
  647.                     break;
  648.                   case "Enter":
  649.                     td.onclick = function() {
  650.                       if (self.VKI_target.nodeName != "TEXTAREA") {
  651.                         self.VKI_close();
  652.                         this.className = this.className.replace(/ ?(hover|pressed)/g, "");
  653.                       } else self.VKI_insert("\n");
  654.                       return true;
  655.                     };
  656.                     break;
  657.                   default:
  658.                     td.onclick = function() {
  659.                       if (self.VKI_deadkeysOn && self.VKI_dead) {
  660.                         if (self.VKI_dead != this.firstChild.nodeValue) {
  661.                           for (key in self.VKI_deadkey) {
  662.                             if (key == self.VKI_dead) {
  663.                               if (this.firstChild.nodeValue != " ") {
  664.                                 for (var z = 0, rezzed = false, dk; dk = self.VKI_deadkey[key][z++];) {
  665.                                   if (dk[0] == this.firstChild.nodeValue) {
  666.                                     self.VKI_insert(dk[1]);
  667.                                     rezzed = true;
  668.                                     break;
  669.                                   }
  670.                                 }
  671.                               } else {
  672.                                 self.VKI_insert(self.VKI_dead);
  673.                                 rezzed = true;
  674.                               } break;
  675.                             }
  676.                           }
  677.                         } else rezzed = true;
  678.                       } self.VKI_dead = false;
  679.  
  680.                       if (!rezzed && this.firstChild.nodeValue != "\xa0") {
  681.                         if (self.VKI_deadkeysOn) {
  682.                           for (key in self.VKI_deadkey) {
  683.                             if (key == this.firstChild.nodeValue) {
  684.                               self.VKI_dead = key;
  685.                               this.className += " dead";
  686.                               if (self.VKI_shift) self.VKI_modify("Shift");
  687.                               if (self.VKI_alternate) self.VKI_modify("AltGr");
  688.                               break;
  689.                             }
  690.                           }
  691.                           if (!self.VKI_dead) self.VKI_insert(this.firstChild.nodeValue);
  692.                         } else self.VKI_insert(this.firstChild.nodeValue);
  693.                       }
  694.  
  695.                       self.VKI_modify("");
  696.                       return false;
  697.                     };
  698.  
  699.                 }
  700.                 tr.appendChild(td);
  701.               tbody.appendChild(tr);
  702.             table.appendChild(tbody);
  703.  
  704.             for (var z = 0; z < 4; z++)
  705.               if (this.VKI_deadkey[lkey[z] = lkey[z] || "\xa0"]) hasDeadKey = true;
  706.         }
  707.         container.appendChild(table);
  708.       }
  709.       this.VKI_deadkeysElem.style.display = (!this.VKI_layoutDDK[this.VKI_kt] && hasDeadKey) ? "inline" : "none";
  710.     };
  711.  
  712.     this.VKI_buildKeys();
  713.     VKI_disableSelection(this.VKI_keyboard);
  714.  
  715.  
  716.     /* ****************************************************************
  717.      * Controls modifier keys
  718.      *
  719.      */
  720.     this.VKI_modify = function(type) {
  721.       switch (type) {
  722.         case "Alt":
  723.         case "AltGr": this.VKI_alternate = !this.VKI_alternate; break;
  724.         case "Caps": this.VKI_capslock = !this.VKI_capslock; break;
  725.         case "Shift": this.VKI_shift = !this.VKI_shift; break;
  726.       } var vchar = 0;
  727.       if (!this.VKI_shift != !this.VKI_capslock) vchar += 1;
  728.  
  729.       var tables = this.VKI_keyboard.getElementsByTagName('table');
  730.       for (var x = 0; x < tables.length; x++) {
  731.         var tds = tables[x].getElementsByTagName('td');
  732.         for (var y = 0; y < tds.length; y++) {
  733.           var className = [];
  734.           var lkey = this.VKI_layout[this.VKI_kt][x][y];
  735.  
  736.           if (tds[y].className.indexOf('hover') > -1) className.push("hover");
  737.  
  738.           switch (lkey[1]) {
  739.             case "Alt":
  740.             case "AltGr":
  741.               if (this.VKI_alternate) className.push("dead");
  742.               break;
  743.             case "Shift":
  744.               if (this.VKI_shift) className.push("dead");
  745.               break;
  746.             case "Caps":
  747.               if (this.VKI_capslock) className.push("dead");
  748.               break;
  749.             case "Tab": case "Enter": case "Bksp": break;
  750.             default:
  751.               if (type) tds[y].firstChild.nodeValue = lkey[vchar + ((this.VKI_alternate && lkey.length == 4) ? 2 : 0)];
  752.               if (this.VKI_deadkeysOn) {
  753.                 var char = tds[y].firstChild.nodeValue;
  754.                 if (this.VKI_dead) {
  755.                   if (char == this.VKI_dead) className.push("dead");
  756.                   for (var z = 0; z < this.VKI_deadkey[this.VKI_dead].length; z++) {
  757.                     if (char == this.VKI_deadkey[this.VKI_dead][z][0]) {
  758.                       className.push("target");
  759.                       break;
  760.                     }
  761.                   }
  762.                 }
  763.                 for (key in this.VKI_deadkey)
  764.                   if (key === char) { className.push("alive"); break; }
  765.               }
  766.           }
  767.  
  768.           if (y == tds.length - 1 && tds.length > this.VKI_keyCenter) className.push("last");
  769.           if (lkey[0] == " ") className.push("space");
  770.           tds[y].className = className.join(" ");
  771.         }
  772.       }
  773.     };
  774.  
  775.  
  776.     /* ****************************************************************
  777.      * Insert text at the cursor
  778.      *
  779.      */
  780.     this.VKI_insert = function(text) {
  781.       this.VKI_target.focus();
  782.       if (typeof this.VKI_target.maxLength == "undefined" ||
  783.           this.VKI_target.maxLength < 0 ||
  784.           this.VKI_target.value.length < this.VKI_target.maxLength) {
  785.         if (this.VKI_target.setSelectionRange) {
  786.           if (this.VKI_target.readOnly && this.VKI_isWebKit) {
  787.             var rng = [this.VKI_target.selStart || 0, this.VKI_target.selEnd || 0];
  788.           } else var rng = [this.VKI_target.selectionStart, this.VKI_target.selectionEnd];
  789.           this.VKI_target.value = this.VKI_target.value.substr(0, rng[0]) + text + this.VKI_target.value.substr(rng[1]);
  790.           if (text == "\n" && window.opera) rng[0]++;
  791.           this.VKI_target.setSelectionRange(rng[0] + text.length, rng[0] + text.length);
  792.           if (this.VKI_target.readOnly && this.VKI_isWebKit) {
  793.             var range = window.getSelection().getRangeAt(0);
  794.             this.VKI_target.selStart = range.startOffset;
  795.             this.VKI_target.selEnd = range.endOffset;
  796.           }
  797.         } else if (this.VKI_target.createTextRange) {
  798.           try {
  799.             this.VKI_target.range.select();
  800.           } catch(e) { this.VKI_target.range = document.selection.createRange(); }
  801.           this.VKI_target.range.text = text;
  802.           this.VKI_target.range.collapse(true);
  803.           this.VKI_target.range.select();
  804.         } else this.VKI_target.value += text;
  805.         if (this.VKI_shift) this.VKI_modify("Shift");
  806.         if (this.VKI_alternate) this.VKI_modify("AltGr");
  807.         this.VKI_target.focus();
  808.       } else if (this.VKI_target.createTextRange) this.VKI_target.range.select();
  809.     };
  810.  
  811.  
  812.     /* ****************************************************************
  813.      * Show the keyboard interface
  814.      *
  815.      */
  816.     this.VKI_show = function(elem) {
  817.       if (this.VKI_target = elem) {
  818.         if (this.VKI_visible != elem) {
  819.           if (this.VKI_isIE) {
  820.             if (!this.VKI_target.range) {
  821.               this.VKI_target.range = this.VKI_target.createTextRange();
  822.               this.VKI_target.range.moveStart('character', this.VKI_target.value.length);
  823.             } this.VKI_target.range.select();
  824.           }
  825.           try { this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard); } catch (e) {}
  826.           if (this.VKI_clearPasswords && this.VKI_target.type == "password") this.VKI_target.value = "";
  827.  
  828.           var elem = this.VKI_target;
  829.           this.VKI_target.keyboardPosition = "absolute";
  830.           do {
  831.             if (VKI_getStyle(elem, "position") == "fixed") {
  832.               this.VKI_target.keyboardPosition = "fixed";
  833.               break;
  834.             }
  835.           } while (elem = elem.offsetParent);
  836.  
  837.           if (this.VKI_isIE6) document.body.appendChild(this.VKI_iframe);
  838.           document.body.appendChild(this.VKI_keyboard);
  839.           this.VKI_keyboard.style.top = this.VKI_keyboard.style.right = this.VKI_keyboard.style.bottom = this.VKI_keyboard.style.left = "auto";
  840.           this.VKI_keyboard.style.position = this.VKI_target.keyboardPosition;
  841.  
  842.           this.VKI_visible = this.VKI_target;
  843.           this.VKI_position();
  844.           this.VKI_target.focus();
  845.         } else this.VKI_close();
  846.       }
  847.     };
  848.  
  849.  
  850.     /* ****************************************************************
  851.      * Position the keyboard
  852.      *
  853.      */
  854.     this.VKI_position = function() {
  855.       if (self.VKI_visible) {
  856.         var inputElemPos = VKI_findPos(self.VKI_target);
  857.         self.VKI_keyboard.style.top = inputElemPos[1] - ((self.VKI_target.keyboardPosition == "fixed" && !self.VKI_isIE && !self.VKI_isMoz) ? VKI_scrollDist()[1] : 0) + self.VKI_target.offsetHeight + 3 + "px";
  858.         self.VKI_keyboard.style.left = Math.min(VKI_innerDimensions()[0] - self.VKI_keyboard.offsetWidth - 15, inputElemPos[0]) + "px";
  859.         if (self.VKI_isIE6) {
  860.           self.VKI_iframe.style.width = self.VKI_keyboard.offsetWidth + "px";
  861.           self.VKI_iframe.style.height = self.VKI_keyboard.offsetHeight + "px";
  862.           self.VKI_iframe.style.top = self.VKI_keyboard.style.top;
  863.           self.VKI_iframe.style.left = self.VKI_keyboard.style.left;
  864.         }
  865.       }
  866.     };
  867.  
  868.  
  869.     if (window.addEventListener) {
  870.       window.addEventListener('resize', this.VKI_position, false);
  871.     } else if (window.attachEvent)
  872.       window.attachEvent('onresize', this.VKI_position);
  873.  
  874.  
  875.     /* ****************************************************************
  876.      * Close the keyboard interface
  877.      *
  878.      */
  879.     this.VKI_close = VKI_close = function() {
  880.       if (this.VKI_visible) {
  881.         try {
  882.           this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard);
  883.           if (this.VKI_isIE6) this.VKI_iframe.parentNode.removeChild(this.VKI_iframe);
  884.         } catch (e) {}
  885.         this.VKI_target.focus();
  886.         this.VKI_target = this.VKI_visible = false;
  887.       }
  888.     };
  889.   };
  890.  
  891.   function VKI_findPos(obj) {
  892.     var curleft = curtop = 0;
  893.     do {
  894.       curleft += obj.offsetLeft;
  895.       curtop += obj.offsetTop;
  896.     } while (obj = obj.offsetParent);
  897.     return [curleft, curtop];
  898.   }
  899.  
  900.   function VKI_innerDimensions() {
  901.     if (self.innerHeight) {
  902.       return [self.innerWidth, self.innerHeight];
  903.     } else if (document.documentElement && document.documentElement.clientHeight) {
  904.       return [document.documentElement.clientWidth, document.documentElement.clientHeight];
  905.     } else if (document.body)
  906.       return [document.body.clientWidth, document.body.clientHeight];
  907.     return [0, 0];
  908.   }
  909.  
  910.   function VKI_scrollDist() {
  911.     var html = document.getElementsByTagName('html')[0];
  912.     if (html.scrollTop && document.documentElement.scrollTop) {
  913.       return [html.scrollLeft, html.scrollTop];
  914.     } else if (html.scrollTop || document.documentElement.scrollTop)
  915.       return [html.scrollLeft + document.documentElement.scrollLeft, html.scrollTop + document.documentElement.scrollTop];
  916.     return [0, 0];
  917.   }
  918.  
  919.   function VKI_getStyle(obj, styleProp) {
  920.     if (obj.currentStyle) {
  921.       var y = obj.currentStyle[styleProp];
  922.     } else if (window.getComputedStyle)
  923.       var y = window.getComputedStyle(obj, null)[styleProp];
  924.     return y;
  925.   }
  926.  
  927.   function VKI_disableSelection(elem) {
  928.     elem.onselectstart = function() { return false; };
  929.     elem.unselectable = "on";
  930.     elem.style.MozUserSelect = "none";
  931.     elem.style.cursor = "default";
  932.     if (window.opera) elem.onmousedown = function() { return false; };
  933.   }
  934.  
  935.  
  936.   /* ***** Attach this script to the onload event ****************** */
  937.   if (window.addEventListener) {
  938.     window.addEventListener('load', VKI_buildKeyboardInputs, false);
  939.   } else if (window.attachEvent)
  940.     window.attachEvent('onload', VKI_buildKeyboardInputs);
  941.