Thumb

Orkut Manager Plus V3 Out Now With Cool Features

By Swarnava/Heaven GOD Last update Nov 26, 2009 — Installed 134,570 times. Daily Installs: 141, 198, 568, 205, 8103, 151, 141, 84, 95, 100, 82, 136, 187, 95, 791, 72, 88, 57, 86, 70, 81, 40, 43, 76, 67, 61, 90, 82, 101, 64, 44, 102

There are 338 previous versions of this script.

the source is over 100KB, syntax highlighting in the browser is too slow

/***********************************************************************
Orkut Manager Plus
Version 2.99.99
2009-11-01
Copyright 2009, Swarnava Sengupta
Released under the GPL license
http://www.gnu.org/copyleft/gpl.html

BUMP1

TERMS AND CONDITIONS :-

Redistribution, with or without modification, are permitted provided that the
following conditions are met:
    * Contains this file "AS IS".
    * With modifications, redistributors must add at the end of the
      software name the word "unofficial".

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License:-

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY;  without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

**************************************************************************
- Fixed more bugs
 **************************************************************************/

// Start Virtual Keyboard

/* ********************************************************************
 * HTML Virtual Keyboard Interface User Javascript - v1.30
 *   Copyright (c) 2009 - GreyWyvern
 *
 *  - Licenced for free distribution under the BSDL
 *          http://www.opensource.org/licenses/bsd-license.php
 * ********************************************************************
*/

window.addEventListener('load', function() {
  function VKI_buildKeyboardInputsUserScript() {
    var self = this;

    this.VKI_version = "2.99.99";
    this.VKI_showVersion = true;
    this.VKI_target = this.VKI_visible = false;
    this.VKI_shift = this.VKI_shiftlock = false;
    this.VKI_altgr = this.VKI_altgrlock = false;
    this.VKI_dead = false;
    this.VKI_deadkeysOn = false;
    this.VKI_kt = "US Int'l";  // Default keyboard layout
    this.VKI_clearPasswords = false;  // Clear password fields on focus
    this.VKI_imageURI = "keyboard.png";
    this.VKI_clickless = 0;  // 0 = disabled, > 0 = delay in ms
    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_layout.Albanian = [ // Albanian Standard Keyboard
  [["\\", "|"], ["1", "!", "~"], ["2", '"', "\u02C7"], ["3", "#", "^"], ["4", "$", "\u02D8"], ["5", "%", "\u00B0"], ["6", "^", "\u02DB"], ["7", "&", "`"], ["8", "*", "\u02D9"], ["9", "(", "\u00B4"], ["0", ")", "\u02DD"], ["-", "_", "\u00A8"], ["=", "+", "\u00B8"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["q", "Q", "\\"], ["w", "W", "|"], ["e", "E"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00E7", "\u00C7", "\u00F7"], ["@", "'", "\u00D7"], ["Enter", "Enter"]],
  [["Caps", "Caps"], ["a", "A"], ["s", "S", "\u0111"], ["d", "D", "\u0110"], ["f", "F", "["], ["g", "G", "]"], ["h", "H"], ["j", "J"], ["k", "K", "\u0142"], ["l", "L", "\u0141"], ["\u00EB", "\u00CB", "$"], ["[", "{", "\u00DF"], ["]", "}", "\u00A4"]],
  [["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{"], ["n", "N", "}"], ["m", "M", "\u00A7"], [",", ";", "<"], [".", ":", ">"], ["/", "?"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

    this.VKI_layout.Arabic = [ // Arabic Keyboard
      [["\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"]],
      [["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"]],
      [["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"]],
      [["Shift", "Shift"], ["\u0626", "\u007e"], ["\u0621", "\u0652"], ["\u0624", "\u007d"], ["\u0631", "\u007b"], ["\u0644", "\u0644"], ["\u0649", "\u0622"], ["\u0629", "\u2019"], ["\u0648", "\u002c"], ["\u0632", "\u002e"], ["\u0638", "\u061f"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["Alt", "Alt"]]
    ];

    this.VKI_layout["Armenian Eastern"] = [ // Armenian Eastern Standard Keyboard
  [["\u055D", "\u055C"], [":", "1"], ["\u0571", "\u0541"], ["\u0575", "\u0545"], ["\u055B", "3"], [",", "4"], ["-", "9"], [".", "\u0587"], ["\u00ab", "("], ["\u00BB", ")"], ["\u0585", "\u0555"], ["\u057C", "\u054C"], ["\u056A", "\u053A"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["\u056D", "\u053D"], ["\u0582", "\u0552"], ["\u0567", "\u0537"], ["\u0580", "\u0550"], ["\u057F", "\u054F"], ["\u0565", "\u0535"], ["\u0568", "\u0538"], ["\u056B", "\u053B"], ["\u0578", "\u0548"], ["\u057A", "\u054A"], ["\u0579", "\u0549"], ["\u057B", "\u054B"], ["'", "\u055E"]],
  [["Caps", "Caps"], ["\u0561", "\u0531"], ["\u057D", "\u054D"], ["\u0564", "\u0534"], ["\u0586", "\u0556"], ["\u0584", "\u0554"], ["\u0570", "\u0540"], ["\u0573", "\u0543"], ["\u056F", "\u053F"], ["\u056C", "\u053C"], ["\u0569", "\u0539"], ["\u0583", "\u0553"], ["Enter", "Enter"]],
  [["Shift", "Shift"], ["\u0566", "\u0536"], ["\u0581", "\u0551"], ["\u0563", "\u0533"], ["\u057E", "\u054E"], ["\u0562", "\u0532"], ["\u0576", "\u0546"], ["\u0574", "\u0544"], ["\u0577", "\u0547"], ["\u0572", "\u0542"], ["\u056E", "\u053E"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " "], ["Alt", "Alt"]]
];

    this.VKI_layout["Armenian Western"] = [ // Armenian Western Standard Keyboard
  [["\u055D", "\u055C"], [":", "1"], ["\u0571", "\u0541"], ["\u0575", "\u0545"], ["\u055B", "3"], [",", "4"], ["-", "9"], [".", "\u0587"], ["\u00AB", "("], ["\u00BB", ")"], ["\u0585", "\u0555"], ["\u057C", "\u054C"], ["\u056A", "\u053A"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["\u056D", "\u053D"], ["\u057E", "\u054E"], ["\u0567", "\u0537"], ["\u0580", "\u0550"], ["\u0564", "\u0534"], ["\u0565", "\u0535"], ["\u0568", "\u0538"], ["\u056B", "\u053B"], ["\u0578", "\u0548"], ["\u0562", "\u0532"], ["\u0579", "\u0549"], ["\u057B", "\u054B"], ["'", "\u055E"]],
  [["Caps", "Caps"], ["\u0561", "\u0531"], ["\u057D", "\u054D"], ["\u057F", "\u054F"], ["\u0586", "\u0556"], ["\u056F", "\u053F"], ["\u0570", "\u0540"], ["\u0573", "\u0543"], ["\u0584", "\u0554"], ["\u056C", "\u053C"], ["\u0569", "\u0539"], ["\u0583", "\u0553"], ["Enter", "Enter"]],
  [["Shift", "Shift"], ["\u0566", "\u0536"], ["\u0581", "\u0551"], ["\u0563", "\u0533"], ["\u0582", "\u0552"], ["\u057A", "\u054A"], ["\u0576", "\u0546"], ["\u0574", "\u0544"], ["\u0577", "\u0547"], ["\u0572", "\u0542"], ["\u056E", "\u053E"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " "], ["Alt", "Alt"]]
];

    this.VKI_layout.Belarusian = [ // Belarusian Standard Keyboard
      [["\u0451", "\u0401"], ["1", "!"], ["2", '"'], ["3", "\u2116"], ["4", ";"], ["5", "%"], ["6", ":"], ["7", "?"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["\u0439", "\u0419"], ["\u0446", "\u0426"], ["\u0443", "\u0423"], ["\u043a", "\u041a"], ["\u0435", "\u0415"], ["\u043d", "\u041d"], ["\u0433", "\u0413"], ["\u0448", "\u0428"], ["\u045e", "\u040e"], ["\u0437", "\u0417"], ["\u0445", "\u0425"], ["'", "'"], ["\\", "/"]],
      [["Caps", "Caps"], ["\u0444", "\u0424"], ["\u044b", "\u042b"], ["\u0432", "\u0412"], ["\u0430", "\u0410"], ["\u043f", "\u041f"], ["\u0440", "\u0420"], ["\u043e", "\u041e"], ["\u043b", "\u041b"], ["\u0434", "\u0414"], ["\u0436", "\u0416"], ["\u044d", "\u042d"], ["Enter", "Enter"]],
      [["Shift", "Shift"], ["/", "|"], ["\u044f", "\u042f"], ["\u0447", "\u0427"], ["\u0441", "\u0421"], ["\u043c", "\u041c"], ["\u0456", "\u0406"], ["\u0442", "\u0422"], ["\u044c", "\u042c"], ["\u0431", "\u0411"], ["\u044e", "\u042e"], [".", ","], ["Shift", "Shift"]],
      [[" ", " "]]
    ];

    this.VKI_layout.Belgian = [ // Belgian Standard Keyboard
      [["\u00b2", "\u00b3"], ["&", "1", "|"], ["\u00e9", "2", "@"], ['"', "3", "#"], ["'", "4"], ["(", "5"], ["\u00a7", "6", "^"], ["\u00e8", "7"], ["!", "8"], ["\u00e7", "9", "{"], ["\u00e0", "0", "}"], [")", "\u00b0"], ["-", "_"], ["Bksp", "Bksp"]],
      [["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"]],
      [["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", "`"]],
      [["Shift", "Shift"], ["<", ">", "\\"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["=", "+", "~"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Bengali = [ // Bengali Standard Keyboard
      [[""], ["1", "", "\u09E7"], ["2", "", "\u09E8"], ["3", "\u09CD\u09B0", "\u09E9"], ["4", "\u09B0\u09CD", "\u09EA"], ["5", "\u099C\u09CD\u09B0", "\u09EB"], ["6", "\u09A4\u09CD\u09B7", "\u09EC"], ["7", "\u0995\u09CD\u09B0", "\u09ED"], ["8", "\u09B6\u09CD\u09B0", "\u09EE"], ["9", "(", "\u09EF"], ["0", ")", "\u09E6"], ["-", "\u0983"], ["\u09C3", "\u098B", "\u09E2", "\u09E0"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["\u09CC", "\u0994", "\u09D7"], ["\u09C8", "\u0990"], ["\u09BE", "\u0986"], ["\u09C0", "\u0988", "\u09E3", "\u09E1"], ["\u09C2", "\u098A"], ["\u09AC", "\u09AD"], ["\u09B9", "\u0999"], ["\u0997", "\u0998"], ["\u09A6", "\u09A7"], ["\u099C", "\u099D"], ["\u09A1", "\u09A2", "\u09DC", "\u09DD"], ["\u09BC", "\u099E"]],
      [["Caps", "Caps"], ["\u09CB", "\u0993", "\u09F4", "\u09F5"], ["\u09C7", "\u098F", "\u09F6", "\u09F7"], ["\u09CD", "\u0985", "\u09F8", "\u09F9"], ["\u09BF", "\u0987", "\u09E2", "\u098C"], ["\u09C1", "\u0989"], ["\u09AA", "\u09AB"], ["\u09B0", "", "\u09F0", "\u09F1"], ["\u0995", "\u0996"], ["\u09A4", "\u09A5"], ["\u099A", "\u099B"], ["\u099F", "\u09A0"], ["Enter", "Enter"]],
      [["Shift", "Shift"], [""], ["\u0982", "\u0981", "\u09FA"], ["\u09AE", "\u09A3"], ["\u09A8"], ["\u09AC"], ["\u09B2"], ["\u09B8", "\u09B6"], [",", "\u09B7"], [".", "{"], ["\u09AF", "\u09DF"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout['Bulgarian Ph'] = [ // Bulgarian Phonetic Keyboard
      [["\u0447", "\u0427"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["\u044F", "\u042F"], ["\u0432", "\u0412"], ["\u0435", "\u0415"], ["\u0440", "\u0420"], ["\u0442", "\u0422"], ["\u044A", "\u042A"], ["\u0443", "\u0423"], ["\u0438", "\u0418"], ["\u043E", "\u041E"], ["\u043F", "\u041F"], ["\u0448", "\u0428"], ["\u0449", "\u0429"], ["\u044E", "\u042E"]],
      [["Caps", "Caps"], ["\u0430", "\u0410"], ["\u0441", "\u0421"], ["\u0434", "\u0414"], ["\u0444", "\u0424"], ["\u0433", "\u0413"], ["\u0445", "\u0425"], ["\u0439", "\u0419"], ["\u043A", "\u041A"], ["\u043B", "\u041B"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
      [["Shift", "Shift"], ["\u0437", "\u0417"], ["\u044C", "\u042C"], ["\u0446", "\u0426"], ["\u0436", "\u0416"], ["\u0431", "\u0411"], ["\u043D", "\u041D"], ["\u043C", "\u041C"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
      [[" ", " "]]
    ];

    this.VKI_layout.Burmese = [ // Burmese Keyboard
      [["\u1039`", "~"], ["\u1041", "\u100D"], ["\u1042", "\u100E"], ["\u1043", "\u100B"], ["\u1044", "\u1000\u103B\u1015\u103A"], ["\u1045", "%"], ["\u1046", "\u002F"], ["\u1047", "\u101B"], ["\u1048", "\u1002"], ["\u1049", "("], ["\u1040", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
      [["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"]],
      [["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"]],
      [["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"]],
      [[" ", " "]]
    ];

    this.VKI_layout.Czech = [ // Czech Keyboard
     [[";", "\u00b0", "`", "~"], ["+", "1", "!"], ["\u011B", "2", "@"], ["\u0161", "3", "#"], ["\u010D", "4", "$"], ["\u0159", "5", "%"], ["\u017E", "6", "^"], ["\u00FD", "7", "&"], ["\u00E1", "8", "*"], ["\u00ED", "9", "("], ["\u00E9", "0", ")"], ["=", "%", "-", "_"], ["\u00B4", "\u02c7", "=", "+"], ["Bksp", "Bksp"]],
     [["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"]],
     [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u016F", '"', ";", ":"], ["\u00A7", "!", "\u00a4", "^"], ["\u00A8", "'", "\\", "|"]],
     [["Shift", "Shift"], ["\\", "|", "", "\u02dd"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "?", "<", "\u00d7"], [".", ":", ">", "\u00f7"], ["-", "_", "/", "?"], ["Shift", "Shift"]],
     [[" ", " ", " ", " "], ["Alt", "Alt"]]
    ];

    this.VKI_layout.Croatian = [ // Croatian Standard Keyboard
  [["\u00B8", "\u00A8"], ["1", "!", "~"], ["2", '"', "\u02C7"], ["3", "#", "^"], ["4", "$", "\u02D8"], ["5", "%", "\u00B0"], ["6", "&", "\u02DB"], ["7", "/", "`"], ["8", "(", "\u02D9"], ["9", ")", "\u00B4"], ["0", "=", "\u02DD"], ["'", "?", "\u00A8"], ["+", "*", "\u00B8"], ["Bksp", "Bksp"]],
  [["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"]],
  [["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"]],
  [["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{"], ["n", "N", "}"], ["m", "M", "\u00A7"], [",", ";", "<"], [".", ":", ">"], ["-", "_"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

    this.VKI_layout.Danish = [ // Danish Standard Keyboard
      [["\u00bd", "\u00a7"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00a3"], ["4", "\u00a4", "$"], ["5", "%", "\u20ac"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?"], ["\u00b4", "`", "|"], ["Bksp", "Bksp"]],
      [["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"]],
      [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00e6", "\u00c6"], ["\u00f8", "\u00d8"], ["'", "*"]],
      [["Shift", "Shift"], ["<", ">", "\\"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u03bc", "\u039c"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Dutch = [ // Dutch Standard Keyboard
      [["@", "\u00a7", "\u00ac"], ["1", "!", "\u00b9"], ["2", '"', "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00bc"], ["5", "%", "\u00bd"], ["6", "&", "\u00be"], ["7", "_", "\u00a3"], ["8", "(", "{"], ["9", ")", "}"], ["0", "'"], ["/", "?", "\\"], ["\u00b0", "~", "\u00b8"], ["Bksp", "Bksp"]],
      [["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", "^"], ["*", "|"], ["<", ">"]],
      [["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"]],
      [["Shift", "Shift"], ["]", "[", "\u00a6"], ["z", "Z", "\u00ab"], ["x", "X", "\u00bb"], ["c", "C", "\u00a2"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u00b5"], [",", ";"], [".", ":", "\u00b7"], ["-", "="], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

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

    this.VKI_layout.Estonian = [ // Estonian Standard Keyboard
  [["\u02C7", "~"], ["1", "!"], ["2", '"', "@", "@"], ["3", "#", "\u00A3", "\u00A3"], ["4", "\u00A4", "$", "$"], ["5", "%", "\u20AC"], ["6", "&"], ["7", "/", "{", "{"], ["8", "(", "[", "["], ["9", ")", "]", "]"], ["0", "=", "}", "}"], ["+", "?", "\\", "\\"], ["\u00B4", "`"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20AC"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00FC", "\u00DC"], ["\u00F5", "\u00D5", "\u00A7", "\u00A7"], ["Enter", "Enter"]],
  [["Caps", "Caps"], ["a", "A"], ["s", "S", "\u0161", "\u0160"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00F6", "\u00D6"], ["\u00E4", "\u00C4", "^", "^"], ["'", "*", "\u00BD", "\u00BD"]],
  [["Shift", "Shift"], ["<", ">", "|", "|"], ["z", "Z", "\u017E", "\u017D"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

    this.VKI_layout.Farsi = [ // Farsi Keyboard
      [["\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"]],
      [["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"]],
      [["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"]],
      [["Shift", "Shift"], ["\u0626", "\u007e"], ["\u0621", "\u0652"], ["\u0632", "\u007d"], ["\u0631", "\u007b"], ["\u0630", "\u0644"], ["\u062f", "\u0622"], ["\u0626", "\u0621"], ["\u0648", "\u002c"], [".", "\u002e"], ["/", "\u061f"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["Alt", "Alt"]]
    ];

    this.VKI_layout.Finnish = [ // Finnish Standard Keyboard
  [["\u00A7", "\u00BD"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00A3"], ["4", "\u00A4", "$"], ["5", "%", "\u20AC"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?", "\\"], ["\u00B4", "`"], ["Bksp", "Bksp"]],
  [["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"]],
  [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00F6", "\u00D6"], ["\u00E4", "\u00C4"], ["'", "*"]],
  [["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u00B5"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

    this.VKI_layout.French = [ // French Standard Keyboard
      [["\u00b2", "\u00b3"], ["&", "1"], ["\u00e9", "2", "~"], ['"', "3", "#"], ["'", "4", "{"], ["(", "5", "["], ["-", "6", "|"], ["\u00e8", "7", "\u0060"], ["_", "8", "\\"], ["\u00e7", "9", "\u005e"], ["\u00e0", "0", "\u0040"], [")", "\u00b0", "]"], ["=", "+", "}"], ["Bksp", "Bksp"]],
      [["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"]],
      [["Caps", "Caps"], ["q", "Q"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["m", "M"], ["\u00f9", "%"], ["*", "\u03bc"]],
      [["Shift", "Shift"], ["<", ">"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["!", "\u00a7"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.German = [ // German Standard Keyboard
      [["\u005e", "\u00b0"], ["1", "!"], ["2", '"', "\u00b2"], ["3", "\u00a7", "\u00b3"], ["4", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["\u00df", "?", "\\"], ["\u00b4", "\u0060"], ["Bksp", "Bksp"]],
      [["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"]],
      [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f6", "\u00d6"], ["\u00e4", "\u00c4"], ["#", "'"]],
      [["Shift", "Shift"], ["<", ">", "\u00a6"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u00b5"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Greek = [ // Greek Standard Keyboard
      [["`", "~"], ["1", "!"], ["2", "@", "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00a3"], ["5", "%", "\u00a7"], ["6", "^", "\u00b6"], ["7", "&"], ["8", "*", "\u00a4"], ["9", "(", "\u00a6"], ["0", ")", "\u00ba"], ["-", "_", "\u00b1"], ["=", "+", "\u00bd"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], [";", ":"], ["\u03c2", "^"], ["\u03b5", "\u0395"], ["\u03c1", "\u03a1"], ["\u03c4", "\u03a4"], ["\u03c5", "\u03a5"], ["\u03b8", "\u0398"], ["\u03b9", "\u0399"], ["\u03bf", "\u039f"], ["\u03c0", "\u03a0"], ["[", "{", "\u201c"], ["]", "}", "\u201d"], ["Enter", "Enter"]],
      [["Caps", "Caps"], ["\u03b1", "\u0391"], ["\u03c3", "\u03a3"], ["\u03b4", "\u0394"], ["\u03c6", "\u03a6"], ["\u03b3", "\u0393"], ["\u03b7", "\u0397"], ["\u03be", "\u039e"], ["\u03ba", "\u039a"], ["\u03bb", "\u039b"], ["\u0384", "\u00a8", "\u0385"], ["'", '"'], ["\\", "|", "\u00ac"]],
      [["Shift", "Shift"], ["<", ">"], ["\u03b6", "\u0396"], ["\u03c7", "\u03a7"], ["\u03c8", "\u03a8"], ["\u03c9", "\u03a9"], ["\u03b2", "\u0392"], ["\u03bd", "\u039d"], ["\u03bc", "\u039c"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Gujarati = [ // Gujarati Standard Keyboard
  [[""], ["1", "\u0A8D", "\u0AE7"], ["2", "\u0AC5", "\u0AE8"], ["3", "\u0ACD\u0AB0", "\u0AE9"], ["4", "\u0AB0\u0ACD", "\u0AEA"], ["5", "\u0A9C\u0ACD\u0A9E", "\u0AEB"], ["6", "\u0AA4\u0ACD\u0AB0", "\u0AEC"], ["7", "\u0A95\u0ACD\u0AB7", "\u0AED"], ["8", "\u0AB6\u0ACD\u0AB0", "\u0AEE"], ["9", "(", "\u0AEF"], ["0", ")", "\u0AE6"], ["-", "\u0A83"], ["\u0AC3", "\u0A8B", "\u0AC4", "\u0AE0"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["\u0ACC", "\u0A94"], ["\u0AC8", "\u0A90"], ["\u0ABE", "\u0A86"], ["\u0AC0", "\u0A88"], ["\u0AC2", "\u0A8A"], ["\u0AAC", "\u0AAD"], ["\u0AB9", "\u0A99"], ["\u0A97", "\u0A98"], ["\u0AA6", "\u0AA7"], ["\u0A9C", "\u0A9D"], ["\u0AA1", "\u0AA2"], ["\u0ABC", "\u0A9E"], ["\u0AC9", "\u0A91"]],
  [["Caps", "Caps"], ["\u0ACB", "\u0A93"], ["\u0AC7", "\u0A8F"], ["\u0ACD", "\u0A85"], ["\u0ABF", "\u0A87"], ["\u0AC1", "\u0A89"], ["\u0AAA", "\u0AAB"], ["\u0AB0"], ["\u0A95", "\u0A96"], ["\u0AA4", "\u0AA5"], ["\u0A9A", "\u0A9B"], ["\u0A9F", "\u0AA0"], ["Enter", "Enter"]],
  [["Shift", "Shift"], [""], ["\u0A82", "\u0A81", "", "\u0AD0"], ["\u0AAE", "\u0AA3"], ["\u0AA8"], ["\u0AB5"], ["\u0AB2", "\u0AB3"], ["\u0AB8", "\u0AB6"], [",", "\u0AB7"], [".", "\u0964", "\u0965", "\u0ABD"], ["\u0AAF"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

    this.VKI_layout.Hebrew = [ // Hebrew Standard Keyboard
      [["~", "`"], ["1", "!"], ["2", "@"], ["3", "#"], ["4" , "$", "\u20aa"], ["5" , "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", ")"], ["0", "("], ["-", "_"], ["=", "+"], ["\\", "|"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["/", "Q"], ["'", "W"], ["\u05e7", "E", "\u20ac"], ["\u05e8", "R"], ["\u05d0", "T"], ["\u05d8", "Y"], ["\u05d5", "U", "\u05f0"], ["\u05df", "I"], ["\u05dd", "O"], ["\u05e4", "P"], ["]", "}"], ["[", "{"]],
      [["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"]],
      [["Shift", "Shift"], ["\u05d6", "Z"], ["\u05e1", "X"], ["\u05d1", "C"], ["\u05d4", "V"], ["\u05e0", "B"], ["\u05de", "N"], ["\u05e6", "M"], ["\u05ea", ">"], ["\u05e5", "<"], [".", "?"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Hindi = [ // Hindi Traditional Keyboard
      [["\u200d", "\u200c", "`", "~"], ["1", "\u090D", "\u0967", "!"], ["2", "\u0945", "\u0968", "@"], ["3", "\u094D\u0930", "\u0969", "#"], ["4", "\u0930\u094D", "\u096A", "$"], ["5", "\u091C\u094D\u091E", "\u096B", "%"], ["6", "\u0924\u094D\u0930", "\u096C", "^"], ["7", "\u0915\u094D\u0937", "\u096D", "&"], ["8", "\u0936\u094D\u0930", "\u096E", "*"], ["9", "(", "\u096F", "("], ["0", ")", "\u0966", ")"], ["-", "\u0903", "-", "_"], ["\u0943", "\u090B", "=", "+"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["\u094C", "\u0914"], ["\u0948", "\u0910"], ["\u093E", "\u0906"], ["\u0940", "\u0908"], ["\u0942", "\u090A"], ["\u092C", "\u092D"], ["\u0939", "\u0919"], ["\u0917", "\u0918"], ["\u0926", "\u0927"], ["\u091C", "\u091D"], ["\u0921", "\u0922", "[", "{"], ["\u093C", "\u091E", "]", "}"], ["Enter", "Enter"]],
      [["Caps", "Caps"], ["\u094B", "\u0913"], ["\u0947", "\u090F"], ["\u094D", "\u0905"], ["\u093F", "\u0907"], ["\u0941", "\u0909"], ["\u092A", "\u092B"], ["\u0930", "\u0931"], ["\u0915", "\u0916"], ["\u0924", "\u0925"], ["\u091A", "\u091B", ";", ":"], ["\u091F", "\u0920", "'", '"'], ["\u0949", "\u0911", "\\", "|"]],
      [["Shift", "Shift"], [""], ["\u0902", "\u0901", "", "\u0950"], ["\u092E", "\u0923"], ["\u0928"], ["\u0935"], ["\u0932", "\u0933"], ["\u0938", "\u0936"], [",", "\u0937", ",", "<"], [".", "\u0964", ".", ">"], ["\u092F", "\u095F", "/", "?"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Hungarian = [ // Hungarian Standard Keyboard
      [["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"]],
      [["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"]],
      [["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"]],
      [["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"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Italian = [ // Italian Standard Keyboard
      [["\u005c", "\u007c"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "&"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["\u00ec", "\u005e"], ["Bksp", "Bksp"]],
      [["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"]],
      [["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"]],
      [["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Kazakh = [ // Kazakh Standard Keyboard
      [["(", ")"], ['"', "!"], ["\u04d9", "\u04d8"], ["\u0456", "\u0406"], ["\u04a3", "\u04a2"], ["\u0493", "\u0492"], [",", ";"], [".", ":"], ["\u04af", "\u04ae"], ["\u04b1", "\u04b0"], ["\u049b", "\u049a"], ["\u04e9", "\u04e8"], ["\u04bb", "\u04ba"], ["Bksp", "Bksp"]],
      [["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"], ["\\", "/"]],
      [["Caps", "Caps"], ["\u0444", "\u0424"], ["\u044B", "\u042B"], ["\u0432", "\u0412"], ["\u0430", "\u0410"], ["\u043F", "\u041F"], ["\u0440", "\u0420"], ["\u043E", "\u041E"], ["\u043B", "\u041B"], ["\u0434", "\u0414"], ["\u0436", "\u0416"], ["\u044D", "\u042D"], ["Enter", "Enter"]],
      [["Shift", "Shift"], ["\\", "|"], ["\u044F", "\u042F"], ["\u0447", "\u0427"], ["\u0441", "\u0421"], ["\u043C", "\u041C"], ["\u0438", "\u0418"], ["\u0442", "\u0422"], ["\u044C", "\u042C"], ["\u0431", "\u0411"], ["\u044E", "\u042E"], ["\u2116", "?"], ["Shift", "Shift"]],
      [[" ", " "]]
    ];

    this.VKI_layout.Lithuanian = [ // Lithuanian Standard Keyboard
      [["`", "~"], ["\u0105", "\u0104"], ["\u010D", "\u010C"], ["\u0119", "\u0118"], ["\u0117", "\u0116"], ["\u012F", "\u012E"], ["\u0161", "\u0160"], ["\u0173", "\u0172"], ["\u016B", "\u016A"], ["\u201E", "("], ["\u201C", ")"], ["-", "_"], ["\u017E", "\u017D"], ["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"], ["\u2013", "\u20AC"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
      [[" ", " "]]
    ];

    this.VKI_layout.Marathi = [ // Marathi Standard Keyboard
  [[" ", "", "`", "~"], ["\u0967", "\u090D", "1", "!"], ["\u0968", "\u0945", "2", "@"], ["\u0969", "\u094D\u0930", "3", "#"], ["\u096A", "\u0930\u094D", "4", "$"], ["\u096B", "\u091C\u094D\u091E", "5", "%"], ["\u096C", "\u0924\u094D\u0930", "6", "^"], ["\u096D", "\u0915\u094D\u0937", "7", "&"], ["\u096E", "\u0936\u094D\u0930", "8", "*"], ["\u096F", "(", "9", "("], ["\u0966", ")", "0", ")"], ["-", "\u0903", "-", "_"], ["\u0943", "\u090B", "=", "+"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["\u094C", "\u0914"], ["\u0948", "\u0910"], ["\u093E", "\u0906"], ["\u0940", "\u0908"], ["\u0942", "\u090A"], ["\u092C", "\u092D"], ["\u0939", "\u0919"], ["\u0917", "\u0918"], ["\u0926", "\u0927"], ["\u091C", "\u091D"], ["\u0921", "\u0922", "[", "{"], ["\u093C", "\u091E", "]", "}"], ["Enter", "Enter"]],
  [["Caps", "Caps"], ["\u094B", "\u0913"], ["\u0947", "\u090F"], ["\u094D", "\u0905"], ["\u093F", "\u0907"], ["\u0941", "\u0909"], ["\u092A", "\u092B"], ["\u0930", "\u0931"], ["\u0915", "\u0916"], ["\u0924", "\u0925"], ["\u091A", "\u091B", ";", ":"], ["\u091F", "\u0920", "'", '"'], ["\u0949", "\u0911", "\\", "|"]],
  [["Shift", "Shift"], [""], ["\u0902", "\u0901", "", "\u0950"], ["\u092E", "\u0923"], ["\u0928"], ["\u0935"], ["\u0932", "\u0933"], ["\u0938", "\u0936"], [",", "\u0937", ",", "<"], [".", "\u0964", ".", ">"], ["\u092F", "\u095F", "/", "?"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

    this.VKI_layout.Norwegian = [ // Norwegian Standard Keyboard
      [["|", "\u00a7"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00a3"], ["4", "\u00a4", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?"], ["\\", "`", "\u00b4"], ["Bksp", "Bksp"]],
      [["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"]],
      [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f8", "\u00d8"], ["\u00e6", "\u00c6"], ["'", "*"]],
      [["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u03bc", "\u039c"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Numpad = [ // Number pad
      [["$"], ["\u00a3"], ["\u20ac"], ["\u00a5"], ["/"], ["^"], ["Bksp", "Bksp"]],
      [["."], ["7"], ["8"], ["9"], ["*"], ["<"], ["("], ["["]],
      [["="], ["4"], ["5"], ["6"], ["-"], [">"], [")"], ["]"]],
      [["0"], ["1"], ["2"], ["3"], ["+"], ["Enter", "Enter"]],
      [[" "]]
    ];
    this.VKI_layout.Numpad.DDK = true;

    this.VKI_layout.Pinyin = [ // Pinyin Keyboard
      [["`", "~", "\u4e93", "\u301C"], ["1", "!", "\uFF62"], ["2", "@", "\uFF63"], ["3", "#", "\u301D"], ["4", "$", "\u301E"], ["5", "%", "\u301F"], ["6", "^", "\u3008"], ["7", "&", "\u3009"], ["8", "*", "\u302F"], ["9", "(", "\u300A"], ["0", ")", "\u300B"], ["-", "_", "\u300E"], ["=", "+", "\u300F"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["q", "Q", "\u0101", "\u0100"], ["w", "W", "\u00E1", "\u00C1"], ["e", "E", "\u01CE", "\u01CD"], ["r", "R", "\u00E0", "\u00C0"], ["t", "T", "\u0113", "\u0112"], ["y", "Y", "\u00E9", "\u00C9"], ["u", "U", "\u011B", "\u011A"], ["i", "I", "\u00E8", "\u00C8"], ["o", "O", "\u012B", "\u012A"], ["p", "P", "\u00ED", "\u00CD"], ["[", "{", "\u01D0", "\u01CF"], ["]", "}", "\u00EC", "\u00CC"], ["\\", "|", "\u3020"]],
      [["Caps", "Caps"], ["a", "A", "\u014D", "\u014C"], ["s", "S", "\u00F3", "\u00D3"], ["d", "D", "\u01D2", "\u01D1"], ["f", "F", "\u00F2", "\u00D2"], ["g", "G", "\u00fc", "\u00dc"], ["h", "H", "\u016B", "\u016A"], ["j", "J", "\u00FA", "\u00DA"], ["k", "K", "\u01D4", "\u01D3"], ["l", "L", "\u00F9", "\u00D9"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
      [["Shift", "Shift"], ["z", "Z", "\u01D6", "\u01D5"], ["x", "X", "\u01D8", "\u01D7"], ["c", "C", "\u01DA", "\u01D9"], ["v", "V", "\u01DC", "\u01DB"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<", "\u3001"], [".", ">", "\u3002"], ["/", "?"], ["Shift", "Shift"]],
      [["AltLk", "AltLk"], [" ", " ", " ", " "], ["Alt", "Alt"]]
    ];

    this.VKI_layout["Polish Prog"] = [ // Polish Programmers Keyboard
      [["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
      [["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"], ["[", "{"], ["]", "}"], ["\\", "|"]],
      [["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"]],
      [["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"]],
      [[" ", " ", " ", " "], ["Alt", "Alt"]]
    ];

    this.VKI_layout["Portuguese Br"] = [ // Portuguese (Brazil) Standard Keyboard
      [["'", '"'], ["1", "!", "\u00b9"], ["2", "@", "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00a3"], ["5", "%", "\u00a2"], ["6", "\u00a8", "\u00ac"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+", "\u00a7"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["q", "Q", "/"], ["w", "W", "?"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00b4", "`"], ["[", "{", "\u00aa"], ["Enter", "Enter"]],
      [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00e7", "\u00c7"], ["~", "^"], ["]", "}", "\u00ba"], ["/", "?"]],
      [["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C", "\u20a2"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], [":", ":"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout["Portuguese Pt"] = [ // Portuguese (Portugal) Standard Keyboard
      [["\\", "|"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00a3"], ["4", "$", "\u00a7"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["'", "?"], ["\u00ab", "\u00bb"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["+", "*", "\u00a8"], ["\u00b4", "`"], ["Enter", "Enter"]],
      [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00e7", "\u00c7"], ["\u00ba", "\u00aa"], ["~", "^"]],
      [["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
     [["\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"]],
     [["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", "\\", "|"]],
     [["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"]],
     [["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C", "\u00A9"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";", "<", "\u00AB"], [".", ":", ">", "\u00BB"], ["/", "?"], ["Shift", "Shift"]],
     [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Russian = [ // Russian Standard Keyboard
      [["\u0451", "\u0401"], ["1", "!"], ["2", '"'], ["3", "\u2116"], ["4", ";"], ["5", "%"], ["6", ":"], ["7", "?"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
      [["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"]],
      [["Caps", "Caps"], ["\u0444", "\u0424"], ["\u044B", "\u042B"], ["\u0432", "\u0412"], ["\u0430", "\u0410"], ["\u043F", "\u041F"], ["\u0440", "\u0420"], ["\u043E", "\u041E"], ["\u043B", "\u041B"], ["\u0434", "\u0414"], ["\u0436", "\u0416"], ["\u044D", "\u042D"], ["\\", "/"]],
      [["Shift", "Shift"], ["/", "|"], ["\u044F", "\u042F"], ["\u0447", "\u0427"], ["\u0441", "\u0421"], ["\u043C", "\u041C"], ["\u0438", "\u0418"], ["\u0442", "\u0422"], ["\u044C", "\u042C"], ["\u0431", "\u0411"], ["\u044E", "\u042E"], [".", ","], ["Shift", "Shift"]],
      [[" ", " "]]
    ];

    this.VKI_layout.SerbianCyr = [ // Serbian Cyrillic Standard Keyboard
      [["`", "~"], ["1", "!"], ["2", '"'], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "&"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["+", "*"], ["Bksp", "Bksp"]],
      [["Tab", "Tab"], ["\u0459", "\u0409"], ["\u045a", "\u040a"], ["\u0435", "\u0415", "\u20ac"], ["\u0440", "\u0420"], ["\u0442", "\u0422"], ["\u0437", "\u0417"], ["\u0443", "\u0423"], ["\u0438", "\u0418"], ["\u043e", "\u041e"], ["\u043f", "\u041f"], ["\u0448", "\u0428"], ["\u0452", "\u0402"], ["Enter", "Enter"]],
      [["Caps", "Caps"], ["\u0430", "\u0410"], ["\u0441", "\u0421"], ["\u0434", "\u0414"], ["\u0444", "\u0424"], ["\u0433", "\u0413"], ["\u0445", "\u0425"], ["\u0458", "\u0408"], ["\u043a", "\u041a"], ["\u043b", "\u041b"], ["\u0447", "\u0427"], ["\u045b", "\u040b"], ["\u0436", "\u0416"]],
      [["Shift", "Shift"], ["<", ">"], ["\u0455", "\u0405"], ["\u045f", "\u040f"], ["\u0446", "\u0426"], ["\u0432", "\u0412"], ["\u0431", "\u0411"], ["\u043d", "\u041d"], ["\u043c", "\u041c"], [",", ";", "<"], [".", ":", ">"], ["-", "_", "\u00a9"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.SerbianLat = [ // Serbian Latin Standard Keyboard
      [["\u201a", "~"], ["1", "!", "~"], ["2", '"', "\u02c7"], ["3", "#", "^"], ["4", "$", "\u02d8"], ["5", "%", "\u00b0"], ["6", "&", "\u02db"], ["7", "/", "`"], ["8", "(", "\u02d9"], ["9", ")", "\u00b4"], ["0", "=", "\u02dd"], ["'", "?", "\u00a8"], ["+", "*", "\u00b8"], ["Bksp", "Bksp"]],
      [["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"]],
      [["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"]],
      [["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{",], ["n", "N", "}"], ["m", "M", "\u00a7"], [",", ";", "<"], [".", ":", ">"], ["-", "_", "\u00a9"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Slovak = [ // Slovak Keyboard
     [[";", "\u00b0"], ["+", "1", "~"], ["\u013E", "2", "\u02C7"], ["\u0161", "3", "\u005E"], ["\u010D", "4", "\u02D8"], ["\u0165", "5", "\u00B0"], ["\u017E", "6", "\u02DB"], ["\u00FD", "7", "\u0060"], ["\u00E1", "8", "\u02D9"], ["\u00ED", "9", "\u00B4"], ["\u00E9", "0", "\u02DD"], ["=", "%", "\u00A8"], ["\u00B4", "\u02c7", "\u00B8"], ["Bksp", "Bksp"]],
     [["Tab", "Tab"], ["q", "Q","\u005C"], ["w", "W","\u007C"], ["e", "E", "\u20AC"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P","\u0027"], ["\u00FA", "/", "\u00F7"], ["\u00E4", "(", "\u00D7"], ["Enter", "Enter"]],
     [["Caps", "Caps"], ["a", "A"], ["s", "S","\u0111"], ["d", "D","\u0110"], ["f", "F","\u005B"], ["g", "G","\u005D"], ["h", "H"], ["j", "J"], ["k", "K","\u0142"], ["l", "L","\u0141"], ["\u00F4", '"', "\u0024"], ["\u00A7", "!", "\u00DF",], ["\u0148", ")","\u00A4"]],
     [["Shift", "Shift"], ["&", "*", "\u003C"], ["y", "Y","\u003E"], ["x", "X","\u0023"], ["c", "C","\u0026"], ["v", "V","\u0040"], ["b", "B","\u007B"], ["n", "N","\u007D"], ["m", "M"], [",", "?", "<"], [".", ":", ">"], ["-", "_", "\u002A", ], ["Shift", "Shift"]],
     [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.Slovenian = [ // Slovenian Standard Keyboard
      [["\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"]],
      [["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"]],
      [["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"]],
      [["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{",], ["n", "N", "}"], ["m", "M", "\u00a7"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

    this.VKI_layout["Spanish Es"] = [ // Spanish (Spain) Standard Keyboard
      [["\u00ba", "\u00aa", "\\"], ["1", "!", "|"], ["2", '"', "@"], ["3", "'", "#"], ["4", "$", "~"], ["5", "%", "\u20ac"], ["6", "&","\u00ac"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["\u00a1", "\u00bf"], ["Bksp", "Bksp"]],
      [["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"]],
      [["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", "}"]],
      [["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
      [["\u00a7", "\u00bd"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00a3"], ["4", "\u00a4", "$"], ["5", "%", "\u20ac"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?", "\\"], ["\u00b4", "`"], ["Bksp", "Bksp"]],
      [["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"]],
      [["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f6", "\u00d6"], ["\u00e4", "\u00c4"], ["'", "*"]],
      [["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u03bc", "\u039c"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "], ["AltGr", "AltGr"]]
    ];

this.VKI_layout.Tamil = [ // Tamil Standard Keyboard
  [["\u0BCA", "\u0B92"], ["1", "", "\u0BE7"], ["2", "", "\u0BE8"], ["3", "", "\u0BE9"], ["4", "", "\u0BEA"], ["5", "", "\u0BEB"], ["6", "\u0BA4\u0BCD\u0BB0", "\u0BEC"], ["7", "\u0B95\u0BCD\u0BB7", "\u0BED"], ["8", "\u0BB7\u0BCD\u0BB0", "\u0BEE"], ["9", "", "\u0BEF"], ["0", "", "\u0BF0"], ["-", "\u0B83", "\u0BF1"], [" ", "", "\u0BF2"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["\u0BCC", "\u0B94"], ["\u0BC8", "\u0B90"], ["\u0BBE", "\u0B86"], ["\u0BC0", "\u0B88"], ["\u0BC2", "\u0B8A"], ["\u0BAA", "\u0BAA"], ["\u0BB9", "\u0B99"], ["\u0B95", "\u0B95"], ["\u0BA4", "\u0BA4"], ["\u0B9C", "\u0B9A"], ["\u0B9F", "\u0B9F"], ["\u0B9E"], ["Enter", "Enter"]],
  [["Caps", "Caps"], ["\u0BCB", "\u0B93"], ["\u0BC7", "\u0B8F"], ["\u0BCD", "\u0B85"], ["\u0BBF", "\u0B87"], ["\u0BC1", "\u0B89"], ["\u0BAA", "\u0BAA"], ["\u0BB0", "\u0BB1"], ["\u0B95", "\u0B95"], ["\u0BA4", "\u0BA4"], ["\u0B9A", "\u0B9A"], ["\u0B9F", "\u0B9F"], [""]],
  [["Shift", "Shift"], ["\u0BC6", "\u0B8E"], [""], ["\u0BAE", "\u0BA3"], ["\u0BA8", "\u0BA9"], ["\u0BB5", "\u0BB4"], ["\u0BB2", "\u0BB3"], ["\u0BB8", "\u0BB7"], [",", "\u0BB7"], [".", "\u0BB8\u0BCD\u0BB0\u0BC0"], ["\u0BAF", "\u0BAF"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

    this.VKI_layout["Turkish-F"] = [ // Turkish F Keyboard Layout
      [['+', "*", "\u00ac"], ["1", "!", "\u00b9", "\u00a1"], ["2", '"', "\u00b2"], ["3", "^", "#", "\u00b3"], ["4", "$", "\u00bc", "\u00a4"], ["5", "%", "\u00bd"], ["6", "&", "\u00be"], ["7", "'", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["/", "?", "\\", "\u00bf"], ["-", "_", "|"], ["Bksp", "Bksp"]],
      [["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"]],
      [["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", "`"]],
      [["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"]],
      [[" ", " ", " ", " "],  ["AltGr", "AltGr"]]
    ];

    this.VKI_layout["Turkish-Q"] = [ // Turkish Q Keyboard Layout
      [['"', "\u00e9", "<"], ["1", "!", ">"], ["2", "'", "\u00a3"], ["3", "^", "#"], ["4", "+", "$"], ["5", "%", "\u00bd"], ["6", "&"], ["7", "/", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["*", "?", "\\"], ["-", "_", "|"], ["Bksp", "Bksp"]],
      [["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"]],
      [["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"], [",", ";", "`"]],
      [["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], ["\u00f6", "\u00d6"], ["\u00e7", "\u00c7"], [".", ":"], ["Shift", "Shift"]],
      [[" ", " ", " ", " "],  ["AltGr", "AltGr"]]
    ];

    this.VKI_layout.UK = [ // UK Standard Keyboard
      [["`", "\u00ac", "\u00a6"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
      [["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"]],
      [["Caps", "Caps"], ["a", "A", "\u00e1", "\u00c1"], ["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.US = [ // US 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"]],
      [[" ", " "]]
    ];

    this.VKI_layout["US Int'l"] = [ // US International Keyboard
      [["`", "~"], ["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"], ["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"]],
      [["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"]],
      [["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"]],
      [[" ", " ", " ", " "], ["Alt", "Alt"]]
    ];

    this.VKI_layout.Vietnamese = [ // Vietnamese Standard Keyboard
  [["`", "~", "`", "~"], ["\u0103", "\u0102", "1", "!"], ["\u00E2", "\u00C2", "2", "@"], ["\u00EA", "\u00CA", "3", "#"], ["\u00F4", "\u00D4", "4", "$"], ["\u0300", "\u0300", "5", "%"], ["\u0309", "\u0309", "6", "^"], ["\u0303", "\u0303", "7", "&"], ["\u0301", "\u0301", "8", "*"], ["\u0323", "\u0323", "9", "("], ["\u0111", "\u0110", "0", ")"], ["-", "_", "-", "_"], ["\u20AB", "+", "=", "+"], ["Bksp", "Bksp"]],
  [["Tab", "Tab"], ["q", "Q", "q", "Q"], ["w", "W", "w", "W"], ["e", "E", "e", "E"], ["r", "R", "r", "R"], ["t", "T", "t", "T"], ["y", "Y", "y", "Y"], ["u", "U", "u", "U"], ["i", "I", "i", "I"], ["o", "O", "o", "O"], ["p", "P", "p", "P"], ["\u01B0", "\u01AF", "[", "{"], ["\u01A1", "\u01A0", "]", "}"], ["Enter", "Enter"]],
  [["Caps", "Caps"], ["a", "A", "a", "A"], ["s", "S", "s", "S"], ["d", "D", "d", "D"], ["f", "F", "f", "F"], ["g", "G", "g", "G"], ["h", "H", "h", "H"], ["j", "J", "j", "J"], ["k", "K", "k", "K"], ["l", "L", "l", "L"], [";", ":", ";", ":"], ["'", '"', "'", '"'], ["\\", "|", "\\", "|"]],
  [["Shift", "Shift"], ["z", "Z", "z", "Z"], ["x", "X", "x", "X"], ["c", "C", "c", "C"], ["v", "V", "v", "V"], ["b", "B", "b", "B"], ["n", "N", "n", "N"], ["m", "M", "m", "M"], [",", "<", ",", "<"], [".", ">", ".", ">"], ["/", "?", "/", "?"], ["Shift", "Shift"]],
  [["Alt", "Alt"], [" ", " ", " ", " "], ["AltGr", "AltGr"]]
];

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

    this.VKI_deadkey['"'] = this.VKI_deadkey['\u00a8'] = [ // Umlaut / Diaeresis / Greek Dialytika
      ["a", "\u00e4"], ["e", "\u00eb"], ["i", "\u00ef"], ["o", "\u00f6"], ["u", "\u00fc"], ["y", "\u00ff"], ["\u03b9", "\u03ca"], ["\u03c5", "\u03cb"], ["\u016B", "\u01D6"], ["\u00FA", "\u01D8"], ["\u01D4", "\u01DA"], ["\u00F9", "\u01DC"],
      ["A", "\u00c4"], ["E", "\u00cb"], ["I", "\u00cf"], ["O", "\u00d6"], ["U", "\u00dc"], ["Y", "\u0178"], ["\u0399", "\u03aa"], ["\u03a5", "\u03ab"], ["\u016A", "\u01D5"], ["\u00DA", "\u01D7"], ["\u01D3", "\u01D9"], ["\u00D9", "\u01DB"]
    ];
    this.VKI_deadkey['~'] = [ // Tilde / Stroke
      ["a", "\u00e3"], ["l", "\u0142"], ["n", "\u00f1"], ["o", "\u00f5"],
      ["A", "\u00c3"], ["L", "\u0141"], ["N", "\u00d1"], ["O", "\u00d5"]
    ];
    this.VKI_deadkey['^'] = [ // Circumflex
      ["a", "\u00e2"], ["e", "\u00ea"], ["i", "\u00ee"], ["o", "\u00f4"], ["u", "\u00fb"], ["w", "\u0175"], ["y", "\u0177"],
      ["A", "\u00c2"], ["E", "\u00ca"], ["I", "\u00ce"], ["O", "\u00d4"], ["U", "\u00db"], ["W", "\u0174"], ["Y", "\u0176"]
    ];
    this.VKI_deadkey['\u02c7'] = [ // Baltic caron
      ["c", "\u010D"], ["d", "\u010f"], ["e", "\u011b"], ["s", "\u0161"], ["l", "\u013e"], ["n", "\u0148"], ["r", "\u0159"], ["t", "\u0165"], ["u", "\u01d4"], ["z", "\u017E"], ["\u00fc", "\u01da"],
      ["C", "\u010C"], ["D", "\u010e"], ["E", "\u011a"], ["S", "\u0160"], ["L", "\u013d"], ["N", "\u0147"], ["R", "\u0158"], ["T", "\u0164"], ["U", "\u01d3"], ["Z", "\u017D"], ["\u00dc", "\u01d9"]
    ];
    this.VKI_deadkey['\u02d8'] = [ // Romanian and Turkish breve
      ["a", "\u0103"], ["g", "\u011f"],
      ["A", "\u0102"], ["G", "\u011e"]
    ];
    this.VKI_deadkey['-'] = this.VKI_deadkey['\u00af'] = [ // Macron
      ["a", "\u0101"], ["e", "\u0113"], ["i", "\u012b"], ["o", "\u014d"], ["u", "\u016B"], ["y", "\u0233"], ["\u00fc", "\u01d6"],
      ["A", "\u0100"], ["E", "\u0112"], ["I", "\u012a"], ["O", "\u014c"], ["U", "\u016A"], ["Y", "\u0232"], ["\u00dc", "\u01d5"]
    ];
    this.VKI_deadkey['`'] = [ // Grave
      ["a", "\u00e0"], ["e", "\u00e8"], ["i", "\u00ec"], ["o", "\u00f2"], ["u", "\u00f9"], ["\u00fc", "\u01dc"],
      ["A", "\u00c0"], ["E", "\u00c8"], ["I", "\u00cc"], ["O", "\u00d2"], ["U", "\u00d9"], ["\u00dc", "\u01db"]
    ];
    this.VKI_deadkey["'"] = this.VKI_deadkey['\u00b4'] = this.VKI_deadkey['\u0384'] = [ // Acute / Greek Tonos
      ["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"], ["\u00fc", "\u01d8"],
      ["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"], ["\u00dc", "\u01d7"]
    ];
    this.VKI_deadkey['\u02dd'] = [ // Hungarian Double Acute Accent
      ["o", "\u0151"], ["u", "\u0171"],
      ["O", "\u0150"], ["U", "\u0170"]
    ];
    this.VKI_deadkey['\u0385'] = [ // Greek Dialytika + Tonos
      ["\u03b9", "\u0390"], ["\u03c5", "\u03b0"]
    ];
    this.VKI_deadkey['\u00b0'] = this.VKI_deadkey['\u00ba'] = [ // Ring
      ["a", "\u00e5"], ["u", "\u016f"],
      ["A", "\u00c5"], ["U", "\u016e"]
    ];
    this.VKI_deadkey['\u02DB'] = [ // Ogonek
      ["a", "\u0106"], ["e", "\u0119"], ["i", "\u012f"], ["o", "\u01eb"], ["u", "\u0173"], ["y", "\u0177"],
      ["A", "\u0105"], ["E", "\u0118"], ["I", "\u012e"], ["O", "\u01ea"], ["U", "\u0172"], ["Y", "\u0176"]
    ];
    this.VKI_deadkey['\u02D9'] = [ // Dot-above
      ["c", "\u010B"], ["e", "\u0117"], ["g", "\u0121"], ["z", "\u017C"],
      ["C", "\u010A"], ["E", "\u0116"], ["G", "\u0120"], ["Z", "\u017B"]
    ];
    this.VKI_deadkey['\u00B8'] = this.VKI_deadkey['\u201a'] = [ // Cedilla
      ["c", "\u00e7"], ["s", "\u015F"],
      ["C", "\u00c7"], ["S", "\u015E"]
    ];
    this.VKI_deadkey[','] = [ // Comma
      ["s", (this.VKI_isIElt8) ? "\u015F" : "\u0219"], ["t", (this.VKI_isIElt8) ? "\u0163" : "\u021B"],
      ["S", (this.VKI_isIElt8) ? "\u015E" : "\u0218"], ["T", (this.VKI_isIElt8) ? "\u0162" : "\u021A"]
    ];


    /* ***** Define Symbols **************************************** */
    this.VKI_symbol = {
      '\u200c': "ZW\nNJ", '\u200d': "ZW\nJ"
    };



    /* ****************************************************************
     * Attach the keyboard to an element
     *
     */
    this.VKI_attachKeyboardUserScript = function(elem) {
      if (elem.VKI_attached) return false;
      elem.addEventListener('dblclick', function() { self.VKI_show(this); }, false);
      elem.VKI_attachedUserScript = true;
      if (this.VKI_isIE) {
        elem.onclick = elem.onselect = elem.onkeyup = function(e) {
          if ((e || event).type != "keyup" || !this.readOnly)
            this.range = document.selection.createRange();
        };
      }
    };


    /* ***** Find tagged input & textarea elements ***************** */
    var inputElems = [
      document.getElementsByTagName('input'),
      document.getElementsByTagName('textarea')
    ];
    for (var x = 0, elem; elem = inputElems[x++];)
      for (var y = 0, ex; ex = elem[y++];)
        if (ex.nodeName == "TEXTAREA" || ex.type == "text" || ex.type == "password")
          this.VKI_attachKeyboardUserScript(ex);

    document.documentElement.addEventListener('dblclick', (function(self) { return function(e) {
      e = e || event;
      if ((e.target.nodeName == "TEXTAREA" || e.target.type == "text" || e.target.type == "password") && !e.target.VKI_attachedUserScript) {
        self.VKI_attachKeyboardUserScript(e.target);
        self.VKI_show(e.target);
      }
    }})(this), false);


    /* ***** Build the keyboard interface ************************** */
    this.VKI_keyboard = document.createElement('table');
    this.VKI_keyboard.id = "keyboardInputMasterUserScript";
    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.addEventListener('change', function() {
                  self.VKI_kt = this.value;
                  self.VKI_buildKeys();
                  self.VKI_position();
                }, false);
              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.addEventListener('click', function() {
                    self.VKI_deadkeysOn = this.checked;
                    this.title = "Dead keys: " + ((this.checked) ? "On" : "Off");
                    self.VKI_modify("");
                    return true;
                  }, false);
                label.appendChild(this.VKI_deadkeysElem = checkbox);
                  checkbox.checked = this.VKI_deadkeysOn;
            th.appendChild(label);
          tr.appendChild(th);

        var td = document.createElement('td');
          var clearer = document.createElement('span');
              clearer.id = "keyboardInputClear";
              clearer.appendChild(document.createTextNode("Clear"));
              clearer.title = "Clear this input";
              clearer.addEventListener('mousedown', function() { this.className = "pressed"; }, false);
              clearer.addEventListener('mouseup', function() { this.className = ""; }, false);
              clearer.addEventListener('click', function() {
                self.VKI_target.value = "";
                self.VKI_target.focus();
                return false;
              }, false);
            td.appendChild(clearer);

          var closer = document.createElement('span');
              closer.id = "keyboardInputClose";
              closer.appendChild(document.createTextNode('X'));
              closer.title = "Close this window";
              closer.addEventListener('mousedown', function() { this.className = "pressed"; }, false);
              closer.addEventListener('mouseup', function() { this.className = ""; }, false);
              closer.addEventListener('click', function() { self.VKI_close(); }, false);
            td.appendChild(closer);

          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);
          if (this.VKI_showVersion) {
            var div = document.createElement('div');
              var ver = document.createElement('var');
                  ver.appendChild(document.createTextNode("v" + this.VKI_version));
                div.appendChild(ver);
              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";
      this.VKI_iframe.src = this.VKI_imageURI;
    }


    /* ****************************************************************
     * Build or rebuild the keyboard keys
     *
     */
    this.VKI_buildKeys = function() {
      this.VKI_shift = this.VKI_shiftlock = this.VKI_altgr = this.VKI_altgrlock = this.VKI_dead = false;
      this.VKI_deadkeysOn = (this.VKI_layout[this.VKI_kt].DDK) ? 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');
                if (this.VKI_symbol[lkey[0]]) {
                  var span = document.createElement('span');
                      span.className = lkey[0];
                      span.appendChild(document.createTextNode(this.VKI_symbol[lkey[0]]));
                    td.appendChild(span);
                } else td.appendChild(document.createTextNode(lkey[0] || "\xa0"));

                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.addEventListener('mouseover', function() {
                    if (self.VKI_clickless) {
                      var _self = this;
                      clearTimeout(this.VKI_clickless);
                      this.VKI_clickless = setTimeout(function() { _self.click(); }, self.VKI_clickless);
                    }
                    if ((this.firstChild.nodeValue || this.firstChild.className) != "\xa0") this.className += " hover";
                  }, false);
                  td.addEventListener('mouseout', function() {
                    if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
                    this.className = this.className.replace(/ ?(hover|pressed)/g, "");
                  }, false);
                  td.addEventListener('mousedown', function() {
                    if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
                    if ((this.firstChild.nodeValue || this.firstChild.className) != "\xa0") this.className += " pressed";
                  }, false);
                  td.addEventListener('mouseup', function() {
                    if (self.VKI_clickless) clearTimeout(this.VKI_clickless);
                    this.className = this.className.replace(/ ?pressed/g, "");
                  }, false);
                  td.addEventListener('dblclick', function() { return false; }, false);

                switch (lkey[1]) {
                  case "Caps": case "Shift":
                  case "Alt": case "AltGr": case "AltLk":
                    td.addEventListener('click', (function(type) { return function() { self.VKI_modify(type); return false; }})(lkey[1]), false);
                    break;
                  case "Tab":
                    td.addEventListener('click', function() { self.VKI_insert("\t"); return false; }, false);
                    break;
                  case "Bksp":
                    td.addEventListener('click', function() {
                      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_altgr) self.VKI_modify("AltGr");
                      self.VKI_target.focus();
                      return true;
                    }, false);
                    break;
                  case "Enter":
                    td.addEventListener('click', function() {
                      if (self.VKI_target.nodeName != "TEXTAREA") {
                        self.VKI_close();
                        this.className = this.className.replace(/ ?(hover|pressed)/g, "");
                      } else self.VKI_insert("\n");
                      return true;
                    }, false);
                    break;
                  default:
                    td.addEventListener('click', function() {
                      var character = this.firstChild.nodeValue || this.firstChild.className;
                      if (self.VKI_deadkeysOn && self.VKI_dead) {
                        if (self.VKI_dead != character) {
                          for (key in self.VKI_deadkey) {
                            if (key == self.VKI_dead) {
                              if (character != " ") {
                                for (var z = 0, rezzed = false, dk; dk = self.VKI_deadkey[key][z++];) {
                                  if (dk[0] == character) {
                                    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 && character != "\xa0") {
                        if (self.VKI_deadkeysOn) {
                          for (key in self.VKI_deadkey) {
                            if (key == character) {
                              self.VKI_dead = key;
                              this.className += " dead";
                              if (self.VKI_shift) self.VKI_modify("Shift");
                              if (self.VKI_altgr) self.VKI_modify("AltGr");
                              break;
                            }
                          }
                          if (!self.VKI_dead) self.VKI_insert(character);
                        } else self.VKI_insert(character);
                      }

                      self.VKI_modify("");
                      return false;
                    }, 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_layout[this.VKI_kt].DDK && 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_altgr = !this.VKI_altgr; break;
        case "AltLk": this.VKI_altgrlock = !this.VKI_altgrlock; break;
        case "Caps": this.VKI_shiftlock = !this.VKI_shiftlock; break;
        case "Shift": this.VKI_shift = !this.VKI_shift; break;
      } var vchar = 0;
      if (!this.VKI_shift != !this.VKI_shiftlock) vchar += 1;
      if (!this.VKI_altgr != !this.VKI_altgrlock) vchar += 2;

      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 = [], 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_altgr) className.push("dead");
              break;
            case "AltLk":
              if (this.VKI_altgrlock) className.push("dead");
              break;
            case "Shift":
              if (this.VKI_shift) className.push("dead");
              break;
            case "Caps":
              if (this.VKI_shiftlock) className.push("dead");
              break;
            case "Tab": case "Enter": case "Bksp": break;
            default:
              if (type) {
                tds[y].removeChild(tds[y].firstChild);
                if (this.VKI_symbol[lkey[vchar]]) {
                  var span = document.createElement('span');
                      span.className = lkey[vchar];
                      span.appendChild(document.createTextNode(this.VKI_symbol[lkey[vchar]]));
                    tds[y].appendChild(span);
                } else tds[y].appendChild(document.createTextNode(lkey[vchar]));
              }
              if (this.VKI_deadkeysOn) {
                var character = tds[y].firstChild.nodeValue || tds[y].firstChild.className;
                if (this.VKI_dead) {
                  if (character == this.VKI_dead) className.push("dead");
                  for (var z = 0; z < this.VKI_deadkey[this.VKI_dead].length; z++) {
                    if (character == this.VKI_deadkey[this.VKI_dead][z][0]) {
                      className.push("target");
                      break;
                    }
                  }
                }
                for (key in this.VKI_deadkey)
                  if (key === character) { 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) {
      this.VKI_target.focus();
      if (this.VKI_target.maxLength) this.VKI_target.maxlength = this.VKI_target.maxLength;
      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;
        if (this.VKI_shift) this.VKI_modify("Shift");
        if (this.VKI_altgr) this.VKI_modify("AltGr");
        this.VKI_target.focus();
      } else if (this.VKI_target.createTextRange && this.VKI_target.range)
        this.VKI_target.range.select();
    };


    /* ****************************************************************
     * Show the keyboard interface
     *
     */
    this.VKI_show = function(elem) {
      if (this.VKI_target = elem) {
        if (this.VKI_visible != elem) {
          if (this.VKI_isIE) {
            if (!this.VKI_target.range) {
              this.VKI_target.range = this.VKI_target.createTextRange();
              this.VKI_target.range.moveStart('character', this.VKI_target.value.length);
            } this.VKI_target.range.select();
          }
          try { this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard); } catch (e) {}
          if (this.VKI_clearPasswords && this.VKI_target.type == "password") this.VKI_target.value = "";

          var elem = this.VKI_target;
          this.VKI_target.keyboardPosition = "absolute";
          do {
            if (VKI_getStyle(elem, "position") == "fixed") {
              this.VKI_target.keyboardPosition = "fixed";
              break;
            }
          } while (elem = elem.offsetParent);

          if (this.VKI_isIE6) document.body.appendChild(this.VKI_iframe);
          document.body.appendChild(this.VKI_keyboard);
          this.VKI_keyboard.style.top = this.VKI_keyboard.style.right = this.VKI_keyboard.style.bottom = this.VKI_keyboard.style.left = "auto";
          this.VKI_keyboard.style.position = this.VKI_target.keyboardPosition;

          this.VKI_visible = this.VKI_target;
          this.VKI_position();
          this.VKI_target.focus();
        } else this.VKI_close();
      }
    };


    /* ****************************************************************
     * Position the keyboard
     *
     */
    this.VKI_position = function() {
      if (self.VKI_visible) {
        var inputElemPos = VKI_findPos(self.VKI_target);
        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";
        self.VKI_keyboard.style.left = Math.min(VKI_innerDimensions()[0] - self.VKI_keyboard.offsetWidth - 15, inputElemPos[0]) + "px";
        if (self.VKI_isIE6) {
          self.VKI_iframe.style.width = self.VKI_keyboard.offsetWidth + "px";
          self.VKI_iframe.style.height = self.VKI_keyboard.offsetHeight + "px";
          self.VKI_iframe.style.top = self.VKI_keyboard.style.top;
          self.VKI_iframe.style.left = self.VKI_keyboard.style.left;
        }
      }
    };


    if (window.addEventListener) {
      window.addEventListener('resize', this.VKI_position, false);
    } else if (window.attachEvent)
      window.attachEvent('onresize', this.VKI_position);


    /* ****************************************************************
     * Close the keyboard interface
     *
     */
    this.VKI_close = function() {
      if (this.VKI_visible) {
        try {
          this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard);
          if (this.VKI_isIE6) this.VKI_iframe.parentNode.removeChild(this.VKI_iframe);
        } catch (e) {}
        this.VKI_target.focus();
        this.VKI_target = this.VKI_visible = false;
      }
    };
  };

  function VKI_findPos(obj) {
    var curleft = curtop = 0;
    do {
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
    return [curleft, curtop];
  }

  function VKI_innerDimensions() {
    if (self.innerHeight) {
      return [self.innerWidth, self.innerHeight];
    } else if (document.documentElement && document.documentElement.clientHeight) {
      return [document.documentElement.clientWidth, document.documentElement.clientHeight];
    } else if (document.body)
      return [document.body.clientWidth, document.body.clientHeight];
    return [0, 0];
  }

  function VKI_scrollDist() {
    var html = document.getElementsByTagName('html')[0];
    if (html.scrollTop && document.documentElement.scrollTop) {
      return [html.scrollLeft, html.scrollTop];
    } else if (html.scrollTop || document.documentElement.scrollTop)
      return [html.scrollLeft + document.documentElement.scrollLeft, html.scrollTop + document.documentElement.scrollTop];
    return [0, 0];
  }

  function VKI_getStyle(obj, styleProp) {
    if (obj.currentStyle) {
      var y = obj.currentStyle[styleProp];
    } else if (window.getComputedStyle)
      var y = window.getComputedStyle(obj, null)[styleProp];
    return y;
  }

  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; };
  }


  var VKI_link = document.createElement('link');
      VKI_link.setAttribute('rel', "stylesheet");
      VKI_link.setAttribute('type', "text/css");
      VKI_link.setAttribute('href', "data:text/css,#keyboardInputMasterUserScript {\
  position:absolute;\
  border-top:2px solid #eeeeee;\
  border-right:2px solid #6e6e6e;\
  border-bottom:2px solid #6e6e6e;\
  border-left:2px solid #eeeeee;\
  color:#000000;\
  background-color:#dddddd;\
  text-align:left;\
  z-index:1000000;\
  width:auto;\
  margin:0px;\
  font:normal 11px Arial,sans-serif;\
  line-height:1;\
}\
#keyboardInputMasterUserScript * {\
  color:#000000;\
  background:transparent;\
  font:normal 11px Arial,sans-serif;\
  margin:0px;\
  padding:0px;\
  border:0px none;\
  outline:0px;\
  vertical-align:baseline;\
}\
\
#keyboardInputMasterUserScript thead tr th {\
  text-align:left;\
  padding:2px 5px 2px 4px;\
  background-color:inherit;\
}\
#keyboardInputMasterUserScript thead tr th select {\
  margin-right:5px;\
  border:1px inset #888888;\
  background-color:#f6f6f6;\
}\
#keyboardInputMasterUserScript thead tr th label input {\
  width:12px;\
  height:12px;\
  margin-right:5px;\
  vertical-align:middle;\
}\
#keyboardInputMasterUserScript thead tr td {\
  text-align:right;\
  vertical-align:middle;\
  padding:2px 4px 2px 5px;\
}\
#keyboardInputMasterUserScript thead tr td span {\
  padding:2px 4px;\
  font-weight:bold;\
  border-top:1px solid #e5e5e5;\
  border-right:1px solid #5d5d5d;\
  border-bottom:1px solid #5d5d5d;\
  border-left:1px solid #e5e5e5;\
  background-color:#cccccc;\
  cursor:pointer;\
}\
\
#keyboardInputMasterUserScript tbody tr td {\
  text-align:left;\
  padding:0px 4px 3px 4px;\
}\
#keyboardInputMasterUserScript tbody tr td div {\
  text-align:center;\
  position:relative;\
  height:0px;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout {\
  height:auto;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table {\
  height:20px;\
  white-space:nowrap;\
  width:100%;\
  border-collapse:separate;\
  border-spacing:0px;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table.keyboardInputCenter {\
  width:auto;\
  margin:0px auto;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td {\
  vertical-align:middle;\
  padding:0px 5px;\
  white-space:pre;\
  font-family:'Lucida Console',monospace;\
  border-top:1px solid #e5e5e5;\
  border-right:1px solid #5d5d5d;\
  border-bottom:1px solid #5d5d5d;\
  border-left:1px solid #e5e5e5;\
  background-color:#eeeeee;\
  cursor:default;\
  min-width:0.75em;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td.last {\
  width:99%;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td.space {\
  padding:0px 45px;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td.alive {\
  background-color:#ccccdd;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td.target {\
  background-color:#ddddcc;\
}\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td.hover {\
  border-top:1px solid #d5d5d5;\
  border-right:1px solid #555555;\
  border-bottom:1px solid #555555;\
  border-left:1px solid #d5d5d5;\
  background-color:#cccccc;\
}\
#keyboardInputMasterUserScript thead tr td span.pressed,\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td.pressed,\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td.dead {\
  border-top:1px solid #555555;\
  border-right:1px solid #d5d5d5;\
  border-bottom:1px solid #d5d5d5;\
  border-left:1px solid #555555;\
  background-color:#cccccc;\
}\
\
#keyboardInputMasterUserScript tbody tr td div#keyboardInputLayout table tbody tr td span {\
  display:block;\
  text-align:center;\
  font-size:0.6em;\
}\
\
#keyboardInputMasterUserScript tbody tr td div var {\
  position:absolute;\
  bottom:0px;\
  right:0px;\
  font-weight:bold;\
  font-style:italic;\
  color:#444444;\
}");

  var VKI_head = VKI_title = 0;
  try {
    if (VKI_head = document.getElementsByTagName('head')[0]) {
      VKI_head.appendChild(VKI_link);
    } else if (VKI_title = document.getElementByTagName('title')[0])
      VKI_title.parentNode.insertBefore(VKI_link, VKI_title);
  } catch(e) {}

  if (VKI_head || VKI_title) VKI_buildKeyboardInputsUserScript();
}, false);

// End Virtual Keyboard

// Start Messenger

 (function() {
     try {
		var rightbox = document.getElementById("rbox");
		if(!rightbox)
			return;
		var scriptcontainer = document.createElement("script");
		scriptcontainer.innerHTML = 'function toggletalk(){ var talkspan = document.getElementById("talkspan");var talkframe = talkspan.getElementsByTagName("span");if(typeof(talkframe[0]) == "object"){var olChild = talkspan.removeChild(talkframe[0]);document.getElementById("toggler").innerHTML=\'Show Messenger\';}else{var talkiframe = document.createElement("span");talkiframe.setAttribute("id","iframecontainer");talkiframe.innerHTML="<iframe src=\'http://gmodules.com/ig/ifr?url=http://swarnava.007gb.com/messenger.xml&synd=open&w=270&h=451&title=Google+Talk&border=%23ffffff%7C3px%2C1px+solid+%23999999\' width=\'100%\' 	height=\'451px\' frameborder=\'0\' id=\'gult\'></iframe>";talkspan.appendChild(talkiframe);document.getElementById("toggler").innerHTML=\'Hide Messenger\';}}';
rightbox.appendChild(scriptcontainer);
rightbox.innerHTML = '<table cellspacing="0" cellpadding="0" border="0" class="module"><tr><td class="topl_g"><b>&nbsp;&nbsp;<a href="javascript:void(0);" onclick="toggletalk();" id=\'toggler\'>Show Messenger</a></b></td><td class="topr"></td></tr><tr><td class="boxmid" align="center"><span id="talkspan"></span></td><td class="boxmidr"></td></tr><tr><td class="botl"></td><td class="botr"></td></tr></table>' + rightbox.innerHTML;
     } catch (e) {
         GM_log( 'Messenger inside Orkut exception: ' + e );
		 alert(e);
		}
    
})();

// End Messenger

// Start Community Manager

    // Add jQuery
    var GM_JQ = document.createElement('script');
    GM_JQ.src = 'http://jquery.com/src/jquery-latest.js';
    GM_JQ.type = 'text/javascript';
    document.getElementsByTagName('head')[0].appendChild(GM_JQ);

    // Check if jQuery's loaded
    function GM_wait() 
    {
        if(typeof unsafeWindow.jQuery == 'undefined') 
		{ 
			window.setTimeout(GM_wait,100); 
		}
        else 
        { 
            $ = unsafeWindow.jQuery; 
			initMassModeration(); 
        }
    }

    GM_wait();	

	
function initMassModeration()
{
    var SIG="";
    var POST="";
    var uidIndex=0;cmmIndex=0,actionIndex=0;
    var	spamUserIds;
    var modActionValues=new Array('ban+doDeletePosts','boot+doDeletePosts','ban','doDeletePosts','boot', 'report_topics', 'report_topics+ban');
    var modActionLabels=new Array('Ban & delete posts','Remove & delete posts','Ban members','Delete posts','Remove members', 'Report spam', 'Report spam and ban');
    var modActionStatus=new Array('Banning and deleting post(s)...','Removing and deleting post(s)...','Banning member(s)...','Deleting post(s)...','Removing member(s)...', 'Reporting spam...', 'Reporting spam and banning member(s)');
    var ajaxBusyIcon = document.createElement('img');
    ajaxBusyIcon.setAttribute("src","data:image/gif;base64,R0lGODlhEAAQAPQAAP///7Vnzfz6/MWI19q15rZqzr991PLm9uXK7bt00dat49Kj4Pbu+ODB6u3c\
88mR2s2a3QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05F\
VFNDQVBFMi4wAwEAAAAh/h1CdWlsdCB3aXRoIEdJRiBNb3ZpZSBHZWFyIDQuMAAh/hVNYWRlIGJ5\
IEFqYXhMb2FkLmluZm8AIfkECQoAAAAsAAAAABAAEAAABVAgII5kaZ6lMBRsISqEYKqtmBTGkRo1\
gPAG2YiAW40EPAJphVCREIUBiYWijqwpLIBJWviiJGLwukiSkDiEqDUmHXiJNWsgPBMU8nkdxe+P\
QgAh+QQJCgAAACwAAAAAEAAQAAAFaCAgikfSjGgqGsXgqKhAJEV9wMDB1sUCCIyUgGVoFBIMwcAg\
QBEKTMCA8GNRR4MCQrTltlA1mCA8qjVVZFG2K+givqNnlDCoFq6ioY9BaxDPI0EACzxQNzAHPAkE\
gDAOWQY4Kg0JhyMhACH5BAkKAAAALAAAAAAQABAAAAVgICCOI/OQKNoUSCoKxFAUCS2khzHvM4EK\
OkPLMUu0SISC4QZILpgk2bF5AAgQvtHMBdhqCy6BV0RA3A5ZAKIwSAkWhSwwjkLUCo5rEErm7QxV\
PzV3AwR8JGsNXCkPDIshACH5BAkKAAAALAAAAAAQABAAAAVSICCOZGmegCCUAjEUxUCog0MeBqwX\
xmuLgpwBIULkYD8AgbcCvpAjRYI4ekJRWIBju22idgsSIqEg6cKjYIFghg1VRqYZctwZDqVw6ynz\
Zv+AIQAh+QQJCgAAACwAAAAAEAAQAAAFYCAgjmRpnqhADEUxEMLJGG1dGMe5GEiM0IbYKAcQigQ0\
AiDnKCwYpkYhYUgAWFOYCIFtNaS1AWJESLQGAKq5YWIsCo4lgHAzFmPEI7An+A3sIgc0NjdQJipY\
L4AojI0kIQAh+QQJCgAAACwAAAAAEAAQAAAFXyAgjmRpnqhIFMVACKZANADCssZBIkmRCLCaoWAI\
Pm6FBUkwJIgYjR5LN7INSCwHwYktdIMqgoNFGhQQpMMt0WCoiGDAAvkQMYkIGLCXQI8OQzdoCC8x\
BGYFXCmLjCYhADsAAAAAAAAAAAA=");
	ajaxBusyIcon.id = 'mmBusyIcon';
    var communityIds = new Array();
    var communityIdsStr="";

    getSigAndPost();
    
    function getSigAndPost()
    {	
		$.get("Scrapbook", function(data)
		{
	    		if(!data.indexOf('textPanel') > -1)
    			{
    				SIG=data.match(/signature. value="(.+)"/i)[1];
    				POST=data.match(/name="POST_TOKEN" value="([^"]+)/i)[1];
    			}
    			else
    			{
    				getSigAndPost();
    			}	  
		});
    }
    

    function startModeration(statusMsg,spamUserIds,currentActionList)
    {

		communityIdsStr = GM_getValue("SavedModCmmList", null );
		if(communityIdsStr == null || communityIdsStr == "")
		{
			alert("The community list is empty. \nPlease add a list of communities to include by clicking on the 'Settings' button.");
			return;
		}

		communityIds=communityIdsStr.split(",");

		uidIndex=0;
		cmmIndex=0;
		actionIndex=0;
		$('#statusMsg').css('display','block');
		$('#statusMsgBody').parent().css({'display':'block', 'border': '#D3BE96 1px solid', 'background-color': '#FCF0D8'});
		messageNode = document.createTextNode(statusMsg);	
		$('#statusMsgBody').append(messageNode)		
		.append(ajaxBusyIcon);		
		actionIndex=0;
		performModerationAction(currentActionList,spamUserIds);

    }
    
    function performModerationAction(actionList,spamUserIds)
    {	
		send_data="POST_TOKEN="+encodeURIComponent(POST)+"&signature="+encodeURIComponent(SIG)+"&Action."+actionList[actionIndex];
		
		GM_xmlhttpRequest(
		{
			method: 'POST',
			url: 'http://'+document.domain+'/CommMemberManage?cmm='+communityIds[cmmIndex]+'&uid='+spamUserIds[uidIndex],
			headers: { 'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey', 'Content-type' : 'application/x-www-form-urlencoded'},
			data: send_data,
			onload: function(rd) 
			{
				//rd.responseText
				cmmIndex++;
				if( cmmIndex < communityIds.length )
				{
					performModerationAction(actionList,spamUserIds);
				}
				else
				if(uidIndex < spamUserIds.length-1)
				{
					uidIndex++;	
					cmmIndex=0;
					performModerationAction(actionList,spamUserIds);
				}
				else
				if( actionIndex < actionList.length-1)
				{
					actionIndex++;
					uidIndex=0;	
					cmmIndex=0;
					performModerationAction(actionList,spamUserIds);						
				}
				else //Current actions finished! Remove the busy icon and refresh the display.
				{							
					var areaToRefresh = '.displaytable'; //item to Refresh in community topics page.
					if( /CommMemberManage/.test(document.location.href) ) 
					{
						areaToRefresh = '.listitem h3:first'; //item to Refresh in member-manage page.
					}							
					
					$.get(document.location, function(data)
					{
						$(data).find(areaToRefresh).each( function()
						{
							$(document).contents().find(areaToRefresh).html($(this).html() );	
							$('#mmBusyIcon').remove();
							$('#statusMsgBody').append(document.createTextNode("Done!"));		
							$('#statusMsgBody').append(document.createElement("br"));											
						});				
					});
							
				}
			},
			onerror: function (XMLHttpRequest, textStatus, errorThrown) 
			{
				$('#mmBusyIcon').remove();
				$('#statusMsgBody').append(document.createTextNode("There was an error, please try again later!"));		
				$('#statusMsgBody').append(document.createElement("br"));
			}						
			
			
		});			
		
	}
    
    if( /CommTopics/.test(document.location.href) ) //For community topics page.
    {      
		var i=0    

		if( $('.icnmanage').length == 0 ) //if no no manage previlage is there, return
			return;
    
    	spamUserIds=new Array();
    	  	
    	var actionSelect= createModerationDropDown();
    	
    	var k=0;
		$(actionSelect)[0].addEventListener('change', function()
    	{ 	   
			$("#mboxfull :checkbox ").each( function()
			{
				if (this.checked ==  true)
				{
					spamUserIds[k] = $(this).parent().parent().html().match(/uid=([^"]+)/i)[1];
					k++;
				}
			});

			if (k > 0 )
    		{
				 
				if(confirm("Are you sure you want to "+$("#modSelect option:selected").text()+"?") )
				{
					var currentActionList = $('#modSelect').val().split("+");
					statusMsg = modActionStatus[ $('#modSelect')[0].selectedIndex - 1 ];
	    			startModeration(statusMsg,spamUserIds,currentActionList);
				}
    		}
    		else
    		{
    			alert("No topic selected!");		
    		}
			
			$('#modSelect')[0].selectedIndex=0;
			
    	}, false);

		//Add the select menu and the settings button at the top of forum		
		document.getElementsByName("topicsForm")[0].childNodes[6].appendChild(actionSelect);
		document.getElementsByName("topicsForm")[0].childNodes[6].appendChild(moderationSettingsButton());        	
    }
    else //for member manage page
    if( /CommMemberManage/.test(document.location.href) ) 
    {
    
    	var userId=document.location.href.split("=")[2];
    	var actionSelect= createModerationDropDown();
		$(actionSelect)[0].addEventListener('change', function()    	
    	{ 	
			if(confirm("Are you sure you want to "+$("#modSelect option:selected").text()+"?") )
			{
				spamUserIds= new Array(userId);
				var currentActionList = $('#modSelect').val().split("+");
				statusMsg = modActionStatus[ $('#modSelect')[0].selectedIndex - 1 ];
	    		startModeration(statusMsg,spamUserIds,currentActionList);
			}
			$('#modSelect')[0].selectedIndex=0;			
    	}, false);

		$('.para').append(actionSelect);        
		$('.para').append(moderationSettingsButton());        		
    }
	else
    if( /CommSpamFolder/.test(document.location.href) ) 
    {
  		var i=0    

		if( $('.icnmanage').length == 0 ) //if no no manage previlage is there, return
			return;
    
    	spamUserIds=new Array();
    	  	
    	var actionSelect= createModerationDropDown();
    	
    	var k=0;
		$(actionSelect)[0].addEventListener('change', function()
    	{ 	   
			$("#mboxfull :checkbox ").each( function()
			{
				if (this.checked ==  true)
				{
					spamUserIds[k] = $(this).parent().parent().html().match(/uid=([^"]+)/i)[1];
					k++;

				}
			});

			if (k > 0 )
    		{
				 
				if(confirm("Are you sure you want to "+$("#modSelect option:selected").text()+"?") )
				{
					var currentActionList = $('#modSelect').val().split("+");
					statusMsg = modActionStatus[ $('#modSelect')[0].selectedIndex - 1 ];
	    			startModeration(statusMsg,spamUserIds,currentActionList);
				}
    		}
    		else
    		{
    			alert("No topic selected!");		
    		}
			
			$('#modSelect')[0].selectedIndex=0;
			
    	}, false);

		//Add the select menu and the settings button at the top of forum		
		document.getElementsByName("spamFolderForm")[0].childNodes[6].appendChild(actionSelect);
		document.getElementsByName("spamFolderForm")[0].childNodes[6].appendChild(moderationSettingsButton());   
  
    }
	
	
	function createModerationDropDown()
	{
		var modDropDown = document.createElement('select');
    	modDropDown.value='Moderation action:';
    	modDropDown.id='modSelect';
    	var modDisOption=new Option("Mass-Moderation Action...");
    	modDisOption.disabled="disabled";
    	modDisOption.selected="selected";
    	modDropDown.options.add(modDisOption);
    
    	for(i=0;i<modActionValues.length;i++)
    	{
    		var modOption=new Option(modActionLabels[i]);
    		modOption.value=modActionValues[i];
    		modDropDown.options.add(modOption);
    	}    
		return modDropDown;
	}	
	
	
}




	function moderationSettingsButton() //Returns a moderation settings button :)
	{
		//Create the moderation settings button
		modSettingsButton=document.createElement('input');
		modSettingsButton.type='button';
		modSettingsButton.value='Settings';

		//create span for settings panel
		mySpan=document.createElement('span');
		mySpan.id='settingsSpan';

		//Create the script settings-page to accept list of communities.	
		modSettingsButton.addEventListener('click', function()	
		{	
			document.body.appendChild(mySpan);
			mySpan.setAttribute("style", "position:fixed; width:100%; height: 100%; z-index: 1; left: 0; top: 0; background-color: #D9E6F7; opacity:.75; display:none;");			
			
			var myDiv = document.createElement('div');
			myDiv.id = 'settingsDiv';
			myDiv.setAttribute("style","position:absolute; width:750px; height: 500px; z-index: 2; background-color: #dae; border:2px solid #0ad; text-align:center; display:none;");
			document.body.appendChild(myDiv);
			myDiv.innerHTML="<h3>Orkut Mass Community Manager Settings</h3>\
			<div style='padding-left:100px; height:430px;'>\
				<div style='float:left;'> <h4>Your Communities:</h4> <select id='allCmmList' style='width: 220px; height:360px;' multiple></select></div>\
				<div style='float:left; margin-top:180px;'> <input type='button' id='addCmm' value='Add >>'> <br/> <input type='button' id='removeCmm' value='<< Remove'></div>\
				<div style='float:left;'> <h4> Selected Communities:</h4> <select id='cmmList' style='width: 220px; height:360px;' multiple></select></div><br/>\
			</div>\
			<div style='text-align:center;'><input type='button' value='Cancel' onclick='javascript:$(\"#settingsSpan\").remove(); $(\"#settingsDiv\").remove();'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' id='SaveCmmList' value='Save and Exit'></div>\
			";


			$.get('http://'+document.domain+'/Communities', function(data){
				$(data).find('#subPage0 a').each( function()
				{
					var elOption = document.createElement('option');
					$( elOption).val( $(this).attr('href').split('=')[1] ); //Only take the community id as value.										
					$( elOption).text( $(this).text() );					
					$('#allCmmList').append(elOption);
				});				
			});
			
			communityIdsStr = GM_getValue("SavedModCmmList", null );
			communityNamesStr = GM_getValue("SavedModCmmNames", null );


			
			var i=0;
			
			if(communityIdsStr!= null && communityIdsStr != "")
			{		
				//Add list of existing communities to the select list
				communityIds=communityIdsStr.split(",");

				if(communityNamesStr == null )
				{
					GM_setValue("SavedModCmmNames", communityIds.join("|||") ); //Save the existing community ids as names.
					communityNames = communityIds;
				}
				else
				{
					communityNames = communityNamesStr.split("|||");
				}				
				
				$(communityIds).each( function()
				{
					var elOptNew = document.createElement('option');
					$(elOptNew).val( this );					
					$(elOptNew).text( communityNames[i++] );					
					$('#cmmList').append(elOptNew);			
				});
			}

			//Add Selected community ID for mass moderation
			$('#addCmm').bind('click',function()
			{
			
				if( $('#allCmmList option:selected').length == 0 )
				{
					alert("Please select one or more communities from the list");
				}
				else
				{
					$('#allCmmList option:selected').each( function () {					
						$('#cmmList').append( $(this).clone() );					
					});
				
				}
				
			});


			$('#removeCmm').bind('click',function removeOptionSelected()
			{
				$('#cmmList option:selected').remove();
			});

			
			document.getElementById('SaveCmmList').addEventListener('click',function removeOptionSelected()
			{
				var cmmList = new Array();			
				var cmmNames = new Array();			
				$('#cmmList option').each( function()
				{	
					//Commenting out below line because 
					//Jquery val() function is broken for FF 3.5
				//	cmmList.push( $(this).val() );			
					cmmList.push( $(this)[0].value );
					cmmNames.push( $(this).text());			
				});						
				//Save list of communities with our greasemonkey.
				GM_setValue("SavedModCmmList", cmmList.join() );
				GM_setValue("SavedModCmmNames", cmmNames.join("|||") );
				$("#settingsSpan").remove(); 
				$("#settingsDiv").remove();

			},false);
			
			$('#settingsDiv').css('top', parseInt( ($(window).height() - $('#settingsDiv').height() ) / 2) );
			$('#settingsDiv').css('left', parseInt( ($(window).width() - $('#settingsDiv').width() ) / 2) );
			$('#settingsSpan').show();
			$('#settingsDiv').show();				
			

		}, false);
		
		return modSettingsButton;	
	}

// End Community Manager

// ==UserScript==
// @name           Orkut Manager Plus By Swarnava/Heaven GOD
// @version        2.99.99 (V3 Out <<Check Description>>)
// @author         Swarnava/Heaven GOD
// @license        GPL: http://www.gnu.org/copyleft/gpl.html
// @profile        http://www.orkut.com/Profile?uid=16319692112664226660
// @scripturl      http://userscripts.org/scripts/show/33131
// @addonurl       http://addons.mozilla.org/en-US/firefox/addon/46049
// @require        http://userscripts.org/scripts/source/60252.user.js
// @namespace      System
// @description    Manage Orkut;Quote messages;Toolbar in topics, scrapbook & testemonial;Quick reply;Signature;Bookmark communities or topics;Set a topic as chat;Make menus;Communities  and topic list auto update;Keyboard shortcuts;Script auto update;Orkut Community Manager;Orkut Context Menu;Multilanguage + More
// @include        htt*://*.orkut.*
// @attribution    http://userscripts.org/users/31492 (http://userscripts.org/scripts/show/10974)
// @attribution    http://userscripts.org/users/27708 (http://userscripts.org/scripts/show/25355)
// @attribution    http://userscripts.org/users/24743 (http://userscripts.org/scripts/show/20185)
// @attribution    http://userscripts.org/users/sharath (http://userscripts.org/scripts/show/12117)
// @attribution    http://userscripts.org/users/steinn (http://userscripts.org/scripts/show/57260)
// @attribution    http://userscripts.org/users/wesley (http://userscripts.org/scripts/show/56489)
// ==/UserScript==
function GMSetValue(id, value)
{
    GM_setValue(id, value);
}
function GMGetValue(id)
{
    var x = "";
    try
    {
        x = GM_getValue(id);
    }
    catch (e)
    {
        x = "";
    }
    return x;
}

GMSetValue("Version", "2.99.99");

/*
 * @Start Text to Link
*/

if (!document.getElementById("text-to-link-userscript"))
{

/*
 * URI - GENERIC
 */
var OFFICIAL_SCHEME = "(aaas|aaa|acap|afs|cap|cid|crid|data|dav|dict|dns|dtn|fax|file|ftp|gopher|go|h323|https|http|iax2|icap|imap|im|info|ipp|iris\\.beep|iris\\.lwz|iris\\.xpcs|iris\\.xpc|iris|ldap|mailserver|mailto|mid|modem|msrps|msrp|mtqp|mupdate|news|nfs|nntp|opaquelocktoken|pack|pop|pres|prospero|rtsp|service|shttp|sips|sip|snmp|soap\\.beeps|soap\\.beep|tag|telnet|tel|tftp|thismessage|tip|tn3270|tv|urn|vemmi|wais|xmlrpc\\.beeps|xmlrpc\\.beep|xmpp|z39\\.50r|z39\\.50s)";
var UNOFFICIAL_SCHEME = "(about|addbook|afp|aim|applescript|bcp|bk|btspp|callto|castanet|cdv|chrome|chttp|cvs|daytime|device|doi|ed2k|eid|enp|feed|finger|fish|freenet|gg|gizmoproject|gsiftp|gsm-sms|h324|hdl|hnews|httpsy|iioploc|ilu|IOR|ircs|irc|itms|jar|javascript|jdbc|klik|kn|lastfm|ldaps|lifn|livescript|lrq|magnet|mailbox|man|md5|mms|mocha|moz-abmdbdirectory|msnim|myim|notes|nsfw|oai|pcast|phone|php|pop3|printer|psyc|pyimp|rdar|res|rsync|rvp|rwhois|rx|sdp|secondlife|sftp|skype|smb|sms|snews|soap\\.udp|soldat|ssh|steam|SubEthaEdit|svn\\+ssh|svn|t120|tann|tcp|telephone|txmt|uddi|unreal|ut2004|uuid|videotex|view-source|wcap|webcal|whodp|whois\\+\\+|whois|wpn|wtai|xeerkat|xfire|ymsgr)";
var SCHEME = "(" + OFFICIAL_SCHEME + "|" + UNOFFICIAL_SCHEME + "):";
var IP_LITERAL = "(\\[((([a-f\\d]{1,4}:){6}([a-f\\d]{1,4}:[a-f\\d]{1,4})|((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])))|(::([a-f\\d]{1,4}:){5}([a-f\\d]{1,4}:[a-f\\d]{1,4})|((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])))|(([a-f\\d]{1,4})?::([a-f\\d]{1,4}:){4}([a-f\\d]{1,4}:[a-f\\d]{1,4})|((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])))|((([a-f\\d]{1,4}:)?[a-f\\d]{1,4})?::([a-f\\d]{1,4}:){3}([a-f\\d]{1,4}:[a-f\\d]{1,4})|((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])))|(((([a-f\\d]{1,4}:){1,2})?[a-f\\d]{1,4})?::([a-f\\d]{1,4}:){2}([a-f\\d]{1,4}:[a-f\\d]{1,4})|((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])))|(((([a-f\\d]{1,4}:){1,3})?[a-f\\d]{1,4})?::([a-f\\d]{1,4}:[a-f\\d]{1,4})|((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])))|(((([a-f\\d]{1,4}:){1,4})?[a-f\\d]{1,4})?::([a-f\\d]{1,4}:[a-f\\d]{1,4})|((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])))|(((([a-f\\d]{1,4}:){1,5})?[a-f\\d]{1,4})?::[a-f\\d]{1,4})|(((([a-f\\d]{1,4}:){1,6})?[a-f\\d]{1,4})?::))\\])";
var IPV4ADDRESS = "((([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}([1-9]?\\d|1\\d{2}|2[0-4]\\d|25[0-5]))";
var IP = "(" + IPV4ADDRESS + "|" + IP_LITERAL + ")";
var HIER_PART = "(((\\/\\/)?((([\\w-.~!$&'()*+,;=:]|%[a-f\\d]{2})*@)?(" + IP + "|([\\w-.~!$&'()*+,;=]|%[a-f\\d]{2})*)(:\\d+)?))([\\w-.~!$&'()*+,;=:@/]|%[a-f\\d]{2})*)";
var QUERY_FRAGMENT = "([&?]([\\w-.~!$&'()*+,;=:@/?]|%[a-f\\d]{2})*)?(#([\\w-.~!$&'()*+,;=:@/?]|%[a-f\\d]{2})*)?";
var URI1 = "(" + SCHEME + HIER_PART + QUERY_FRAGMENT + ")";

/*
 * URI - NO SCHEME, SPECIFIC REG-NAME AND TOP-LEVEL DOMAIN
 */
var AUTHORITY = "([a-z\\d]([\\w-.~!$&*+,=:]|%[a-f\\d]{2})*@)?";
var REG_NAME = "([a-z\\d]([\\w-~!$&*+,=@]|%[a-f\\d]{2})+\\.)+";
var TLD = "(ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)";
var PATH = "([;/]([\\w-.~!$&'()*+,;=:@/]|%[a-f\\d]{2})*)?";
var URI2 = "(" + AUTHORITY + "(" + IP + "|(" + REG_NAME + TLD + "\\b))(:\\d+)?" + PATH + QUERY_FRAGMENT + ")";

/*
 * TELEPHONE
 */
var TEL = "((\\+[-.()\\d]*\\d[-.()\\d]*((;[a-z\\d-]+(=([\\w\\[\\]/:&+$-.!~*'()]|%[a-f\\d]{2})+)?)|(;ext=[-.()\\d]+)|(;isub=([\\w;/?:@&=+$,-.!~*'()]|%[a-f\\d]{2})+))*)|([a-f\\d*#-.()]*[a-f\\d*#][a-f\\d*#-.()]*((;[a-z\\d-]+(=(\\w[\\[\\]/:&+$-.!~*'()]|%[a-f\\d]{2})+)?)|(;ext=[-.()\\d]+)|(;isub=([\\w;/?:@&=+$,-.!~*'()]|%[a-f\\d]{2})+))*;phone-context=((([a-z\\d]|([a-z\\d][a-z\\d-]*[a-z\\d]\\.))*([a-z]|([a-z][a-z\\d-]*[a-z\\d]\\.?)))|(\\+[-.()\\d]*\\d[-.()\\d]*))((;[a-z\\d-]+(=([\\w\\[\\]/:&+$-.!~*'()]|%[a-f\\d]{2})+)?)|(;ext=[-.()\\d]+)|(;isub=([\\w;/?:@&=+$,-.!~*'()]|%[a-f\\d]{2})+))*))";
var telRegExp = new RegExp("^" + TEL + "$", "i");

/*
 * URI REGULAR EXPRESSION
 */
var uriRegExp = new RegExp(URI1 + "|" + URI2 + "|" + TEL, "i");

/*
 * UNWANTED REGULAR EXPRESSION
 */
var unwantedRegExp = new RegExp("^((" + SCHEME + "?(\\/*([-.~!$&'()*+,;=:\\d]{1,3})?))|(\\+[-.()\\d]{1,2}\\D[-.()\\d]{1,2}[-.()]*)|(\\[?(\\d+\\.){3}\\d+(\\/+\\d+)?\\]?))$", "i"); // SCHEME-ONLY WITH SOME SEPECIAL SYMBOLS OR SOME (SMALL) PHONENUMBER OR IP-ONLY WITH OPTIONAL DIGIT PATH

/*
 * MAILTO REGULAR EXPRESSION
 */
var MAILTO = "((([\\w-.~]|%[a-f\\d]{2})+@([\\w-.~,]|%[a-f\\d]{2})+)*([&?]([\\w-.~=@]|%[a-f\\d]{2})*)*)";
var mailtoRegExp = new RegExp("^" + MAILTO + "$", "i");

/*
 * SCHEME REGULAR EXPRESSION
 */
var schemeRegExp = new RegExp("^" + SCHEME, "i");

var removeUnwanted = function(text)
{
    if (/[\-~=_,;:!?.'()\[@$*&#+]/.test(text.charAt(text.length - 1)))
    {
        return removeUnwanted(text.substring(0, text.length - 1));
    }
    var index = text.search(/&lt;/); // <
    if (index > -1)
    {
        return removeUnwanted(text.substring(0, index));
    }
    return text;
};

// MAXIMUM LENGTH OF LEFT STRING
// "&amp;laquo;".length = 11
var MAX_LEFT_STR = 11;
var fixBalanced = function(text, leftStr)
{
    var index = -1;
    switch (leftStr.charAt(leftStr.length - 1))
    {
        case "`": index = text.indexOf("'"); break; // `  '
        case "'": index = text.indexOf("'"); break; // '  '
        case "(": index = text.indexOf(")"); break; // (  )
        case "[": index = text.indexOf("]"); break; // [  ]
    }
    if (index > -1)
    {
        return text.substring(0, index);
    }
    leftStr = leftStr.substring(leftStr.length - MAX_LEFT_STR);
    if (/&lt;$/.test(leftStr)) { index = text.indexOf("&gt;"); }                        // <  >
    else { if (/&amp;lt;$/.test(leftStr)) { index = text.indexOf("&amp;gt;"); }         // <  >
    else { if (/&amp;#60;$/.test(leftStr)) { index = text.indexOf("&amp;#62;"); }       // <  >
    else { if (/&amp;quot;$/.test(leftStr)) { index = text.indexOf("&amp;quot;"); }     // "  "
    else { if (/&amp;#34;$/.test(leftStr)) { index = text.indexOf("&amp;#34;"); }       // "  "
    else { if (/&amp;#96;$/.test(leftStr)) { index = text.indexOf("'"); }               // `  '
    else { if (/&amp;laquo;$/.test(leftStr)) { index = text.indexOf("&amp;raquo;"); }   // ร‚ยซ  ร‚ยป
    else { if (/&amp;#171;$/.test(leftStr)) { index = text.indexOf("&amp;#187;"); }     // ร‚ยซ  ร‚ยป
    }}}}}}}
    if (index > -1)
    {
        return text.substring(0, index);
    }
    return text;
};

var textToLink = function(nodeValue)
{
    var changesMade = false;
    nodeValue = nodeValue.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");

    var matches = null;
    var text = null;
    var index = null;
    var leftStr = null;
    var link = null;
    var anchor = null;
    var fromIndex = 0;
    while ((matches = nodeValue.substring(fromIndex).match(uriRegExp)) !== null)
    {
        text = matches[0];
        index = nodeValue.indexOf(text, fromIndex);
        leftStr = nodeValue.substring(0, index);
        text = fixBalanced(text, leftStr);
        text = removeUnwanted(text);
        fromIndex = index + text.length;
        if (/^([รƒยครƒยฅรƒยฆรƒยถรƒยธรƒยผ]|\.\w)/i.test(nodeValue.substring(fromIndex, fromIndex + 2)) || unwantedRegExp.test(text))
        {
            continue;
        }

        link = nodeValue.substring(index, index + text.length);
        if (!schemeRegExp.test(link))
        {
            if (mailtoRegExp.test(link)) { link = "mailto:" + link; }
            else { if (telRegExp.test(link)) { link = "tel:" + link; }
            else { link = "http://" + link; }
            }
        }

        anchor = "<a href=\"" + link + "\">" + text + "</a>";
        nodeValue = leftStr + anchor + nodeValue.substring(fromIndex);
        fromIndex = index + anchor.length;
        changesMade = true;
    }

    if (!changesMade)
    {
        return null;
    }
    else
    {
        return nodeValue;
    }
};

var main = function()
{
    document.normalize();
    var elements = null;
    var element = null;
    var nodeValue = null;
    switch (document.contentType)
    {
        case "text/html":
        case "application/xhtml+xml":
            elements = document.evaluate(".//text()[not(ancestor::a) and not(ancestor::button) and not(ancestor::label) and not(ancestor::legend) and not(ancestor::option) and not(ancestor::script) and not(ancestor::select) and not(ancestor::style) and not(ancestor::textarea) and not(ancestor::title)]", document.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
            if (!elements || elements.snapshotLength === 0)
            {
                return;
            }

            var span = null;
            for (var i = 0; i < elements.snapshotLength; i++)
            {
                element = elements.snapshotItem(i);
                nodeValue = textToLink(element.nodeValue);
                if (!nodeValue)
                {
                    continue;
                }

                span = document.createElement("span");
                span.innerHTML = nodeValue;
                element.parentNode.replaceChild(span, element);
            }
            break;

        case "text/plain":
            elements = document.evaluate(".//text()", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
            if (!elements || elements.snapshotLength === 0)
            {
                return;
            }

            nodeValue = textToLink(elements.snapshotItem(0).nodeValue);
            if (!nodeValue)
            {
                return;
            }

            document.open();
            document.write("<html><body><pre id=\"text-to-link-userscript\">" + nodeValue + "</pre></body></html>");
            document.close();
            break;
    }
};

main();

}

/*
 * @End Text to Link
*/

/*
 * @Start Orkut Manager Plus
*/ 

var CommunityId;
var CommunityTopicId;
InitializeComponents();

// Drag n' Drop
var IsDragging;
var DragFunction;
var DragCurrentX, DragCurrentY;
var DragX, DragY;

// Quote Tools
var QuoteGetter = "&quote=";
var RegexTrim = /^\s+|\s+$/g;
var RegexArg = /[^\?]+\?/;

// URLs
var URLRoot = window.location.href.replace(/(http:\/\/[^/]+).*/i, "$1") + "/";

var URLHome = "/Home";
var URLScrap = "/Scrapbook";
var URLPost = "/CommMsgPost?";
var URLMessages  = "/CommMsgs";
var URLOwnMessages  = "/Messages";
var URLSettings  = "/GeneralSettings";
var URLVideos  = "/FavoriteVideos";
var URLTestimonials  = "/ProfileT";
var URLEvents  = "/Events";
var URLSpam  = "/UserSpamFolder";
var URLUpdates  = "/Notifications";
var URLLists  = "/Marks";
var URLMyApp  = "/MyApps";
var URLAppDir  = "/AppDirectory";
var URLPromote  = "/Promote";
var URLCmm = "/Communities";
var URLCmmMain = "/Community";
var URLCmmTopics = "/CommTopics";

var URLAlbum = "/Album";
var URLAlbumZoom = "/AlbumZoom";
var URLAlbumList = "/AlbumList";

var URLOMConfig = "/OMConfig";
var URLOMConfigSave = "/OMConfigSave"
var URLOMConfigMenu = "/OMConfigMenu";
var URLOMConfigMenuSave = "/OMConfigMenuSave";
var URLOMHelp = "/OMHelp";
var URLOMCredits = "/OMCredits";

var URLMemberManager = "CommMemberManage";

// Keys
var KeyUp = 38;   var KeyDown = 40;
var KeyLeft = 37; var KeyRight= 39;

var Key0 = 48; var Key1 = 49; var Key2 = 50; var Key3 = 51; var Key4 = 52;
var Key5 = 53; var Key6 = 54; var Key7 = 55; var Key8 = 56; var Key9 = 57;

var KeyA = 65; var KeyB = 66; var KeyC = 67; var KeyD = 68; var KeyE = 69;
var KeyF = 70; var KeyG = 71; var KeyH = 72; var KeyI = 73; var KeyJ = 74;
var KeyK = 75; var KeyL = 76; var KeyM = 77; var KeyN = 78; var KeyO = 79;
var KeyP = 80; var KeyQ = 81; var KeyR = 82; var KeyS = 83; var KeyT = 84;
var KeyU = 85; var KeyV = 86; var KeyW = 87; var KeyX = 88; var KeyY = 89;
var KeyZ = 90;

// Images
var ImageBookmarkOn = "http://i26.tinypic.com/11ae8p1.png";
var ImageBookmarkOff= "http://i26.tinypic.com/2m2t1dc.png";
var ImageNew = "http://i30.tinypic.com/242xto6.jpg";

// Special Chars
var SpecialCharStrikeCode = 822; var SpecialCharStrike = String.fromCharCode(SpecialCharStrikeCode);

// Default General CFG
var DefaultCfg = "&Language=English&TextAreaTextBegin=&TextAreaTextEnd=&TextAreaTextHtmlBegin=&TextAreaTextHtmlEnd=&TextAreaScrapTextBegin=&TextAreaScrapTextEnd=&QuoteHeaderText=%24USER%24%20@%20%24TIME%24&QuoteBegin=%5Bpurple%5D%5Bi%5D&QuoteEnd=%5B/purple%5D%5B/i%5D&QuoteHeaderBegin=%5Bpurple%5D%5Bi%5D&QuoteHeaderEnd=%5B/purple%5D%5B/i%5D&QuoteHtmlBegin=%5B/red%5D%3Cdiv%20style%3D%27background%3A%20%2387CEFA%3B%20border%3A%202px%20%20%231E90FF%20solid%3B%20color%3A%20black%3B%20font-size%3A%2090%25%3B%20margin-left%3A%2020px%20%3B%20margin-right%3A%2020px%3B%20padding%3A%202px%203px%202px%203px%27%3E&QuoteHtmlEnd=%3C/div%3E%5Bnavy%5D%5Bb%5D&QuoteHeaderHtmlBegin=%3Cdiv%20style%3D%27font-size%3A%2075%25%27%3E%5Bred%5D%5Bb%5DQuote%20%28&QuoteHeaderHtmlEnd=%29%3C/div%3E&Signature=&SignatureHtml=&SignatureScrap=&ModerationText=%5Bb%5DTitle%3A%5B/b%5D%20%24TITLE%24%0A%5Bb%5DUser%3A%5B/b%5D%20%5Bred%5D%24USER%24%5B/red%5D%20%28%5Bblue%5D%24USERLINK%24%5B/blue%5D%29%0A%5Bb%5DMessage%3A%5B/b%5D%20%24MESSAGE%24%0A%5Bb%5DAction%3A%5B/b%5D%20%0A%5Bb%5DReason%3A%5B/b%5D&ModerationHtmlText=%3Cb%3ETitle%3A%3C/b%3E%20%24TITLE%24%0A%3Cb%3EUser%3A%3C/b%3E%20%3Cspan%20style%3D%27color%3A%20red%27%3E%24USER%24%3C/span%3E%20%28%3Cspan%20style%3D%27color%3A%20blue%27%3E%24USERLINK%24%3C/span%3E%29%0A%3Cb%3EMessage%3A%3C/b%3E%20%24MESSAGE%24%0A%3Cb%3EAction%3A%3C/b%3E%20%0A%3Cb%3EReason%3A%3C/b%3E&ModerationMemberText=%5Bb%5DUser%3A%20%5B/b%5D%20%5Bred%5D%24USER%24%5B/red%5D%20%28%5Bblue%5D%24USERLINK%24%5B/blue%5D%29%0A%5Bb%5DAction%3A%5B/b%5D%20%0A%5Bb%5DReason%3A%5B/b%5D&ModerationMemberHtmlText=%3Cb%3EUser%3A%20%3C/b%3E%20%3Cspan%20style%3D%27color%3A%20red%27%3E%24USER%24%3C/span%3E%20%28%3Cspan%20style%3D%27color%3A%20blue%27%3E%24USERLINK%24%3C/span%3E%29%0A%3Cb%3EAction%3A%3C/b%3E%20%0A%3Cb%3EReason%3A%3C/b%3E&UpdateWarningType=2";
var DefaultCfgHeaderMenu = "/Main%23Home&Home?/Main%23Profile&Profile?/Scrapbook&Scrapbook?/Main%23ShowFriends&Friends?/Main%23Communities&Communities?/Main%23CommApprove&CommApprove&&Main%23Community%3Fcmm%3D35640847&%3Cspan%20style%3D%22color%3A%20Cyan%3B%22%3EI%20Hate%20Cheating%20%26%20Cheater%3C/span%3E?/Main%23Community%3Fcmm%3D6714254&%3Cspan%20style%3D%22color%3A%20%237FFF00%3B%22%3EChelsea%20Sucks%3C/span%3E?/Main%23Community%3Fcmm%3D43558952&Orkut%20Underground%20-%20OU%ADG%2013?/Main%23Community%3Fcmm%3D49931298&Kolkata%20Knight%20Riders?javascript%3A%3B&-?/Main%23AlbumList&Album?/Main%23FavoriteVideos&Videos?javascript%3A%3B&-?/Main%23GeneralSettings&Edit%20Settings?/Main%23EditSummary&Edit%20Profile?javascript%3A%3B&-?/OMConfig&OM%20Config?/OMConfigMenu&OM%20Menus?/OMCredits&OM%20Credits?/OMHelp&OM%20Help?javascript%3A%3B&-?http%3A//userscripts.org/scripts/show/33131&Script%20Page?javascript%3A%3B&-?/GLogin%3Fcmd%3Dlogout&Logoff";

function IsPage(Url)
{
    var re = new RegExp("[^?]+" + Url + ".*", "i");
    return (window.location.href.replace("/Main#", "/").match(re) ? true : false);
}

// Configuration Data Init
try
{
    var First = false;
    if (!GMGetValue("Language"))
    {
        First = true;
        GMSetValue("Language", "");
    }
    if (!GMGetValue("TextAreaTextBegin")) GMSetValue("TextAreaTextBegin", "");
    if (!GMGetValue("TextAreaTextEnd")) GMSetValue("TextAreaTextEnd", "");
    if (!GMGetValue("TextAreaTextHtmlBegin")) GMSetValue("TextAreaTextHtmlBegin", "");
    if (!GMGetValue("TextAreaTextHtmlEnd")) GMSetValue("TextAreaTextHtmlEnd", "");
    if (!GMGetValue("TextAreaScrapTextBegin")) GMSetValue("TextAreaScrapTextBegin", "");
    if (!GMGetValue("TextAreaScrapTextEnd")) GMSetValue("TextAreaScrapTextEnd", "");
    if (!GMGetValue("Signature")) GMSetValue("Signature", "");
    if (!GMGetValue("SignatureHtml")) GMSetValue("SignatureHtml", "");
    if (!GMGetValue("SignatureScrap")) GMSetValue("SignatureScrap", "");
    if (!GMGetValue("QuoteHeaderText")) GMSetValue("QuoteHeaderText", "");
    if (!GMGetValue("QuoteBegin")) GMSetValue("QuoteBegin", "");
    if (!GMGetValue("QuoteEnd")) GMSetValue("QuoteEnd", "");
    if (!GMGetValue("QuoteHeaderBegin")) GMSetValue("QuoteHeaderBegin", "");
    if (!GMGetValue("QuoteHeaderEnd")) GMSetValue("QuoteHeaderEnd", "");
    if (!GMGetValue("QuoteHtmlBegin")) GMSetValue("QuoteHtmlBegin", "");
    if (!GMGetValue("QuoteHtmlEnd")) GMSetValue("QuoteHtmlEnd", "");
    if (!GMGetValue("QuoteHeaderHtmlBegin")) GMSetValue("QuoteHeaderHtmlBegin", "");
    if (!GMGetValue("QuoteHeaderHtmlEnd")) GMSetValue("QuoteHeaderHtmlEnd", "");
    if (!GMGetValue("ModerationText")) GMSetValue("ModerationText", "");
    if (!GMGetValue("ModerationHtmlText")) GMSetValue("ModerationHtmlText", "");
    if (!GMGetValue("ModerationMemberText")) GMSetValue("ModerationMemberText", "");
    if (!GMGetValue("ModerationMemberHtmlText")) GMSetValue("ModerationMemberHtmlText", "");
    if (!GMGetValue("UpdateWarningType")) GMSetValue("UpdateWarningType", "");
    if (!GMGetValue("HeaderMenu")) GMSetValue("HeaderMenu", "");
    if (!GMGetValue("HeaderMenuClear")) GMSetValue("HeaderMenuClear", "");
    if (!GMGetValue("DropdownMenu")) GMSetValue("DropdownMenu", "[/OMConfigMenu|OM Menus]");
    if (!GMGetValue("Quote")) GMSetValue("Quote", "");
    if (!GMGetValue("Moderation")) GMSetValue("Moderation", "");
    
    if (First) ConfigurationSave(DefaultCfg);
}
catch (ex) { }

// #region CONFIGURATION
function GetErrorPageContainer()
{
    var Container = document.getElementById("mboxfullr").getElementsByTagName("table")[0];
    Container = Container.getElementsByTagName("td");
    var C = "";
    for (i in Container)
    {
        C = Container[i];
        if (C.className == "boxmid") break;
    }
    Container = C;
    return Container;
}
// #endregion


// #region LANGUAGE
var Language = GMGetValue("Language").toLowerCase() || "english";
// #endregion


// #region TEXTAREA
var TextAreaTextBegin = GMGetValue("TextAreaTextBegin") ? GMGetValue("TextAreaTextBegin") : "";
var TextAreaTextEnd = GMGetValue("TextAreaTextEnd") ? GMGetValue("TextAreaTextEnd") : "";

var TextAreaTextHtmlBegin = GMGetValue("TextAreaTextHtmlBegin") ? GMGetValue("TextAreaTextHtmlBegin") : "";
var TextAreaTextHtmlEnd = GMGetValue("TextAreaTextHtmlEnd") ? GMGetValue("TextAreaTextHtmlEnd") : "";

var TextAreaScrapTextBegin = GMGetValue("TextAreaScrapTextBegin") ? GMGetValue("TextAreaScrapTextBegin") : "";
var TextAreaScrapTextEnd = GMGetValue("TextAreaScrapTextEnd") ? GMGetValue("TextAreaScrapTextEnd") : "";
// #endregion

// #region QUOTE
var QuoteBegin = GMGetValue("QuoteBegin") ? GMGetValue("QuoteBegin") : "";
var QuoteEnd = GMGetValue("QuoteEnd") ? GMGetValue("QuoteEnd") : "";
var QuoteHeaderBegin = GMGetValue("QuoteHeaderBegin") ? GMGetValue("QuoteHeaderBegin") : "";
var QuoteHeaderEnd = GMGetValue("QuoteHeaderEnd") ? GMGetValue("QuoteHeaderEnd") : "";

var QuoteHtmlBegin = GMGetValue("QuoteHtmlBegin") ? GMGetValue("QuoteHtmlBegin") : "";
var QuoteHtmlEnd = GMGetValue("QuoteHtmlEnd") ? GMGetValue("QuoteHtmlEnd") : "";
var QuoteHeaderHtmlBegin = GMGetValue("QuoteHeaderHtmlBegin") ? GMGetValue("QuoteHeaderHtmlBegin") : "";
var QuoteHeaderHtmlEnd = GMGetValue("QuoteHeaderHtmlEnd") ? GMGetValue("QuoteHeaderHtmlEnd") : "";

var QuoteButtonColor = "#C40098";
var QuoteHeaderText = GMGetValue("QuoteHeaderText") ? GMGetValue("QuoteHeaderText") : "";
var ShowHeader = true;
// #endregion

// #region SIGNATURE
var Signature = GMGetValue("Signature") ? GMGetValue("Signature") : "";
var SignatureHtml = GMGetValue("SignatureHtml") ? GMGetValue("SignatureHtml") : "";

var SignatureScrap = GMGetValue("SignatureScrap") ? GMGetValue("SignatureScrap") : "";
// #endregion

// #region MODERATION
var ModerationText = GMGetValue("ModerationText") ? GMGetValue("ModerationText") : "";
var ModerationHtmlText = GMGetValue("ModerationHtmlText") ? GMGetValue("ModerationHtmlText") : "";
var ModerationMemberText = GMGetValue("ModerationMemberText") ? GMGetValue("ModerationMemberText") : "";
var ModerationMemberHtmlText = GMGetValue("ModerationMemberHtmlText") ? GMGetValue("ModerationMemberHtmlText") : "";
// #endregion
    
// #region UPDATE SCRIPT
var UpdateWarningType = GMGetValue("UpdateWarningType") ? GMGetValue("UpdateWarningType") : "";
// #endregion

// #region LANGUAGE SETS
// #region TOOLBAR
function LanguageGetSpoiler()
{
    switch (Language)
    {
        case "portuguese":
            return "<b>Aviso:</b> Esta &aacute;rea cont&eacute;m <b>revela&ccedil;&otilde;es sobre o enredo</b> (<i><span style=\\'color: red\\'>spoilers</span></i>).";
        case "spanish":
            return "<b>Atenci&oacute;n:</b> Esta area contiene <b>revelaciones acerca del enredo</b> (<i><span style=\\'color: red\\'>spoilers</span></i>).";
        case "french":
            return "<b>Avertissement:</b> Esta area contiene <b>rรƒยฉvรƒยฉlations au sujet de la parcelle de terrain</b> (<i><span style=\\'color: red\\'>spoilers</span></i>).";
        case "italian":
            return "<b>Avvertimento:</b> Questa zona contiene <b>rivelazioni circa il diagramma</b> (<i><span style=\\'color: red\\'>spoilers</span></i>).";
        case "english":
        default:
            return "<b>Warning:</b> This area contains <b>revelations about the plot</b> (<i><span style=\\'color: red\\'>spoilers</span></i>).";
    }
}
function LanguageGetFonts()
{
    switch (Language)
    {
        case "portuguese":
            return "Fontes";
        case "spanish":
            return "Fuentes";
        case "french":
            return "Fontes";
        case "italian":
            return "Fonti";
        case "english":
        default:
            return "Fonts";
    }
}
function LanguageGetColors()
{
    switch (Language)
    {
        case "portuguese":
            return "Cores";
        case "spanish":
            return "Colores";
        case "french":
            return "Couleurs";
        case "italian":
            return "Colori";
        case "english":
        default:
            return "Colors";
    }
}
function LanguageGetIcons()
{
    switch (Language)
    {
        case "portuguese":
            return "Icones";
        case "spanish":
            return "Iconos";
        case "french":
            return "Icรƒยดnes";
        case "italian":
            return "Icone";
        case "english":
        default:
            return "Icons";
    }
}
function LanguageGetMaskLinks()
{
    switch (Language)
    {
        case "portuguese":
            return "QuebraLinks";
        case "spanish":
            return "QuebraEnlaces";
        case "french":
            return "MaskLinks";
        case "italian":
            return "MascherinaLinks";
        case "english":
        default:
            return "MaskLinks";
    }
}
function LanguageGetCrypt()
{
    switch (Language)
    {
        case "portuguese":
            return "Criptografar";
        case "spanish":
            return "Cifrar";
        case "french":
            return "Crypte";
        case "italian":
            return "Cripta";
        case "english":
        default:
            return "Crypt";
    }
}
function LanguageGetDecrypt()
{
    switch (Language)
    {
        case "portuguese":
            return "Descriptografar";
        case "spanish":
            return "Descifrar";
        case "french":
            return "Dรƒยฉcrypter";
        case "italian":
            return "DeCripta";
        case "english":
        default:
            return "Decrypt";
    }
}
function LanguageGetDate()
{
    switch (Language)
    {
        case "portuguese":
            return "Data";
        case "spanish":
            return "Fecha";
        case "french":
            return "Date";
        case "italian":
            return "Data";
        case "english":
        default:
            return "Date";
    }
}
function LanguageGetTime()
{
    switch (Language)
    {
        case "portuguese":
            return "Hora";
        case "spanish":
            return "Horas";
        case "french":
            return "Temps";
        case "italian":
            return "Tempo";
        case "english":
        default:
            return "Time";
    }
}
// #endregion
// #region USER MENU
function LanguageGetUserMenuProfile()
{
    switch (Language)
    {
        case "portuguese":
            return "Perfil";
        case "spanish":
            return "Perfil";
        case "french":
            return "Profil";
        case "italian":
            return "Profilo";
        case "english":
        default:
            return "Profile";
    }
}
function LanguageGetUserMenuScrapbook()
{
    switch (Language)
    {
        case "portuguese":
            return "Recados";
        case "spanish":
            return "Mensajes";
        case "french":
            return "Carnet";
        case "italian":
            return "Scrapbook";
        case "english":
        default:
            return "Scrapbook";
    }
}
function LanguageGetUserMenuAlbum()
{
    switch (Language)
    {
        case "portuguese":
            return "&Aacute;lbum";
        case "spanish":
            return "&Aacute;lbum";
        case "french":
            return "Photos";
        case "italian":
            return "Foto";
        case "english":
        default:
            return "Album";
    }
}
function LanguageGetUserMenuVideos()
{
    switch (Language)
    {
        case "portuguese":
            return "V&iacute;deos";
        case "spanish":
            return "Videos";
        case "french":
            return "Vidรƒยฉos";
        case "italian":
            return "Videos";
        case "english":
        default:
            return "Videos";
    }
}
function LanguageGetUserMenuAddFriend()
{
    switch (Language)
    {
        case "portuguese":
            return "Adicionar amigo";
        case "spanish":
            return "A&ntilde;adir un amigo";
        case "french":
            return "Ajouter Aux Amis";
        case "italian":
            return "Nuovo Amico";
        case "english":
        default:
            return "Add as a friend";
    }
}
function LanguageGetUserMenuCommunity()
{
    switch (Language)
    {
        case "portuguese":
            return "Comunidades";
        case "spanish":
            return "Comunidades";
        case "french":
            return "Communautรƒยฉs";
        case "italian":
            return "Communities";
        case "english":
        default:
            return "Communities";
    }
}
function LanguageGetUserMenuSendMessage()
{
    switch (Language)
    {
        case "portuguese":
            return "Enviar Mensagem";
        case "spanish":
            return "Envรƒยญe el mensaje";
        case "french":
            return "Envoyez le Message";
        case "italian":
            return "Invia Messaggio";
        case "english":
        default:
            return "Send Message";
    }
}
function LanguageGetUserMenuScrapAll()
{
    switch (Language)
    {
        case "portuguese":
            return "Scrap All Friends";
        case "spanish":
            return "Scrap All Friends";
        case "french":
            return "Scrap All Friends";
        case "italian":
            return "Scrap All Friends";
        case "english":
        default:
            return "Scrap All Friends";
    }
}
function LanguageGetUserMenuMeriSlambook()
{
    switch (Language)
    {
        case "portuguese":
            return "Meri Slambook";
        case "spanish":
            return "Meri Slambook";
        case "french":
            return "Meri Slambook";
        case "italian":
            return "Meri Slambook";
        case "english":
        default:
            return "Meri Slambook";
    }
}
// #endregion
// #region QUICK REPLY
function LanguageGetQuickReplyCurrentDisabled()
{
    switch (Language)
    {
        case "portuguese":
            return "Atual: desativado";
        case "spanish":
            return "Actual: desactivado";
        case "french":
            return "Le courant a dรƒยฉsactivรƒยฉ";
        case "italian":
            return "La corrente ha reso invalida";
        case "english":
        default:
            return "Current disabled";
    }
}
function LanguageGetQuickReplyCurrentEnabled()
{
    switch (Language)
    {
        case "portuguese":
            return "Atual: ativado";
        case "spanish":
            return "Actual: activado";
        case "french":
            return "Le courant a permis";
        case "italian":
            return "Corrente permessa a";
        case "english":
        default:
            return "Current enabled";
    }
}
function LanguageGetQuickReplyFormLabel()
{
    switch (Language)
    {
        case "portuguese":
            return "Resp r&aacute;pida c/ HTML: ";
        case "spanish":
            return "Resp r&aacute;pida c/ HTML: ";
        case "french":
            return "La rรƒยฉponse rapide acceptent le HTML: ";
        case "italian":
            return "QuickRispondi accetta il HTML";
        case "english":
        default:
            return "QuickReply accept HTML: ";
    }
}
function LanguageGetQuickReplyButtonEnable()
{
    switch (Language)
    {
        case "portuguese":
            return "Ativar";
        case "spanish":
            return "Activar";
        case "french":
            return "Permettez";
        case "italian":
            return "Permetta a";
        case "english":
        default:
            return "Enable";
    }
}
function LanguageGetQuickReplyButtonDisable()
{
    switch (Language)
    {
        case "portuguese":
            return "Desativar";
        case "spanish":
            return "Desactivar";
        case "french":
            return "Dรƒยฉbronchement";
        case "italian":
            return "Disable";
        case "english":
        default:
            return "Disable";
    }
}
// #endregion
// #region MODERATION
function LanguageGetModerationMarkedMod()
{
    switch (Language)
    {
        case "portuguese":
            return "Marcado como mod";
        case "spanish":
            return "Marcado como mod";
        case "french":
            return "Marquรƒยฉ comme mod";
        case "italian":
            return "Contrassegnato As mod";
        case "english":
        default:
            return "Marked as mod";
    }
}
function LanguageGetModerationSetMod()
{
    switch (Language)
    {
        case "portuguese":
            return "Marcar como mod";
        case "spanish":
            return "Marcar como mod";
        case "french":
            return "Placez comme mod";
        case "italian":
            return "Regoli As mod";
        case "english":
        default:
            return "Set as mod";
    }
}
function LanguageGetModerationMod()
{
    switch (Language)
    {
        case "portuguese":
            return "Moderar";
        case "spanish":
            return "Moderar";
        case "french":
            return "Au Mod";
        case "italian":
            return "Mod";
        case "english":
        default:
            return "Mod";
    }
}
// #endregion
// #region CHAT
function LanguageGetChatRemove()
{
    switch (Language)
    {
        case "portuguese":
            return "Remover chat";
        case "spanish":
            return "Quitar el chat";
        case "french":
            return "Enlevez la causerie";
        case "italian":
            return "Rimuova la chiacchierata";
        case "english":
        default:
            return "Remove chat";
    }
}
function LanguageGetChatSet()
{
    switch (Language)
    {
        case "portuguese":
            return "Marcar chat";
        case "spanish":
            return "Adiccionar chat";
        case "french":
            return "Causerie rรƒยฉglรƒยฉe";
        case "italian":
            return "Chiacchierata stabilita";
        case "english":
        default:
            return "Set chat";
    }
}
// #endregion
// #region CONTROLS
function LanguageGetButtonBack()
{
    switch (Language)
    {
        case "portuguese":
            return "Voltar";
        case "spanish":
            return "Volver";
        case "french":
            return "Dos";
        case "italian":
            return "Parte Posteriore";
        case "english":
        default:
            return "Back";
    }
}
function LanguageGetButtonRefresh()
{
    switch (Language)
    {
        case "portuguese":
            return "Atualizar";
        case "spanish":
            return "Actualizar";
        case "french":
            return "Rรƒยฉgรƒยฉnรƒยฉrez";
        case "italian":
            return "Rinfreschi";
        case "english":
        default:
            return "Refresh";
    }
}
function LanguageGetButtonQuickReply()
{
    switch (Language)
    {
        case "portuguese":
            return "Resp Rap";
        case "spanish":
            return "Resp Rap";
        case "french":
            return "QRรƒยฉponse";
        case "italian":
            return "QRispondi";
        case "english":
        default:
            return "QReply";
    }
}
function LanguageGetButtonConfig()
{
    switch (Language)
    {
        case "portuguese":
            return "Configura&ccedil;&atilde;o";
        case "spanish":
            return "Configuraciones";
        case "french":
            return "Modifier";
        case "italian":
            return "Modifica";
        case "english":
        default:
            return "Config";
    }
}
function LanguageGetButtonConfigMenu()
{
    switch (Language)
    {
        case "portuguese":
            return "Menu";
        case "spanish":
            return "Menu";
        case "french":
            return "Menu";
        case "italian":
            return "Menu";
        case "english":
        default:
            return "Menu";
    }
}
function LanguageGetButtonCredits()
{
    switch (Language)
    {
        case "portuguese":
            return "Cr&eacute;ditos";
        case "spanish":
            return "Cr&eacute;ditos";
        case "french":
            return "Crรƒยฉdits";
        case "italian":
            return "Accreditamenti";
        case "english":
        default:
            return "Credits";
    }
}
function LanguageGetButtonHelp()
{
    switch (Language)
    {
        case "portuguese":
            return "Ajuda";
        case "spanish":
            return "Ayuda";
        case "french":
            return "Aide";
        case "italian":
            return "Aiuto";
        case "english":
        default:
            return "Help";
    }
}
function LanguageGetButtonDefault()
{
    switch (Language)
    {
        case "portuguese":
            return "Padr&atilde;o";
        case "spanish":
            return "Por defecto";
        case "french":
            return "Dรƒยฉfaut";
        case "italian":
            return "Difetto";
        case "english":
        default:
            return "Default";
    }
}
function LanguageGetButtonExport()
{
    switch (Language)
    {
        case "portuguese":
            return "Exportar";
        case "spanish":
            return "Exportar";
        case "french":
            return "Exportation";
        case "italian":
            return "Esportazione";
        case "english":
        default:
            return "Export";
    }
}
function LanguageGetButtonImport()
{
    switch (Language)
    {
        case "portuguese":
            return "Importar";
        case "spanish":
            return "Importar";
        case "french":
            return "Importation";
        case "italian":
            return "Importazione";
        case "english":
        default:
            return "Import";
    }
}
function LanguageGetButtonSave()
{
    switch (Language)
    {
        case "portuguese":
            return "Salvar";
        case "spanish":
            return "Guardar";
        case "french":
            return "Sauf";
        case "italian":
            return "Salvo";
        case "english":
        default:
            return "Save";
    }
}
function LanguageGetButtonCancel()
{
    switch (Language)
    {
        case "portuguese":
            return "Cancelar";
        case "spanish":
            return "Cancelar";
        case "french":
            return "Annulation";
        case "italian":
            return "Annullamento";
        case "english":
        default:
            return "Cancel";
    }
}
function LanguageGetButtonDownload()
{
    switch (Language)
    {
        case "portuguese":
            return "Download";
        case "spanish":
            return "Descarga";
        case "french":
            return "Tรƒยฉlรƒยฉchargement";
        case "italian":
            return "Download";
        case "english":
        default:
            return "Download";
    }
}
function LanguageGetButtonSettings()
{
    switch (Language)
    {
        case "portuguese":
            return "Op&ccedil;&otilde;es";
        case "spanish":
            return "Opciones";
        case "french":
            return "Arrangements";
        case "italian":
            return "Regolazioni";
        case "english":
        default:
            return "Settings";
    }
}
function LanguageGetButtonForum()
{
    switch (Language)
    {
        case "portuguese":
            return "F&oacute;rum";
        case "spanish":
            return "Foro";
        case "french":
            return "Forum";
        case "italian":
            return "Tribuna";
        case "english":
        default:
            return "Forum";
    }
}
function LanguageGetButtonLast()
{
    switch (Language)
    {
        case "portuguese":
            return "&Uacute;ltima";
        case "spanish":
            return "&Uacute;ltima";
        case "french":
            return "Bout";
        case "italian":
            return "Ultimo";
        case "english":
        default:
            return "Last";
    }
}
// #endregion
// #region BOOKMARKS
function LanguageGetBookmarks()
{
    switch (Language)
    {
        case "portuguese":
            return "Favoritos";
        case "spanish":
            return "Marcadores";
        case "french":
            return "Repรƒยจres";
        case "italian":
            return "Segnalibri";
        case "english":
        default:
            return "Bookmarks";
    }
}
function LanguageGetBookmarksTopics()
{
    switch (Language)
    {
        case "portuguese":
            return "Fav t&oacute;picos";
        case "spanish":
            return "Marc t&oacute;picos";
        case "french":
            return "Matiรƒยจres";
        case "italian":
            return "Soggetti";
        case "english":
        default:
            return "Topics";
    }
}
// #endregion

// #region PAGE CONFIGURATION
function LanguageGetConfigurationPageTitle()
{
    switch (Language)
    {
        case "portuguese":
            return "Configura&ccedil;&atilde;o";
        case "spanish":
            return "Configuracion";
        case "french":
            return "Configuration";
        case "italian":
            return "Configurazione";
        case "english":
        default:
            return "Configuration";
    }
}
function LanguageGetConfigurationLanguage()
{
    switch (Language)
    {
        case "portuguese":
            return "Idioma";
        case "spanish":
            return "Idioma";
        case "french":
            return "Langue";
        case "italian":
            return "Lingua";
        case "english":
        default:
            return "Language";
    }
}
function LanguageGetConfigurationPrefix()
{
    switch (Language)
    {
        case "portuguese":
            return "Prefixo";
        case "spanish":
            return "Prefijo";
        case "french":
            return "Prรƒยฉfixe";
        case "italian":
            return "Prefisso";
        case "english":
        default:
            return "Prefix";
    }
}
function LanguageGetConfigurationSufix()
{
    switch (Language)
    {
        case "portuguese":
            return "Sufixo";
        case "spanish":
            return "Sufijo";
        case "french":
            return "Sufixe";
        case "italian":
            return "Sufisso";
        case "english":
        default:
            return "Sufix";
    }
}
function LanguageGetConfigurationHeader()
{
    switch (Language)
    {
        case "portuguese":
            return "Cab.";
        case "spanish":
            return "Cab.";
        case "french":
            return "En-tรƒยชte";
        case "italian":
            return "Intestazione";
        case "english":
        default:
            return "Header";
    }
}
function LanguageGetConfigurationSignature()
{
    switch (Language)
    {
        case "portuguese":
            return "Assinatura";
        case "spanish":
            return "Firma";
        case "french":
            return "Signature";
        case "italian":
            return "Firma";
        case "english":
        default:
            return "Signature";
    }
}
function LanguageGetConfigurationText()
{
    switch (Language)
    {
        case "portuguese":
            return "Texto";
        case "spanish":
            return "Texto";
        case "french":
            return "Texte";
        case "italian":
            return "Testo";
        case "english":
        default:
            return "Text";
    }
}
function LanguageGetConfigurationTopic()
{
    switch (Language)
    {
        case "portuguese":
            return "Topico";
        case "spanish":
            return "Topico";
        case "french":
            return "Matiรƒยจre";
        case "italian":
            return "Soggetto";
        case "english":
        default:
            return "Topic";
    }
}
function LanguageGetConfigurationMember()
{
    switch (Language)
    {
        case "portuguese":
            return "Membro";
        case "spanish":
            return "Miembro";
        case "french":
            return "Membre";
        case "italian":
            return "Membro";
        case "english":
        default:
            return "Member";
    }
}
function LanguageGetConfigurationModeration()
{
    switch (Language)
    {
        case "portuguese":
            return "Modera&ccedil;&atilde;o";
        case "spanish":
            return "Moderaciรƒยณn";
        case "french":
            return "Modรƒยฉration";
        case "italian":
            return "Moderazione";
        case "english":
        default:
            return "Moderation";
    }
}
function LanguageGetConfigurationUpdateLabel()
{
    switch (Language)
    {
        case "portuguese":
            return "Alertas";
        case "spanish":
            return "Alertas";
        case "french":
            return "Avertissements";
        case "italian":
            return "Avvertimenti";
        case "english":
        default:
            return "Warnings";
    }
}
function LanguageGetConfigurationUpdateBugfix()
{
    switch (Language)
    {
        case "portuguese":
            return "Todas as actualizaรƒยงรƒยตes (recomendadas)";
        case "spanish":
            return "Todas las actualizaciones (recomendadas)";
        case "french":
            return "Tout le (recommandรƒยฉ) de mises รƒย  jour";
        case "italian":
            return "Tutti gli aggiornamenti (Suggerito)";
        case "english":
        default:
            return "All updates (Recommended)";
    }
}
function LanguageGetConfigurationUpdateMinor()
{
    switch (Language)
    {
        case "portuguese":
            return "Mรƒยฉdia Importรƒยขncia";
        case "spanish":
            return "Importancia media";
        case "french":
            return "Importance moyenne";
        case "italian":
            return "Importanza media";
        case "english":
        default:
            return "Average importance";
    }
}
function LanguageGetConfigurationUpdateMajor()
{
    switch (Language)
    {
        case "portuguese":
            return "Muito importantes";
        case "spanish":
            return "Muy importante";
        case "french":
            return "Trรƒยจs important";
        case "italian":
            return "Molto importante";
        case "english":
        default:
            return "Very important";
    }
}
function LanguageGetConfigurationUpdateNone()
{
    switch (Language)
    {
        case "portuguese":
            return "Nรƒยฃo mostrar alertas de atualizaรƒยงรƒยตes";
        case "spanish":
            return "No mostrar alertas de actualizaciรƒยณn d";
        case "french":
            return "Ne montrez pas les alertes de mise รƒย  jour";
        case "italian":
            return "Non mostri gli allarmi dell'aggiornamento";
        case "english":
        default:
            return "Do not show update alerts";
    }
}
function LanguageGetConfigurationResetSettings()
{
    switch (Language)
    {
        case "portuguese":
            return "Voc&ecirc; gostaria de recuperar as configura&ccedil;&otilde;es padr&otilde;es?";
        case "spanish":
            return "ร‚ยฟDesea restaurar la configuraciรƒยณn por defecto?";
        case "french":
            return "Voulez-vous reconstituer des arrangements de dรƒยฉfaut ?";
        case "italian":
            return "Volete ristabilire le regolazioni di difetto?";
        case "english":
        default:
            return "Do you want to restore default settings?";
    }
}
function LanguageGetConfigurationSaveSuccess()
{
    switch (Language)
    {
        case "portuguese":
            return "Configuraรƒยงรƒยตes salvas com sucesso!";
        case "spanish":
            return "Configuraciรƒยณn guardada con รƒยฉxito!";
        case "french":
            return "Les configurations ont รƒยฉconomisรƒยฉ avec succรƒยจs !";
        case "italian":
            return "Le configurazioni hanno risparmiato con successo!";
        case "english":
        default:
            return "Configurations saved successfully!";
    }
}
function LanguageGetConfigurationExport()
{
    switch (Language)
    {
        case "portuguese":
            return "Copie & salve o link (para importar cole)";
        case "spanish":
            return "Copiar y guardar el enlace (pegar para descargar)";
        case "french":
            return "Copiez le & ; sauf ce lien (pour importer la pรƒยขte)";
        case "italian":
            return "Copi il & salvo questo collegamento (per importare colla)";
        case "english":
        default:
            return "Copy & save this link (to import paste)";
    }
}
function LanguageGetConfigurationImport()
{
    switch (Language)
    {
        case "portuguese":
            return "Cole o link (exportado)";
        case "spanish":
            return "Pegue el enlace (exportado)";
        case "french":
            return "Collez le lien (exportรƒยฉ)";
        case "italian":
            return "Incolli il collegamento (esportatore)";
        case "english":
        default:
            return "Paste the link (exported)";
    }
}
// #endregion
// #region UPDATE
function LanguageGetUpdateNotify(Version, UpdateType)
{
    switch (Language)
    {
        case "portuguese":
            return "(Voce e Usando v" + GMGetValue("Version") + "). <b>Orkut Manager Plus v"    + Version + " foi lanรƒยงado.</b> Update tipo '" + UpdateType + "'. ";
        case "spanish":
            return "(Usted es Utilizando v" + GMGetValue("Version") + "). <b>Orkut Manager Plus v" + Version + " fue lanzado.</b> Update tipo '" + UpdateType + "'. ";
        case "french":
            return "(Vous Employez v" + GMGetValue("Version") + "). <b>Orkut Manager Plus v" + Version + " est dehors.</b> Update tipo '" + UpdateType + "'. ";
        case "italian":
            return "(State Usando v" + GMGetValue("Version") + "). <b>Orkut Manager Plus v" + Version + " รƒยจ fuori.</b> Tipo di aggiornamento '" + UpdateType + "'. ";
        case "english":
        default:
            return "(You Are Using v" + GMGetValue("Version") + "). <b>Orkut Manager Plus v"    + Version + " is out.</b> Update type '" + UpdateType + "'. ";
    }
}
// #endregion
// #region MENU CFG
function LanguageGetConfigMenuDropdown()
{
    switch (Language)
    {
        case "portuguese":
            return "Menu";
        case "spanish":
            return "Menu";
        case "french":
            return "Menu";
        case "italian":
            return "Menu";
        case "english":
        default:
            return "Menu";
    }
}
function LanguageGetConfigMenuHeaderMenu()
{
    switch (Language)
    {
        case "portuguese":
            return "Menu superior";
        case "spanish":
            return "Menรƒยบ superior";
        case "french":
            return "Menu d'en-tรƒยชte";
        case "italian":
            return "Menu dell'intestazione";
        case "english":
        default:
            return "Header Menu";
    }
}
function LanguageGetConfigMenuNewRow()
{
    switch (Language)
    {
        case "portuguese":
            return "Nova linha";
        case "spanish":
            return "Nueva lรƒยญnea";
        case "french":
            return "Nouvelle rangรƒยฉe";
        case "italian":
            return "Nuova fila";
        case "english":
        default:
            return "New row";
    }
}
function LanguageGetConfigMenuDelRow()
{
    switch (Language)
    {
        case "portuguese":
            return "Excluir linha";
        case "spanish":
            return "Borrar lรƒยญnea";
        case "french":
            return "Rangรƒยฉe de suppression";
        case "italian":
            return "Fila di cancellazione";
        case "english":
        default:
            return "Del row";
    }
}
// #endregion
// #region OTHERS
function LanguageGetDelete()
{
    switch (Language)
    {
        case "portuguese":
            return "Excluir";
        case "spanish":
            return "Borrar";
        case "french":
            return "Supprimer";
        case "italian":
            return "Cancellazione";
        case "english":
        default:
            return "Delete";
    }
}
function LanguageGetGetImage()
{
    switch (Language)
    {
        case "portuguese":
            return "Pegar imagem";
        case "spanish":
            return "Obtener imagen";
        case "french":
            return "Obtenez l'image";
        case "italian":
            return "Ottenga l'immagine";
        case "english":
        default:
            return "Get image";
    }
}
// #endregion
// #endregion

// Init menu
HeaderMenuMain();
HeaderMenuFix();

// #region HEADER MENU
try
{
    if (GMGetValue("HeaderMenuClear")) HeaderMenuClear();
    var HeaderMenus = GMGetValue("HeaderMenu") || "";
    if (HeaderMenus.length <= 0) throw new Exception();
    HeaderMenus = HeaderMenus.split("][");
    for (i in HeaderMenus)
    {
        var Menu = HeaderMenus[i];
        Menu = Menu.replace(/\[|\]/g, "");
        var Link = (Menu.split("|"))[0];
        var Name = (Menu.split("|"))[1];
        HeaderMenuNew(Link, Name);
    }
}
catch (ex) { }
// #endregion

// #region Dropdown MENU
try
{
    var Menus = GMGetValue("DropdownMenu") || "";
    if (Menus.length <= 0) throw new Exception();
    Menus = Menus.split("][");
    for (i in Menus)
    {
        var Menu = Menus[i];
        Menu = Menu.replace(/\[|\]/g, "");
        var Link = (Menu.split("|"))[0];
        var Name = (Menu.split("|"))[1];
        if (Name == "-") Name = "";
        HeaderMenuMainNew(Link, Name);
    }
}
catch (ex) { }
// #endregion

/// <summary>
/// ************************************************
///           Manual Configuration Start
/// ************************************************
/// </summary>
var SlowConnection = false;

if (IsPage(URLScrap) || IsPage(URLPost) || IsPage(URLMessages))
{
// #region TOOLBAR
var ToolbarBackgroundColor = "#F43009";
var ToolbarButtonSize = "17px";
var ToolbarButtonStyle = "style='cursor: pointer; height: " + ToolbarButtonSize + "; width: " + ToolbarButtonSize + "'";
var StylePointer = "style='cursor:pointer'";
var jsGetElement = "var post = this; do { post = post.parentNode; } while (post && post.id != 'kToolBar'); post = post.nextSibling; if (!post.tagName) post = post.nextSibling; var selectionStart = post.selectionStart; var selectionEnd = post.selectionEnd; var psel = post.value.substr((post.selectionStart), (post.selectionEnd - post.selectionStart)); var PostPre = post.value.substr(0, post.selectionStart); var PostSuf = post.value.substr(post.selectionEnd); var PostSel = psel;";
var jsRestorefocus = " post.selecionStart = selectionStart; post.selectionEnd = selectionEnd; ";
var Tools =
    new Array(
        new Array /* Toolbar Layout: Blank */
        (
            "",
            "{|}",
            "{|}"
        ),
        new Array /* Bold */
        (
            "<img alt='' src='http://i25.tinypic.com/x5s93a.jpg' title='bold' " + ToolbarButtonStyle + " />",
            "<b>{|}</b>",
            "[b]{|}[/b]"
        ),
        new Array /* Italic */
        (
            "<img alt='' src='http://i28.tinypic.com/bevl13.gif' title='italic' " + ToolbarButtonStyle + " />",
            "<i>{|}</i>",
            "[i]{|}[/i]"
        ),
        new Array /* Underline */
        (
            "<img alt='' src='http://i25.tinypic.com/2ugfo7c.jpg' title='underline' " + ToolbarButtonStyle + " />",
            "<u>{|}</u>",
            "[u]{|}[/u]"
        ),
        new Array /* Strike */
        (
            "<img alt='' src='http://i27.tinypic.com/2im4a9.jpg' title='strike' " + ToolbarButtonStyle + " />",
            "<s>{|}</s>",
            ""
        ),
        new Array /* Strike fake (no-html) */
        (
            "<img alt='' src='http://i27.tinypic.com/2im4a9.jpg' " +
            "onclick=\"" + jsGetElement + "function ToolbarStrikeFake(s){var i = 0;var x = 0;var f ='';for (i=0;i<s.length;++i){x = s.charCodeAt(i); f += String.fromCharCode(x) + String.fromCharCode(" + SpecialCharStrikeCode + ");}return f;} post.value = post.value.substr(0, post.selectionStart) + ToolbarStrikeFake(psel) + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" " +
            "title='strike' " + ToolbarButtonStyle + " />",
            "",
            "{|}"
        ),
        new Array /* Blink */
        (
            "<img alt='' src='http://i25.tinypic.com/15nniis.png' title='blink' " + ToolbarButtonStyle + " />",
            "<span style=\\'text-decoration:blink\\'>{|}</span>",
            ""
        ),
        new Array /* Link */
        (
            "<img alt='' src='http://i26.tinypic.com/2gtt6vo.jpg' title='link' " + ToolbarButtonStyle + " />",
            "<a href=\\'{|}\\' title=\\'\\'></a>",
            "[link={|}][/link]"
        ),
        new Array /* Image */
        (
            "<img alt='' src='http://i27.tinypic.com/1zbf62a.jpg' title='Image' " + ToolbarButtonStyle + " />",
            "<img src=\\'{|}\\' style=\\'max-width: 100%\\' />",
            "[link]{|}[/link]"
        ),
        new Array /* Source */
        (
            "<img alt='' src='http://i32.tinypic.com/291exir.png' title='source' " + ToolbarButtonStyle + " />",
            "<div style=\\'border: 1px dashed rgb(47, 111, 171); padding: 5px; background-color: rgb(249, 249, 249); color: black; line-height: 1.1em;\\'><pre style=\\'margin:0px; padding: 1em; overflow:scroll; width: 97%;\\'>{|}</pre></div>",
            ""
        ),
        new Array /* Source (no-html) */
        (
            "<img alt='' src='http://i32.tinypic.com/291exir.png' title='source' " + ToolbarButtonStyle + " " +
            "onclick=\"" +
            jsGetElement +
            "if (!PostPre) PostPre = '.'; " +
            "post.value = PostPre + (PostSel.replace(/ /g, String.fromCharCode(160))) + PostSuf; " +
            "\" />",
            "",
            "{|}",
            "false"
        ),
        new Array /* Spoilers */
        (
            "<img alt='SPOILERS' src='http://i32.tinypic.com/mn0k5.jpg' title='SPOILERS' " + ToolbarButtonStyle + " />",
            "<div style=\\'border-top: 1px solid rgb(255, 204, 102); border-bottom: 1px solid rgb(255, 204, 102); margin: 10px 0px; padding: 5px 0px 5px 3px; background-color: rgb(255, 253, 223); text-align: left; font-size: 90%;\\'>" + LanguageGetSpoiler() + "</div>[yellow]{|}[/yellow]",
            ""
        ),
        new Array /* Quotation */
        (
            "<img alt='' src='http://i26.tinypic.com/2e249bq.png' title='quote' " + ToolbarButtonStyle + " />",
            "<q style=\\'font-style:italic;\\'>{|}</q>",
            ""
        ),
        new Array /* Fonts */
        (
            "<img alt='' src='http://i25.tinypic.com/2i9t5lf.jpg' " + ToolbarButtonStyle + " /> <select>" +
                "<option disabled selected>" + LanguageGetFonts() + "</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Agency FB Bold'>Agency FB Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Algerian'>Algerian</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Arial'>Arial</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Alternator'>Alternator</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Alternator Bold'>Alternator Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Alternator Inverse'>Alternator Inverse</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Arial Narrow'>Arial Narrow</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Argon Extended Bold'>Arial Narrow</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Arno Pro'>Arno Pro</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Assertion Bold'>Assertion Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Attitude Agro'>Attitude Agro</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Atom Bold'>Atom Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Book Antiqua'>Book Antiqua</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bios Three'>Bios Three</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Baskerville Old Face'>Baskerville Old Face</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bauhaus 93'>Bauhaus 93</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bell MT'>Bell MT</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Berlin Sans FB Bold'>Berlin Sans FB Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Berlin Sans FB Demi Bold'>Berlin Sans FB Demi Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bernard MT Condensed'>Bernard MT Condensed</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bodoni MT Black Italic'>Bodoni MT Black Italic</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bodoni MT Poster Compressed'>Bodoni MT Poster Compressed</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bookshelf Symbol 7'>Bookshelf Symbol 7</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bradley Hand ITC'>Bradley Hand ITC</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Brush Script MT Italic'>Brush Script MT Italic</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Bookman Old Style'>Bookman Old Style</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Calibri'>Calibri</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Capacity Heavy'>Capacity Heavy</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Comic Sans MS'>Comic Sans MS</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Clarity Tight Bold'>Clarity Tight Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: DEATH FONT ver1\.0'>DEATH FONT ver1\\.0</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Dexxi'>Dexxi</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Diablo'>Diablo</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Empathi'>Empathi</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Energii Condensed'>Energii Condensed</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Emfatik'>Emfatik</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Final Fantasy'>Final Fantasy</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Garamond'>Garamond</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Impact'>Impact</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Media 22 Led'>Media 22 Led</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Mini 7'>Mini 7</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Mini 7 Bold'>Mini 7 Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: MiniCurve'>MiniCurve</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Minimicra Bold'>Minimicra Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Monotony HR'>Monotony HR</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: MS Mincho'>MS Mincho</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Monotype Corsiva'>Monotype Corsiva</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Ninja Naruto'>Ninja Naruto</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Nano Sans Lc Bold'>Nano Sans Lc Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Nano Sans Sc Bold'>Nano Sans Sc Bold</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Nano Sans Sc Bold Oblique'>Nano Sans Sc Bold Oblique</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Palatino Linotype'>Palatino Linotype</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Regulus Ultra'>Regulus Ultra</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Sand'>Sand</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Sportster XB'>Sportster XB</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Tahoma'>Tahoma</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Time New Roman'>Time New Roman</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Verdana'>Verdana</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0,    post.selectionStart) + '<span style=\\'font-family:' + this.value + '\\'>{|}</span>' +    post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value    = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus +    psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value;'    style='font-family: Wysp Bold'>Wysp Bold</option>" +
            "</select>",
            "{|}",
            "",
            "false"
        ),
        new Array /* Font Grow */
        (
            "<img alt='' src='http://i28.tinypic.com/34yu4xe.jpg' " + ToolbarButtonStyle + " />",
            "<big>{|}</big>",
            ""
        ),
        new Array /* Font Shrink */
        (
            "<img alt='' src='http://i30.tinypic.com/fxgysk.jpg' " + ToolbarButtonStyle + " />",
            "<small>{|}</small>",
            ""
        ),
        new Array /* Font Size */
        (
            "<img alt='' src='http://i27.tinypic.com/303gz2v.jpg' " + ToolbarButtonStyle + " /> <select>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">0</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">6</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">8</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">9</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">10</option>" +
            "<option selected onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">11</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">12</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">14</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">16</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">18</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">20</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">22</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">26</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">30</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">36</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">48</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">72</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">100</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">500</option>" +
            "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'font-size:' + this.value + 'px\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\">1000</option>" +
            "</select>",
            "{|}",
            "",
            "false"
        ),
        new Array /* Toolbar Layout: New Line */
        (
            "<br />",
            "{|}",
            "{|}"
        ),
        new Array /* Highlight HTML */
        (
            "<span style=\"width: 20px;background-color:navy; background-position: -3px 50%;\">&nbsp;&nbsp;&nbsp;&nbsp;</span> <select style='width: 80px'>" +
                "<option disabled selected>" + "Highlight" + "</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i32.tinypic.com/161108p.png)';\"  style='background-color: maroon'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i28.tinypic.com/2vum07a.png)';\"  style='background-color: red'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i30.tinypic.com/29cweio.png)';\"  style='background-color: orange'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i26.tinypic.com/1zc0km8.jpg)';\"  style='background-color: navy'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i26.tinypic.com/1zc0km8.png)'\"  style='background-color: blue'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i31.tinypic.com/ionqwy.png)'\"  style='background-color: aqua'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i27.tinypic.com/2csgnx0.png)'\"  style='background-color: teal'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i31.tinypic.com/f3xag9.png)'\"  style='background-color: green'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i30.tinypic.com/wu1jdd.png)'\"  style='background-color: lime'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i28.tinypic.com/28k0ady.png)'\"  style='background-color: olive'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i27.tinypic.com/2jg80uv.png)'\"  style='background-color: gold'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i29.tinypic.com/2pseuqt.png)'\"  style='background-color: yellow'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i26.tinypic.com/1sd1e1.png)'\"  style='background-color: gray'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i29.tinypic.com/2qizpqx.png)'\"  style='background-color: silver'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i32.tinypic.com/znmzwz.png)'\"  style='background-color: purple'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i29.tinypic.com/s4vrkx.png)'\"  style='background-color: fuchsia'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i30.tinypic.com/rit2j4.png)'\"  style='background-color: violet'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'background-color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundImage= 'url(http://i25.tinypic.com/6xpyxd.png)'\"  style='background-color: pink'>&nbsp;</option>" +
            "</select>",
            "{|}",
            "",
            "false"
        ),
        new Array /* Color picker HTML */
        (
            "<span style='width: 16px;background-color:navy;'>&nbsp;&nbsp;&nbsp;&nbsp;</span> <select style='width: 65px'>" +
                "<option disabled selected>" + LanguageGetColors() + "</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: maroon'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: red'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: orange'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: navy'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: blue'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: aqua'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: teal'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: green'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: lime'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: olive'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: gold'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: yellow'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: gray'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: silver'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: purple'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: fuchsia'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: violet'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '<span style=\\'color: ' + this.style.backgroundColor + '\\'>{|}</span>' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: pink'>&nbsp;</option>" +
            "</select>",
            "{|}",
            "",
            "false"
        ),
        new Array /* Color picker */
        (
            "<span style='width: 16px;background-color:navy;'>&nbsp;&nbsp;&nbsp;&nbsp;</span> <select style='width: 65px'>" +
                "<option disabled selected>" + LanguageGetColors() + "</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\" style='background-color: maroon'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: red'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: orange'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: navy'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: blue'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: aqua'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: teal'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: green'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: lime'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: olive'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: gold'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: yellow'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: gray'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: silver'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: purple'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: fuchsia'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: violet'>&nbsp;</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.style.backgroundColor + ']{|}[/' + this.style.backgroundColor + ']' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus(); this.parentNode.selectedIndex=0;\" onmouseover=\"this.parentNode.parentNode.firstChild.style.backgroundColor=this.style.backgroundColor;\"  style='background-color: pink'>&nbsp;</option>" +
            "</select>",
            "",
            "{|}",
            "false"
        ),
        new Array /* Emoticons */
        (
            "<b><img alt='' src='http://img1.orkut.com/img/i_bigsmile.gif' /></b> <select>" +
                "<option disabled selected>" + LanguageGetIcons() + "</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_smile.gif\";' style='background-image: url(http://img1.orkut.com/img/i_smile.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:)</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_wink.gif\";' style='background-image: url(http://img1.orkut.com/img/i_wink.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>;)</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_bigsmile.gif\";' style='background-image: url(http://img1.orkut.com/img/i_bigsmile.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:D</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_funny.gif\";' style='background-image: url(http://img3.orkut.com/img/i_funny.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:P</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_confuse.gif\";' style='background-image: url(http://img4.orkut.com/img/i_confuse.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>/)</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_cool.gif\";' style='background-image: url(http://img3.orkut.com/img/i_cool.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>8)</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_surprise.gif\";' style='background-image: url(http://img4.orkut.com/img/i_surprise.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:o</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_sad.gif\";' style='background-image: url(http://img4.orkut.com/img/i_sad.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:(</option>" +
                "<option onclick=\"" + jsGetElement + " post.value = post.value.substr(0, post.selectionStart) + '[' + this.value + ']{|}' + post.value.substr(post.selectionEnd); var focus = post.value.lastIndexOf('{|}'); post.value = post.value.replace('{|}', psel); post.selectionStart = focus; post.selectionEnd = focus + psel.length; post.focus();\" onmouseover='this.parentNode.value=this.value; this.parentNode.previousSibling.previousSibling.firstChild.src=\"http://img1.orkut.com/img/i_angry.gif\";' style='background-image: url(http://img2.orkut.com/img/i_angry.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:x</option>" +
            "</select>",
            "{|}",
            "{|}",
            "false"
        ),
        new Array /* Mask Links HTML */
        (
            "<span style='cursor: pointer; font-size: 85%; font-weight: bold;' " +
            "onclick=\"" +
            jsGetElement +
            "post.value = post.value.replace(/(http:\\/)()(\\/)/, '$1[b]$2[/b]$3'); " +
            "post.value = post.value.replace(/(.*?)()(\\.)([A-Z]+|[0-9]+)/ig, '$1$3[b]$2[/b]$4');" +
            "\"" +
            ">" + LanguageGetMaskLinks() + "</span>",
            "{|}",
            "",
            "false"
        ),
        new Array /* Mask Links */
        (
            "<span style='cursor: pointer; font-size: 85%; font-weight: bold;' " +
            "onclick=\"" +
            jsGetElement +
            "post.value = post.value.replace(/(http:\\/)()(\\/)/, '$1[b]$2[/b]$3'); " +
            "post.value = post.value.replace(/(.*?)()(\\.)([A-Z]+|[0-9]+)/ig, '$1*$3$4');" +
            "\"" +
            ">" + LanguageGetMaskLinks() + "</span>",
            "",
            "{|}",
            "false"
        ),
        new Array /* New Line */
        (
            "<span style='cursor: pointer; font-size: 85%; font-weight: bold;'>&lt;br /&gt;</span>",
            "<br />{|}",
            ""
        ),
        new Array /* Crypt */
        (
            "<span style='cursor: pointer; font-size: 85%; font-weight: bold;' onclick=\"" + jsGetElement + "function crypt(s, secret){var i = 0;var x = 0;var f ='';for (i=0;i<s.length;++i){x = s.charCodeAt(i);if (x == 32){f += String.fromCharCode(x); continue;} f += String.fromCharCode(x+secret);}return f;} post.value = (crypt(post.value, 77))\">" + LanguageGetCrypt() + "</span>",
            "{|}",
            "{|}"
        ),
        new Array /* Decrypt */
        (
            "<span style='cursor: pointer; font-size: 85%; font-weight: bold;' onclick=\"" + jsGetElement + "function crypt(s, secret){var i = 0;var x = 0;var f ='';for (i=0;i<s.length;++i){x = s.charCodeAt(i);if (x == 32){f += String.fromCharCode(x); continue;} f += String.fromCharCode(x+secret);}return f;} post.value = (crypt(post.value, -77))\">" + LanguageGetDecrypt() + "</span>",
            "{|}",
            "{|}"
        ),
        new Array /* Date */
        (
            "<span style='cursor: pointer; font-size: 85%; font-weight: bold;' onclick=\"" + jsGetElement + "function GetDate(){var dt = new Date();var d = dt.getDate() < 10 ? '0' + dt.getDate() : dt.getDate();var m = dt.getMonth() < 10 ? '0' + (dt.getMonth()+1) : (dt.getMonth()+1);var y = dt.getFullYear(); return y + '-' + m + '-' + d;} post.value= post.value.substr(0, post.selectionStart) + GetDate() + post.value.substring(post.selectionEnd);\">" + LanguageGetDate() + "</span>",
            "{|}",
            "{|}"
        ),
        new Array /* Time */
        (
            "<span style='cursor: pointer; font-size: 85%; font-weight: bold;' onclick=\"" + jsGetElement + "function GetTime(){var dt = new Date();var s = dt.getSeconds() < 10 ? '0' + dt.getSeconds() : dt.getSeconds();var m = dt.getMinutes() < 10 ? '0' + (dt.getMinutes()) : (dt.getMinutes());var h = dt.getHours() < 10 ? '0' + dt.getHours() : dt.getHours(); return h + ':' + m + ':' + s;} post.value= post.value.substr(0, post.selectionStart) + GetTime() + post.value.substring(post.selectionEnd);\">" + LanguageGetTime() + "</span>",
            "{|}",
            "{|}"
        )
    );
// #endregion
}

/// <summary>
/// ************************************************
///           Manual Configuration End
/// ************************************************
/// </summary>

// #region SYSTEM SETUP
function InitializeComponents()
{
    var args = (window.location.href.replace(RegexArg, "")).split("&");
    CommunityId = args[0] ? args[0].split("=")[1] : 0;
    CommunityTopicId = args[1] ? args[1].split("=")[1] : 0;
}

// #region SYSTEM SETTINGS
if (!IsPage(URLOMConfig))
{
    TextAreaTextBegin = (IsHtmlEnabled() ? TextAreaTextHtmlBegin : TextAreaTextBegin);
    TextAreaTextEnd = (IsHtmlEnabled() ? TextAreaTextHtmlEnd : TextAreaTextEnd);

    QuoteBegin = (IsHtmlEnabled() ? QuoteHtmlBegin : QuoteBegin);
    QuoteEnd = (IsHtmlEnabled() ? QuoteHtmlEnd : QuoteEnd);
    QuoteHeaderBegin = (IsHtmlEnabled() ? QuoteHeaderHtmlBegin : QuoteHeaderBegin);
    QuoteHeaderEnd = (IsHtmlEnabled() ? QuoteHeaderHtmlEnd : QuoteHeaderEnd);

    Signature = (IsHtmlEnabled() ? SignatureHtml : Signature);
}

if (IsPage("Scrapbook"))
{
    TextAreaTextBegin = TextAreaScrapTextBegin;
    TextAreaTextEnd = TextAreaScrapTextEnd;
    Signature = SignatureScrap;
}

// Focus length
var FocusLength = TextAreaTextEnd.length + Signature.length;
// #endregion
// #endregion


// #region SYSTEM FUNCTIONS
window.mouseX = 200;
window.mouseY = 200;
window.addEventListener("mousemove",
    function (e)
    {
        window.mouseX = e.pageX;
        window.mouseY = e.pageY;
    }, false);
function ArrayRemoveNullValues(arr)
{
    for (i = 0; i < arr.length; ++i)
    {
        if (arr[i].replace(RegexTrim, "") == "" || arr[i] == null)
        {
            arr.splice(i, 1);
            --i;
        }
    }
    return arr;
}

function GetElementsByClassName(TagName, ClassName, Parent)
{
    if (!Parent) Parent = document;
    var Els = Parent.getElementsByTagName(TagName);
    var C = new Array();
    for (i in Els)
    {
        var E = Els[i];
        if (!E) continue;
        if (E.className && E.className.toLowerCase() == ClassName.toLowerCase())
        {
            C.push(E);
        }
    }
    return C;
}

function StringCommaArrayRemove(StringArray, Id)
{
    StringArray = StringArray.split(",");
    StringArray.splice(StringArray.indexOf(Id), 1);
    return StringArray.join(",");
}

function StringUpperFirst(Str)
{
    return Str.substr(0, 1).toUpperCase() + Str.substr(1);
}

// #region DRAG N' DROP
function DragMouseDown(e, Element, Function)
{
    IsDragging = true;
    DragFunction = Function;
    DragCurrentX = Element.offsetLeft;
    DragCurrentY = Element.offsetTop;
    DragX = e.pageX;
    DragY = e.pageY;
    window.status = IsDragging;
}

function DragMouseUp()
{
    IsDragging = false;
    DragFunction = "";
}

function DragMouseMove(e, Element)
{
    if (IsDragging)
    {
        if (DragFunction == "Move")
        {
            Element.style.position = "absolute";
            Element.style.left = (e.pageX - DragX + DragCurrentX);
            Element.style.top  = (e.pageY - DragY + DragCurrentY);
        }
        if (DragFunction == "Resize")
        {
            Element.style.width = (e.pageX - DragCurrentX) + "px";
            Element.style.height = (e.pageY - DragCurrentY - 27) + "px";
        }
    }
}
// #endregion

/// <summary>
/// Ajax Request Page handle in Func
/// </summary>
/// <Param name="Page">Url</Param>
/// <Param name="Func">Function to handle</Param>
function AjaxRequest(Page, Func)
{
    GM_xmlhttpRequest({
        method: 'GET',
        url: (window.location.href.match(/^(http:\/\/[^/]+)/)[0]) + Page + "cache=" + (new Date().getTime()),
        onload: Func
    });
}

/// <summary>
/// Ajax Request Page handle in Func
/// </summary>
/// <Param name="Page">Url</Param>
/// <Param name="Func">Function to handle</Param>
function AjaxRequestExtern(Page, Func)
{
    GM_xmlhttpRequest({
        method: 'GET',
        url: Page + "cache=" + (new Date().getTime()),
        onload: Func
    });
}
// #endregion

// #region SCRIPT FUNCTIONS
function GetParam(Name)
{
    var p;
    var r = new RegExp("(\\?|&)" + Name + "=([^&]*)")
    try
    {
        p = (window.location.href).match(r);
        if (p.length >= 3) return p[2];
        else return "";
    }
    catch (ex) { return false; }
}
function IsHtmlEnabled(IsFrame)
{
    if (IsPage(URLScrap)) return true;
    if (!IsPage("/Comm")) return false;
    if (!IsPage("/CommMsgPost")) return IsQuickReply();
    
    var Container = window.document;
    if (IsFrame)
        Container = document.getElementById("orkutFrame").contentDocument;

    var Check = Container.getElementById("charCount");
    if (!Check) return false;
    Check = Check.parentNode.parentNode;
    var Permission = Check.innerHTML.replace(/<.*?>/g, "");
    Permission = Permission.substr(Permission.indexOf("HTML"));

    if (Permission.match(/^\s*HTML.{10,}\.\s*$/i))
        return true;
    else
        return false;
    return false;
}
var useremail = document.getElementsByClassName("useremail")[0].getElementsByTagName("b")[0].innerHTML;

function GetTextPreview(Prev)
{
    if (!IsHtmlEnabled()) Prev = Prev.replace(/</ig, "&lt;").replace(/>/ig, "&gt;");
    Prev = Prev.replace(/([^>])\r*\n/g, "$1<br />");
    
    Prev = Prev.replace(/\[b\]/ig, "<b>");
    Prev = Prev.replace(/\[\/b\]/ig, "</b>");
    Prev = Prev.replace(/\[i\]/ig, "<i>");
    Prev = Prev.replace(/\[\/i\]/ig, "</i>");
    Prev = Prev.replace(/\[u\]/ig, "<u>");
    Prev = Prev.replace(/\[\/u\]/ig, "</u>");
    
    Prev = Prev.replace(/\[:\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_smile.gif' />");
    Prev = Prev.replace(/\[;\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_wink.gif' />");
    Prev = Prev.replace(/\[:D\]/g, "<img alt='' src='http://img1.orkut.com/img/i_bigsmile.gif' />");
    Prev = Prev.replace(/\[:P\]/g, "<img alt='' src='http://img1.orkut.com/img/i_funny.gif' />");
    Prev = Prev.replace(/\[\/\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_confuse.gif' />");
    Prev = Prev.replace(/\[8\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_cool.gif' />");
    Prev = Prev.replace(/\[:o\]/g, "<img alt='' src='http://img1.orkut.com/img/i_surprise.gif' />");
    Prev = Prev.replace(/\[:\(\]/g, "<img alt='' src='http://img1.orkut.com/img/i_sad.gif' />");
    Prev = Prev.replace(/\[:x\]/g, "<img alt='' src='http://img1.orkut.com/img/i_angry.gif' />");
    
    Prev = Prev.replace(/\[maroon\]/ig, "<span style='color: maroon'>");
    Prev = Prev.replace(/\[\/maroon\]/ig, "</span>");
    Prev = Prev.replace(/\[red\]/ig, "<span style='color: red'>");
    Prev = Prev.replace(/\[\/red\]/ig, "</span>");
    Prev = Prev.replace(/\[orange\]/ig, "<span style='color: orange'>");
    Prev = Prev.replace(/\[\/orange\]/ig, "</span>");
    Prev = Prev.replace(/\[navy\]/ig, "<span style='color: navy'>");
    Prev = Prev.replace(/\[\/navy\]/ig, "</span>");
    Prev = Prev.replace(/\[blue\]/ig, "<span style='color: blue'>");
    Prev = Prev.replace(/\[\/blue\]/ig, "</span>");
    Prev = Prev.replace(/\[aqua\]/ig, "<span style='color: aqua'>");
    Prev = Prev.replace(/\[\/aqua\]/ig, "</span>");
    Prev = Prev.replace(/\[teal\]/ig, "<span style='color: teal'>");
    Prev = Prev.replace(/\[\/teal\]/ig, "</span>");
    Prev = Prev.replace(/\[green\]/ig, "<span style='color: green'>");
    Prev = Prev.replace(/\[\/green\]/ig, "</span>");
    Prev = Prev.replace(/\[lime\]/ig, "<span style='color: lime'>");
    Prev = Prev.replace(/\[\/lime\]/ig, "</span>");
    Prev = Prev.replace(/\[olive\]/ig, "<span style='color: olive'>");
    Prev = Prev.replace(/\[\/olive\]/ig, "</span>");
    Prev = Prev.replace(/\[gold\]/ig, "<span style='color: gold'>");
    Prev = Prev.replace(/\[\/gold\]/ig, "</span>");
    Prev = Prev.replace(/\[yellow\]/ig, "<span style='color: yellow'>");
    Prev = Prev.replace(/\[\/yellow\]/ig, "</span>");
    Prev = Prev.replace(/\[gray\]/ig, "<span style='color: gray'>");
    Prev = Prev.replace(/\[\/gray\]/ig, "</span>");
    Prev = Prev.replace(/\[silver\]/ig, "<span style='color: silver'>");
    Prev = Prev.replace(/\[\/silver\]/ig, "</span>");
    Prev = Prev.replace(/\[purple\]/ig, "<span style='color: purple'>");
    Prev = Prev.replace(/\[\/purple\]/ig, "</span>");
    Prev = Prev.replace(/\[fuchsia\]/ig, "<span style='color: fuchsia'>");
    Prev = Prev.replace(/\[\/fuchsia\]/ig, "</span>");
    Prev = Prev.replace(/\[violet\]/ig, "<span style='color: violet'>");
    Prev = Prev.replace(/\[\/violet\]/ig, "</span>");
    Prev = Prev.replace(/\[pink\]/ig, "<span style='color: pink'>");
    Prev = Prev.replace(/\[\/pink\]/ig, "</span>");
    
    return Prev;
}

function GetProfileGadgetsButton(Label, Url)
{
    var Link = document.createElement("a");
    Link.href = Url;
    Link.className = "ht";
    var But = document.createElement("p");
    But.className = "lf";
    But.innerHTML = Label + "<br />";
    var Img = document.createElement("img");
    Img.style.width = "14px";
    Img.style.height = "14px";
    Img.border = "0";
    Img.src = "http://static3.orkut.com/img/castro/p_video.gif";
    But.appendChild(Img);
    var Count = document.createElement("span");
    Count.className = "largenum";
    Count.innerHTML = "X";
    But.appendChild(Count);
    Link.appendChild(But);
    
    return Link;
}

function SetTextArea(TextArea, IfEmpty)
{
    if (IfEmpty && (!TextArea.value || TextArea.value == ""))
    {
        TextArea.value = TextAreaTextBegin + TextAreaTextEnd + Signature;
        TextArea.selectionStart = TextArea.selectionEnd = TextAreaTextBegin.length;
        return;
    }
    if (IfEmpty) return;
    if (!TextArea.value ||
        (TextArea.value.indexOf(TextAreaTextBegin) == -1 ||
        TextArea.value.indexOf(TextAreaTextEnd) == -1))
    {
        TextArea.value = TextAreaTextBegin + TextAreaTextEnd;
        TextArea.selectionStart = TextArea.selectionEnd = TextAreaTextBegin.length;
    }
    if (!TextArea.value || TextArea.value.indexOf(Signature) == -1)
    {
        TextArea.value += Signature;
        TextArea.selectionStart = TextArea.selectionEnd = TextAreaTextBegin.length;
    }
}

/// <summary>
/// Create Button
/// </summary>
/// <param name="Text">Button text</param>
/// <param name="Func">Button function</param>
/// <param name="Event">Function event</param>
/// <param name="Tooltip">Tooltip</param>
function ButtonCreate(Text, Func, Event, Tooltip)
{
    var ButtonContainer = document.createElement("span");
    var ButtonPlaceHolder = document.createElement("span");
    ButtonPlaceHolder.className = "grabtn";
    
    var Button = document.createElement("a");
    Button.id = "id" + Text + CommunityId;
    Button.innerHTML = Text;
    Button.className = "btn";
    Button.href = "javascript:;";
    
    ButtonPlaceHolder.appendChild(Button);
    ButtonContainer.appendChild(ButtonPlaceHolder);
    
    var BorderRight = document.createElement("span");
    BorderRight.className = "btnboxr";
    var PixImg = document.createElement("img");
    PixImg.height = "1";
    PixImg.width = "5";
    PixImg.src = "http://img1.orkut.com/img/b.gif";
    PixImg.alt = "";
    
    if (Tooltip)
        ButtonContainer.title = Tooltip;
    
    BorderRight.appendChild(PixImg);
    ButtonContainer.appendChild(BorderRight);
    
    if (Func)
        ButtonContainer.addEventListener(Event, Func, false);
    
    return ButtonContainer;
}

// #region CHAT
function BuildChatBox()
{
    var ContainerPanel = document.createElement("div");
    var ContainerChat = document.createElement("table");
    
    ContainerPanel.id = "Chat";
    ContainerPanel.style.position = "absolute";
    ContainerPanel.style.width = "142px";
    ContainerPanel.style.zIndex= "5000";
    ContainerPanel.style.minWidth = "118px";
    ContainerPanel.style.maxWidth = "1000px";
    ContainerPanel.style.maxHeight = "700px";
    
    // Top, title
    var ContainerChatTopRow = document.createElement("tr");
    var ContainerChatBorderTopLeft = document.createElement("td");
    var ContainerChatBorderTopRight = document.createElement("td");
    ContainerChat.id = "Chat" + CommunityId;
    ContainerChat.className = "module";
    ContainerChat.style.width = "100%";
    ContainerChat.style.height= "100%";
    ContainerChat.cellSpacing = "0";
    ContainerChat.cellPadding = "0";
    
    ContainerChatBorderTopLeft.style.width = "99%";
    ContainerChatBorderTopRight.style.width= "8px";
    
    ContainerChatBorderTopLeft.style.margin = "5px 0 6px 10px";
    ContainerChatBorderTopLeft.style.lineHeight = "21px";
    ContainerChatBorderTopLeft.style.fontSize = "10px";
    ContainerChatBorderTopLeft.style.textAlign = "center";
    ContainerChatBorderTopLeft.className = "topl";
    ContainerChatBorderTopRight.className = "topr";
    ContainerChatBorderTopLeft.style.backgroundRepeat = "no-repeat";
    ContainerChatBorderTopRight.style.backgroundRepeat = "no-repeat";
    
    var ChatQuickReply = document.createElement("a");
    ChatQuickReply.href = "javascript:;";
    ChatQuickReply.innerHTML = " QReply -";
    ChatQuickReply.style.cursor = "pointer";
    ChatQuickReply.addEventListener("click",
        function ()
        {
            QuickReply(ChatTopicId);
        }, false);
    
    var ChatGo = document.createElement("a");
    ChatGo.href = URLMessages + "?cmm=" + CommunityId + "&tid=" + ChatTopicId + "&na=2&Scroll=-1";
    ChatGo.innerHTML = " Chat -";
    ChatGo.style.cursor = "pointer";
    
    var ExpandCollapse = document.createElement("a");
    ExpandCollapse.href = "javascript:;";
    ExpandCollapse.innerHTML = " [+] ";
    ExpandCollapse.style.cursor = "pointer";
    ExpandCollapse.addEventListener("click",
        function ()
        {
            var Chat = document.getElementById("Chat");
            var Width = 700;
            if (parseInt(Chat.style.width.replace(/[a-z]*/i, "")) >= Width)
            {
                Chat.style.width = "140px";
                this.innerHTML = " [+]";
            }
            else
            {
                Chat.style.width = Width + "px";
                this.innerHTML = " [-]";
            }
        }, false);
    
    ContainerChatBorderTopLeft.appendChild(ChatQuickReply);
    ContainerChatBorderTopLeft.appendChild(ChatGo);
    ContainerChatBorderTopLeft.appendChild(ExpandCollapse);
    
    ContainerChatTopRow.appendChild(ContainerChatBorderTopLeft);
    ContainerChatTopRow.appendChild(ContainerChatBorderTopRight);
    ContainerChat.appendChild(ContainerChatTopRow);
    
    // Mid, messages
    var ContainerChatRow = document.createElement("tr");
    var ContainerChatMessages = document.createElement("td");
    var ContainerChatMessagesBorder = document.createElement("td");
    ContainerChatMessages.className = "boxmid";
    ContainerChatMessagesBorder.className = "boxmidr";
    ContainerChatMessages.style.paddingBottom = "5px";
    ContainerChatMessages.style.verticalAlign = "top";

    var ContainerChatMessagesDiv = document.createElement("div");
    ContainerChatMessagesDiv.id = "ChatMessages";
    ContainerChatMessagesDiv.style.overflowY = "scroll";
    ContainerChatMessagesDiv.style.overflowX = "hidden";
    ContainerChatMessagesDiv.style.height = "200px";
    ContainerChatMessagesDiv.style.fontSize = "10px";
    ContainerChatMessagesDiv.style.backgroundColor = "#F43009";
    ContainerChatMessagesDiv.innerHTML = "Loading...";
    
    ContainerChatMessages.appendChild(ContainerChatMessagesDiv);
    ContainerChatRow.appendChild(ContainerChatMessages);
    ContainerChatRow.appendChild(ContainerChatMessagesBorder);
    ContainerChat.appendChild(ContainerChatRow);
    
    // Bot, footer
    var ContainerChatBottomRow = document.createElement("tr");
    var ContainerChatBorderBottomLeft = document.createElement("td");
    var ContainerChatBorderBottomRight = document.createElement("td");
    ContainerChatBorderBottomLeft.className = "botl";
    ContainerChatBorderBottomRight.className = "botr";
    ContainerChatBorderBottomLeft.style.backgroundRepeat = "no-repeat";
    ContainerChatBorderBottomRight.style.backgroundRepeat = "no-repeat";
    
    ContainerChatBottomRow.appendChild(ContainerChatBorderBottomLeft);
    ContainerChatBottomRow.appendChild(ContainerChatBorderBottomRight);
    ContainerChat.appendChild(ContainerChatBottomRow);
    
    ContainerPanel.appendChild(ContainerChat);

    // Events
    document.body.addEventListener("mouseup", DragMouseUp, false);    
    // Move
    ContainerChatTopRow.style.cursor = "move";
    ContainerChatTopRow.addEventListener("mousedown", function (e) { DragMouseDown(e, this.parentNode.parentNode, "Move"); }, false);
    document.body.addEventListener("mousemove", function (e) { DragMouseMove(e, document.getElementById('Chat')); }, false);
    
    // Resize
    ContainerChatMessagesBorder.style.cursor = "crosshair";
    ContainerChatMessagesBorder.addEventListener("mousedown",  function (e) { DragMouseDown(e, this.parentNode.parentNode.parentNode, "Resize"); }, false);
    
    ContainerChatBottomRow.style.cursor = "crosshair";
    ContainerChatBottomRow.addEventListener("mousedown",  function (e) { DragMouseDown(e, this.parentNode.parentNode, "Resize"); }, false);
    
    document.body.addEventListener("mousemove",
        function (e)
        {
            var Messages = document.getElementById("ChatMessages");
            DragMouseMove(e, document.getElementById('Chat'));
            if (IsDragging && DragFunction == "Resize")
                Messages.style.height = Messages.parentNode.parentNode.parentNode.parentNode.style.height;
        }, false);
    
    return ContainerPanel;
}

function ChatGetMessages()
{
    function GetMessages(response)
    {
        var Page = response.responseText;
        var TemporaryContainer = document.createElement("div");
        TemporaryContainer.innerHTML = Page;
        var Elements = TemporaryContainer.getElementsByTagName("div");
        var El;
        for (var Element in Elements)
        {
            if (Elements[Element].id == "mboxfull")
            {
                El = Elements[Element];
                break;
            }
        }
        if (!El) return;
        Elements = El.getElementsByTagName("div");

        var Users = new Array();
        var Msgs = new Array();
        for (var Element in Elements)
        {
            if (Elements[Element].className == "listitem")
            {
                Users.push(Elements[Element].getElementsByTagName("H3")[0].innerHTML);
                Msgs.push(Elements[Element].getElementsByTagName("DIV")[1].innerHTML);
            }
        }

        var ChatMessageContainer = document.getElementById("ChatMessages");
        ChatMessageContainer.innerHTML = "";
        for (var Info in Users)
        {
            ChatMessageContainer.innerHTML += "<small><b>" + Users[Info] + ":</b><br />" + Msgs[Info] + "<br /><br /></small>";
        }
        ChatMessageContainer.scrollTop = 9999999 + ChatMessageContainer.offsetHeight;
        
        Links = ChatMessageContainer.getElementsByTagName("a");
        OrkutLinksFix(Links);
    }
    AjaxRequest(URLMessages + "?cmm=" + CommunityId + "&tid=" + GMGetValue("Chat" + CommunityId) + "&na=2&", GetMessages);
}
// #endregion

// #region QUICK REPLY
/// <summary>
/// Check if community accepts quickreply
/// </summary>
function IsQuickReply()
{
    return (((GMGetValue(("QuickReply" + CommunityId))) != "") ? 1 : 0);
}

/// <summary>
/// Prompt text and post
/// </summary>
/// <Param name="Tid">Topic ID, default page's tid</Param>
function QuickReply(Tid)
{
    var Header = IsQuickReply() ? TextAreaTextHtmlBegin : TextAreaTextBegin;
    var Footer = IsQuickReply() ? TextAreaTextHtmlEnd : TextAreaTextEnd;
    var Sig = IsQuickReply() ? SignatureHtml : Signature;
    
    if (!Tid) Tid = CommunityTopicId;
    
    window.addEventListener("keydown",
        function (e)
        {
            if (e.shiftKey && e.keyCode == 13)
            {
                var Area = document.getElementById("TextBoxQReply");
                var Text;
                if (!Area) return;
                Text = Area.value;
                if (Text.replace(/\s|\n|\r/g, "") == "") return;
                Text = encodeURIComponent(Header + Text + Footer + Sig);
                var Frm = document.forms[1];
                Frm.action = "/CommMsgPost?cmm=" + CommunityId + "&tid=" + Tid + "&bodyText=" + Text + "&Action.submit";
                Area.value = "";
                Frm.submit();
            }
        }, false);
    
    var Input = InputBoxCreate("QReply", "Quick Reply",
        "<textarea id='TextBoxQReply' style='width:100%'></textarea>" +
        "<br />" +
        "<div style='float: right'>" +
        "<a id='QReplySend' href='javascript:;' " +
        "onclick=\"" +
        "var Text = '" + encodeURIComponent(Header) + "' + encodeURIComponent(document.getElementById('TextBoxQReply').value) + '" + encodeURIComponent(Footer) + encodeURIComponent(Sig) + "';" +
        " document.getElementById('TextBoxQReply').value = ''; " +
        "var Frm = document.forms[1];" +
        "Frm.action = '/CommMsgPost?cmm=" + CommunityId + "&tid=" + Tid + "&bodyText=' + Text + '&Action.submit';" +
        "Frm.submit();" +
        "\"" +
        ">Send (Shift+Enter)</a>" +
        "&nbsp;&nbsp;&nbsp;" +
        "<a href='javascript:;' onclick=\"document.getElementById('QReply').style.display = 'none'; document.getElementById('OMLayer').style.display = 'none';\">Cancel</a>" +
        "</div>"
        );
    if (Input)
        document.body.appendChild(Input);
    
    LayerShow();
    ElementShow("QReply", window.mouseX - 100, window.mouseY - 50);
    document.getElementById("TextBoxQReply").focus();
}
function QuickReplyThis(Id)
{
    if (!Id) Id = "QTextboxReply";
    var Area = document.getElementById(Id);
    var Text;
    if (!Area) return;
    Text = Area.value;
    if (Text.replace(/\s|\n|\r/g, "") == "") return;
    Text = encodeURIComponent(Text);
    var Frm = document.forms[1];
    Frm.action = "/CommMsgPost?cmm=" + CommunityId + "&tid=" + CommunityTopicId + "&bodyText=" + Text + "&Action.submit";
    Area.value = "";
    Frm.submit();
}
function QuickReplyShow()
{
    var div = document.getElementById("Footage").getElementsByTagName("div")[0];
    if (div.style.display == "none")
    {
        div.style.display = "";
        try
        {
            div.getElementsByTagName("textarea")[0].selectionStart =
                div.getElementsByTagName("textarea")[0].selectionEnd = TextAreaTextBegin.length;
            div.getElementsByTagName("textarea")[0].focus();
        }
        catch (e) {}
    }
    else
        div.style.display = "none";
}
// #endregion // Quick Reply

// #region TOOLBAR
function ToolbarCreate(Id, IsFrame, Mode)
{
    if (!Id) Id = "messageBody";

    var ContainerToolbar = document.getElementById(Id);
    if (!ContainerToolbar)
        ContainerToolbar = document.getElementById("orkutFrame").contentDocument.getElementById('messageBody');
    if (ContainerToolbar)
    {
        ContainerToolbar.style.width = "100%";
        ContainerToolbar = ContainerToolbar.parentNode;
        ContainerToolbar.style.width = "99%";
        
        var items = "";
        var mode;
        if (Mode == 1 || Mode == 2)
            mode = Mode;
        else
            mode = (IsHtmlEnabled(IsFrame) ? 1 : 2);
        for (i = 0; i < Tools.length; ++i)
        {
            var ToolAuto = true;
            if (Tools[i][mode].length == 0) continue;
            if (Tools[i].length > 3)
            {
                ToolAuto = (Tools[i][3] == "true");
            }
            items += "<span style='vertical-align:middle;' ";
            if (ToolAuto)
                items +=
                    "onclick=\"";
                    items += "var post = document.getElementById('" + Id + "'); ";
                    items += "var psel = post.value.substr((post.selectionStart), (post.selectionEnd - post.selectionStart));"+
                    "post.value = post.value.substr(0, post.selectionStart) + '" +
                    Tools[i][mode] +
                    "' + post.value.substr(post.selectionEnd);" +
                    "var focus = post.value.lastIndexOf('{|}');" +
                    "post.value = post.value.replace('{|}', psel);" + 
                    "post.selectionStart = focus; post.selectionEnd = focus + psel.length;" +
                    "post.focus(); \"";
            items += ">" +
                Tools[i][0] +
                "</span>" +
                " <span style='border-left: 1px solid silver; padding-top: 0px;'>&nbsp;</span>";
        }
        var Sep = document.createElement("div");
        Sep.style.lineHeight = "5px";
        var Bar = document.createElement("div");
        Bar.id = "kToolBar";
        Bar.style.border = "1px solid silver";
        Bar.style.padding = "2px 2px 2px 2px";
        Bar.style.backgroundColor = ToolbarBackgroundColor;
        Bar.innerHTML = items;
        ContainerToolbar.insertBefore(Bar, ContainerToolbar.firstChild);
        ContainerToolbar.insertBefore(Sep, ContainerToolbar.firstChild);
    }
}
// #endregion

// #region Header Menu Items
function HeaderMenuGetContainer()
{
    var Container;
    var Uls = document.getElementById("headerin").getElementsByTagName("ul");
    for (i in Uls)
    {
        var Ul = Uls[i];
        if (Ul.className == "menu")
        {
            Container = Ul;
            break;
        }
    }
    return Container;
}

function HeaderMenuMain()
{
    var Container = HeaderMenuGetContainer();
    var MenuButton = Container.getElementsByTagName("li")[0].getElementsByTagName("a")[0];
    MenuButton.href = "javascript:;";

    MenuButton.addEventListener("click",
        function ()
        {
            var Menu = document.getElementById("OMMenu");
            if (Menu.style.display == "none")
            {
                Menu.style.display = "";
            }
            else
            {
                Menu.style.display = "none";
            }
        }, false);
    
    var Menu = document.createElement("div");
    Menu.id = "OMMenu";
    Menu.style.backgroundColor = "#F43009";
    Menu.style.border = "2px solid white";
    Menu.style.color = "white";
    Menu.style.padding = "5px";
    Menu.style.overflow = "hidden";
    
    Menu.style.display = "none";
    Menu.style.position = "absolute";
    Menu.style.top = "30px";
    Menu.style.zIndex = "500";
    Menu.style.width = "200px";
    document.getElementById("container").appendChild(Menu);
}

function HeaderMenuMainNew(Link, Text)
{
    var Menu = document.getElementById("OMMenu");
    var Item = document.createElement("a");
    if (Text)
    {
        Item.style.color = "white";
        Item.style.fontSize = "11px";
        Item.href = Link;
        Text = (IsPage(Link.replace("Main#", "")) ? "<b>" + Text + "</b>" : Text);
        Item.innerHTML = "- " + Text;
        Menu.appendChild(Item);
        Menu.appendChild(document.createElement("br"));
    }
    else
    {
        var Sep = document.createElement("div");
        Sep.style.borderTop = "1px solid #DEEFFF";
        Sep.style.margin = "5px 2px 5px 2px";
        Sep.style.fontSize = "0px";
        Sep.innerHTML = "&nbsp;";
        Menu.appendChild(Sep);
    }
}

function HeaderMenuNew(Link, Text, FontSize)
{
    var Container = HeaderMenuGetContainer();
    var ContainerItem = document.createElement("li");
    var Item = document.createElement("a");
    if (FontSize) Item.style.fontSize = FontSize;
    Item.href = Link;
    Text = (IsPage(Link.replace("Main#", "")) ? "<b>" + Text + "</b>" : Text);
    Item.innerHTML = Text;
    
    ContainerItem.appendChild(Item);
    ContainerItem.appendChild(document.createTextNode("\u00a0|\u00a0"));
    Container.appendChild(ContainerItem);
}

function HeaderMenuClear()
{
    var Container = HeaderMenuGetContainer();
    var Lis = Container.getElementsByTagName("li");
    for (i = 1; i < Lis.length; ++i)
    {
        var Li = Lis[i];
        Li.style.display = "none";
    }
}

function HeaderMenuFix()
{
    var Container = HeaderMenuGetContainer();
    var Lis = Container.getElementsByTagName("li");
    for (i = 1; i < Lis.length; ++i)
    {
        var Li = Lis[i];
        var Link = Li.getElementsByTagName("a")[0];
        var Fix = Link.innerHTML.replace(/P.gina de (.*?)/i, "$1");
        Link.innerHTML = StringUpperFirst(Fix);
        
        if (Link.href.match(/Scrapbook/i))
            Link.href = Link.href.replace("Main#", "");
            
        if (i == (Lis.length - 1))
        {
            Li.appendChild(document.createTextNode("\u00a0|\u00a0"));
        }
    }
}
// #endregion

// #region TOOLTIP
function TooltipCreate(Id, Text)
{
    var Tooltip = document.getElementById(Id);
    if (Tooltip) return;
    Tooltip = document.createElement("div");
    Tooltip.id = Id;
    Tooltip.innerHTML = Text;
    
    // Style
    Tooltip.style.backgroundColor = "#F43009";
    Tooltip.style.border = "1px solid #FFCF63";
    
    // Position
    Tooltip.style.position = "absolute";
    Tooltip.style.zIndex = "10000";
}
// #endregion

function ElementShow(Id, X, Y)
{
    var Element = document.getElementById(Id);
    Element.style.display = "";
    Element.style.left = X;
    Element.style.top = Y;
}
function ElementHide(Id)
{
    var Element = document.getElementById(Id);
    Element.style.display = "none";
}
function ElementHideFade(Id)
{
    var Element = document.getElementById(Id);
    if (Element.style.opacity == "") Element.style.opacity = "1";
    setTimeout("function a() { var el = document.getElementById('" + Id + "'); if (el.style.opacity > 0.03) { el.style.opacity = el.style.opacity - 0.02; setTimeout('a()', 150); } else { el.style.display = 'none'; } } a();", 1000);
}

// #region BOX
function InputBoxCreate(Id, Title, Content, Width, Height)
{
    var ContainerPanel = document.createElement("div");
    ContainerPanel.id = Id;
    ContainerPanel.style.width = Width ? Width : "300px";
    ContainerPanel.style.height = Height ? Height : "100px";
    ContainerPanel.style.zIndex = "10001";
    ContainerPanel.style.position = "absolute";
    ContainerPanel.style.display = "none";
    var Table = document.createElement("table");
    Table.className = "module";
    Table.style.width = "100%";
    Table.style.height= "100%";
    Table.cellSpacing = "0";
    Table.cellPadding = "0";
    
    // Header
    var ContainerInputTopRow = document.createElement("tr");
    var ContainerInputBorderTopLeft = document.createElement("td");
    var ContainerInputBorderTopRight = document.createElement("td");
    
    ContainerInputTopRow.style.height = "14px";
    ContainerInputBorderTopLeft.style.width = "99%";
    ContainerInputBorderTopRight.style.width= "8px";
    ContainerInputBorderTopLeft.style.margin = "5px 0 6px 10px";
    ContainerInputBorderTopLeft.style.lineHeight = "21px";
    ContainerInputBorderTopLeft.style.fontSize = "10px";
    ContainerInputBorderTopLeft.style.textAlign = "center";
    ContainerInputBorderTopLeft.className = "topl_g";
    ContainerInputBorderTopRight.className = "topr_g";
    ContainerInputBorderTopLeft.style.backgroundRepeat = "no-repeat";
    ContainerInputBorderTopRight.style.backgroundRepeat = "no-repeat";
    
    if (Title != "")
        Title = "<h2>" + Title + "</h2>";
    ContainerInputBorderTopLeft.innerHTML = Title;
    var Close = document.createElement("div");
    Close.style.cssFloat = "right";
    Close.style.position = "absolute";
    Close.style.top = "0";
    Close.style.right = "15";
    Close.style.fontSize = "11px";
    Close.style.color = "red";
    Close.style.cursor = "pointer";
    Close.innerHTML = " x ";
    Close.addEventListener("click",
        function ()
        {
            document.getElementById(Id).style.display = "none";
            try
            {
                document.getElementById("OMLayer").style.display = "none";
            }
            catch (ex) {}
        }, false);
    
    ContainerInputBorderTopLeft.appendChild(Close);
    
    ContainerInputTopRow.appendChild(ContainerInputBorderTopLeft);
    ContainerInputTopRow.appendChild(ContainerInputBorderTopRight);
    Table.appendChild(ContainerInputTopRow);
    
    // Content
    var ContainerInputRow = document.createElement("tr");
    var ContainerInputLeft = document.createElement("td");
    var ContainerInputRight = document.createElement("td");
    ContainerInputLeft.className = "boxmidlrg";
    ContainerInputRight.className = "boxmidr";
    ContainerInputLeft.style.paddingBottom = "5px";
    ContainerInputLeft.style.verticalAlign = "top";
    
    ContainerInputLeft.innerHTML = Content;
    
    ContainerInputRow.appendChild(ContainerInputLeft);
    ContainerInputRow.appendChild(ContainerInputRight);
    Table.appendChild(ContainerInputRow);
    
    // Footer
    var ContainerInputBottomRow = document.createElement("tr");
    var ContainerInputBorderBottomLeft = document.createElement("td");
    var ContainerInputBorderBottomRight = document.createElement("td");
    ContainerInputBorderBottomLeft.className = "botl";
    ContainerInputBorderBottomRight.className = "botr";
    ContainerInputBorderBottomLeft.style.backgroundRepeat = "no-repeat";
    ContainerInputBorderBottomRight.style.backgroundRepeat = "no-repeat";
    
    ContainerInputBottomRow.appendChild(ContainerInputBorderBottomLeft);
    ContainerInputBottomRow.appendChild(ContainerInputBorderBottomRight);
    Table.appendChild(ContainerInputBottomRow);
    
    ContainerPanel.appendChild(Table);
    
    return ContainerPanel;
}
// #endregion

// #region User Menu
function UserMenuCreate(Index, Uid, Width, Height)
{
    if (!Width) Width = 180;
    if (!Height) Height = 100;
    var Return = InputBoxCreate("UserMenu" + Index, "User Menu",
        "<div style='font-size: 11px'>" +
        "<a href='/Main#Profile?uid=" + Uid + "'><img alt='' src='http://static4.orkut.com/img/castro/p_profile.gif' /> " + LanguageGetUserMenuProfile() + "</a>" +
        "<br />" +
        "<a href='/Scrapbook?uid=" + Uid + "'><img alt='' src='http://static1.orkut.com/img/castro/p_scrap.gif' /> " + LanguageGetUserMenuScrapbook() + "</a>" +
        "<br />" +
        "<a href='/Main#AlbumList?uid=" + Uid + "'><img alt='' src='http://static4.orkut.com/img/castro/p_camera.gif' /> " + LanguageGetUserMenuAlbum() + "</a>" +
        "<br />" +
        "<a href='/Main#FavoriteVideos?uid=" + Uid + "'><img alt='' src='http://static3.orkut.com/img/castro/p_video.gif' /> " + LanguageGetUserMenuVideos() + "</a>" +
        "<br />" +
        "<a href='/Main#FriendAdd?uid=" + Uid + "'><img alt='' src='/img/castro/i_friend.png' /> " + LanguageGetUserMenuAddFriend() + "</a>" +
        "<br />" +
        "<a href='/Main#ProfileC?uid=" + Uid + "'><img alt='' src='http://img1.orkut.com/img/castro/i_comment.png' /> " + LanguageGetUserMenuCommunity() + "</a>" +
        "<br />" +
        "<a href='/Main#Compose?uid=" + Uid + "'><img alt='' src='http://img2.orkut.com/img/castro/p_letter.gif' /> " + LanguageGetUserMenuSendMessage() + "</a>" +
        "<br />" +
        "<a href='/Main#AppInfo?appId=364639177670&uid=" + Uid + "'><img alt='' src='http://static4.orkut.com/img/castro/p_app.gif' /> " + LanguageGetUserMenuScrapAll() + "</a>" +
        "<br />" +
        "<a href='/Main#AppInfo?appId=505516740623&uid=" + Uid + "'><img alt='' src='http://static4.orkut.com/img/castro/p_app.gif' /> " + LanguageGetUserMenuMeriSlambook() + "</a>" +
        "<br />" +
        "</div>",
        Width, Height);
    return Return;
}
// #endregion

// #region LAYERS
window.addEventListener("keydown",
    function (e)
    {
        if (e.keyCode == 27) // ESC
        {
            var Divs = document.getElementsByTagName("div");
            for (i in Divs)
            {
                var Div = Divs[i];
                if (Div.style.zIndex > 9999)
                    Div.style.display = "none";
            }
        }
    }, false);
function LayerShow(Opacity)
{
    var Layer = document.getElementById("OMLayer");
    if (!Layer)
    {
        if (!Opacity) Opacity = "0.7";
        Layer = document.createElement("div");
        Layer.innerHTML = "&nbsp;";
        Layer.id = "OMLayer";
        Layer.style.zIndex = "10000";
        Layer.style.opacity = Opacity;
        Layer.style.position = "fixed";
        Layer.style.top = "0";
        Layer.style.left = "0";
        Layer.style.width = "100%";
        Layer.style.height = "100%";
        Layer.style.backgroundColor = "black";
        document.body.appendChild(Layer);
    }
    else
    {
        Layer.style.opacity = Opacity;
        Layer.style.display = "";
    }
}
// #endregion

function OrkutLinksFix(Links)
{
    for (i in Links)
    {
        var Link = Links[i];
        var l = Link.getAttribute("onclick");
        if (l && l.match(/_linkInterstitial/i))
        {
            l = l.match(/\'([^\']*)\'/)[1];
            l = l.replace(/\\0?74wbr\\0?76/g, "");
            l = l.replace(/\\0?75/g, "=").replace(/\\0?46/g, "&").replace(/\\76/g, "+");
            Link.setAttribute("onclick", "");
            Link.href = l;
        }
    }
}

//////
// #region Request page updates
// Name-Id
function RequestBookmarkButton(Id)
{
    if (!GMGetValue("Bookmarks")) GMSetValue("Bookmarks", "");
    var IsBookmark = GMGetValue("Bookmarks").indexOf(Id + "]") != -1 ? true : false;
    var ImageBookmark = IsBookmark ? ImageBookmarkOn : ImageBookmarkOff;
    var EImageBookmark = document.createElement("img");
    EImageBookmark.align = "left";
    EImageBookmark.alt = "bk";
    EImageBookmark.src = ImageBookmark;
    EImageBookmark.style.cursor = "pointer";

    return EImageBookmark;
}
function RequestForumButton(Id)
{
    var Url = "/Main#CommTopics?cmm=" + Id;
    var ForumDiv = document.createElement("div");
    var Link = document.createElement("a");
    Link.style.cssFloat = "right";
    Link.style.fontSize = "10px";
    Link.href = Url;
    Link.innerHTML = "(" + LanguageGetButtonForum().toLowerCase() + ")";
    ForumDiv.style.cssFloat = "right";
    ForumDiv.style.fontSize = "10px";
    ForumDiv.appendChild(Link);
    
    return ForumDiv;
}
function RequestCmmListBookmarkAddEventListener(Length)
{
    for (i = 1; i < Length; ++i)
    {
        var Img = document.getElementById("Bookmark" + i);
        Img.addEventListener("click", BookmarkSet(), false);
    }
}
function BookmarkSet()
{
    return function ()
        {
            var El = this.parentNode.getElementsByTagName("a");
            El = (El.length >= 2) ? El[1] : El[0];
            var Id = El.href.match(/cmm=([^&]+|[^$]+)/i)[1];
            var Name = El;
            Name = Name.innerHTML.replace(/\n|<.*?>/g, "");
            var IsBookmark = GMGetValue("Bookmarks").indexOf(Id + "]") != -1 ? true : false;
            var ImageBookmark = IsBookmark ? ImageBookmarkOn : ImageBookmarkOff;
            
            if (this.src == ImageBookmarkOn)
            {
                var Values = GMGetValue("Bookmarks") || "";
                Values = Values.replace("[" + escape(Name) + "|" + (Id) + "]", "");
                GMSetValue("Bookmarks", Values);
                this.src = ImageBookmarkOff;
            }
            else
            {
                var Values = GMGetValue("Bookmarks") || "";
                GMSetValue("Bookmarks", Values + "[" + escape(Name) + "|" + (Id) + "]");
                this.src = ImageBookmarkOn;
            }
        };
}

// CmmName-Cmm-Name-Tid
function RequestBookmarkTopicButton(Id, Tid)
{
    if (!GMGetValue("BookmarksTopic")) GMSetValue("BookmarksTopic", "");
    var IsBookmark = GMGetValue("BookmarksTopic").indexOf(Tid + "]") != -1 ? true : false;
    var ImageBookmark = IsBookmark ? ImageBookmarkOn : ImageBookmarkOff;
    var EImageBookmark = document.createElement("img");
    EImageBookmark.align = "left";
    EImageBookmark.alt = "bk";
    EImageBookmark.src = ImageBookmark;
    EImageBookmark.style.cursor = "pointer";

    return EImageBookmark;
}
function RequestLastButton(Id, Tid)
{
    var Url = "/Main#CommMsgs?cmm=" + Id + "&tid=" + Tid + "&na=2&Scroll=-1";
    var ForumDiv = document.createElement("div");
    var Link = document.createElement("a");
    Link.style.cssFloat = "right";
    Link.style.fontSize = "10px";
    Link.href = Url;
    Link.innerHTML = "(" + LanguageGetButtonLast().toLowerCase() + ")";
    ForumDiv.style.fontSize = "10px";
    ForumDiv.style.cssFloat = "right";
    ForumDiv.appendChild(Link);
    
    return ForumDiv;
}
function RequestTopicListBookmarkAddEventListener(Length)
{
    for (i = 1; i < Length; ++i)
    {
        var Img = document.getElementById("Bookmark" + i);
        Img.addEventListener("click", BookmarkSetTopic(), false);
    }
}
function BookmarkSetTopic()
{
    return function ()
        {
            var CmmName;
            if (!IsPage("Communities"))
            {
                CmmName = document.getElementById("lbox").getElementsByTagName("a")[1];
                CmmName = CmmName.innerHTML.replace(/<.*?>/ig, "");
            }
            else
            {
                var sel = document.getElementById("OMCmmTopicSelect");
                CmmName = sel.options[sel.selectedIndex].innerHTML;
            }
            var Id = this.parentNode.getElementsByTagName("a")[1].href.match(/cmm=([^&]+|[^$]+)/i)[1];
            var Tid= this.parentNode.getElementsByTagName("a")[1].href.match(/tid=([^&]+|[^$]+)/i)[1];
            var Name = this.parentNode.getElementsByTagName("a")[1];
            Name = Name.innerHTML.replace(/\n|<.*?>/g, "");
            var IsBookmark = GMGetValue("BookmarksTopic").indexOf(Tid + "]") != -1 ? true : false;
            var ImageBookmark = IsBookmark ? ImageBookmarkOn : ImageBookmarkOff;

            if (this.src == ImageBookmarkOn)
            {
                var Values = GMGetValue("BookmarksTopic") || "";
                Values = Values.replace("[" + escape(CmmName) + "|" + Id + "|" + escape(Name) + "|" + Tid + "]", "");
                GMSetValue("BookmarksTopic", Values);
                this.src = ImageBookmarkOff;
            }
            else
            {
                var Values = GMGetValue("BookmarksTopic") || "";
                GMSetValue("BookmarksTopic", Values + "[" + escape(CmmName) + "|" + Id + "|" + escape(Name) + "|" + Tid + "]");
                this.src = ImageBookmarkOn;
            }
        };
}


function CommunityBookmarkButtonCreate()
{
    if (window.location.href.match(/cmm=([0-9]+)/))
    {
        var Container = document.getElementById("lbox").getElementsByTagName("a")[1];
        Container.parentNode.insertBefore(RequestBookmarkButton(CommunityId), Container.parentNode.firstChild);
        Container.parentNode.firstChild.addEventListener("click", BookmarkSet(), false);
    }
}

// #endregion
//////

// Cmms
try
{
    var CmmTopMainfix = true;
    if (IsPage(URLCmm))
    {
        var Container = document.getElementById("divBody0");
        var Cmm = document.createElement("div");
        Cmm.className = "listlight";
        Cmm.innerHTML = "<img alt='bk' align='left' src='" + ImageBookmarkOn + "' />" + "<a href='/Community?cmm=43558952'>Orkut Underground - OUร‚ยญG 13</a> ---> <b><a href='http://www.w4rz.org'>Orkut Underground</a></b>";
        Container.insertBefore(Cmm, Container.firstChild);
        Cmm = document.createElement("div");
        Cmm.className = "listdark";
        Cmm.innerHTML = "<img alt='bk' align='left' src='" + ImageBookmarkOn + "' />" + "<a href='/Community?cmm=49931298'><b>Kolkata Knight Riders</b></a>";
        Container.insertBefore(Cmm, Container.firstChild);
    }
}
catch (ex) {}

// #region TABS
function BookmarkCommunityListCreate()
{
    var Communities = GMGetValue("Bookmarks").split("][");
    Communities = ArrayRemoveNullValues(Communities);
    Communities.sort();
    var Table = document.createElement("table");
    Table.className = "displaytable";
    Table.cellspacing = "0";

    var Color = true;
    for (i in Communities)
    {
        var Cmm = Communities[i];
        Cmm = Cmm.replace(/\[|\]/g, "");
        var CmmName = unescape(Cmm.split("|")[0]);
        var CmmId   = Cmm.split("|")[1];
        var Tr = document.createElement("tr");
        Tr.className = Color ? "listlight" : "listdark";
        var TdName = document.createElement("td");
        TdName.style.overflow = "hidden";
        var Link = document.createElement("a");
        Link.href = URLCmmMain + "?cmm=" + CmmId;
        Link.innerHTML = CmmName;
        
        var BookmarkButton = RequestBookmarkButton(CmmId);
        BookmarkButton.addEventListener("click", BookmarkSet(), false);
        TdName.appendChild(RequestForumButton(CmmId));
        TdName.appendChild(BookmarkButton);
        TdName.appendChild(Link);
        Tr.appendChild(TdName);
        Table.appendChild(Tr);
        
        Color = !Color;
    }

    return Table;
}
function BookmarkTopicListCreate()
{
    var Topics = GMGetValue("BookmarksTopic").split("][");
    Topics = ArrayRemoveNullValues(Topics);
    Topics.sort();
    var Table = document.createElement("table");
    Table.className = "displaytable";
    Table.cellspacing = "0";
    Table.id = "OMTopicList";

    return Table;
}
function BookmarkTopicListUpdate(CommunityId)
{
    var Topics = GMGetValue("BookmarksTopic").split("][");
    Topics = ArrayRemoveNullValues(Topics);
    Topics.sort();
    
    var Table = document.getElementById("OMTopicList");
    Table.innerHTML = "";
    
    var Color = true;
    for (i in Topics)
    {
        var Topic = Topics[i];
        Topic = Topic.replace(/\[|\]/g, "");
        var CmmName = unescape(Topic.split("|")[0]);
        var CmmId   = Topic.split("|")[1];
        if (CmmId != CommunityId) continue;
        var TopicName = unescape(Topic.split("|")[2]);
        var TopicId   = Topic.split("|")[3];
        var Tr = document.createElement("tr");
        Tr.className = Color ? "listlight" : "listdark";
        var TdName = document.createElement("td");
        TdName.style.overflow = "hidden";
        var Link = document.createElement("a");
        Link.href = URLMessages + "?cmm=" + CmmId + "&tid=" + TopicId;
        Link.innerHTML = TopicName;
        
        var BookmarkButton = RequestBookmarkTopicButton(CmmId, TopicId);
        BookmarkButton.addEventListener("click", BookmarkSetTopic(), false);
        TdName.appendChild(RequestLastButton(CmmId, TopicId));
        TdName.appendChild(BookmarkButton);
        TdName.appendChild(Link);
        Tr.appendChild(TdName);
        Table.appendChild(Tr);
        
        Color = !Color;
    }
}
function BookmarkTopicListSelectorCreate()
{
    var Topics = GMGetValue("BookmarksTopic").split("][");
    Topics = ArrayRemoveNullValues(Topics);
    Topics.sort();

    var Control = document.createElement("select");
    Control.id = "OMCmmTopicSelect";
    Control.addEventListener("change",
        function ()
        {
            BookmarkTopicListUpdate(this.value);
        }, false);
    
    var CmmList = new Array();
    for (i = 0; i < Topics.length; ++i)
    {
        var Topic = Topics[i];
        var CmmName = unescape(Topic.split("|")[0]).replace(/\[|\]/g, "");
        var CmmId = Topic.split("|")[1];
        if (CmmList.indexOf(CmmId) == -1)
        {
            var Option = document.createElement("option");
            Option.value = CmmId;
            Option.innerHTML = CmmName;
            Control.appendChild(Option);
            CmmList.push(CmmId);
        }
    }
    
    return Control;
}
// #endregion

// #region CONFIGURATION
function ConfigurationSave(URLToSave, ShowMessage)
{
    var p = URLToSave;

    // Language
    var Val = "";
    Val = p.match(/Language=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("Language", Val);
    Language = GMGetValue("Language").toLowerCase() || "english";
    
    // TextArea
    Val = ""; Val = p.match(/TextAreaTextBegin=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("TextAreaTextBegin", Val);
    Val = ""; Val = p.match(/TextAreaTextEnd=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("TextAreaTextEnd", Val);
    Val = ""; Val = p.match(/TextAreaTextHtmlBegin=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("TextAreaTextHtmlBegin", Val);
    Val = ""; Val = p.match(/TextAreaTextHtmlEnd=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("TextAreaTextHtmlEnd", Val);
    Val = ""; Val = p.match(/TextAreaScrapTextBegin=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("TextAreaScrapTextBegin", Val);
    Val = ""; Val = p.match(/TextAreaScrapTextEnd=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("TextAreaScrapTextEnd", Val);
    
    // Quote
    Val = ""; Val = p.match(/QuoteHeaderText=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteHeaderText", Val);
    Val = ""; Val = p.match(/QuoteBegin=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteBegin", Val);
    Val = ""; Val = p.match(/QuoteEnd=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteEnd", Val);
    Val = ""; Val = p.match(/QuoteHeaderBegin=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteHeaderBegin", Val);
    Val = ""; Val = p.match(/QuoteHeaderEnd=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteHeaderEnd", Val);
    Val = ""; Val = p.match(/QuoteHtmlBegin=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteHtmlBegin", Val);
    Val = ""; Val = p.match(/QuoteHtmlEnd=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteHtmlEnd", Val);
    Val = ""; Val = p.match(/QuoteHeaderHtmlBegin=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteHeaderHtmlBegin", Val);
    Val = ""; Val = p.match(/QuoteHeaderHtmlEnd=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("QuoteHeaderHtmlEnd", Val);
    
    // Signature
    Val = ""; Val = p.match(/Signature=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("Signature", Val);
    Val = ""; Val = p.match(/SignatureHtml=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("SignatureHtml", Val);
    Val = ""; Val = p.match(/SignatureScrap=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("SignatureScrap", Val);
    
    // Moderation
    Val = ""; Val = p.match(/ModerationText=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("ModerationText", Val);
    Val = ""; Val = p.match(/ModerationHtmlText=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("ModerationHtmlText", Val);
    Val = ""; Val = p.match(/ModerationMemberText=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("ModerationMemberText", Val);
    Val = ""; Val = p.match(/ModerationMemberHtmlText=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("ModerationMemberHtmlText", Val);

    // Update Settings
    Val = ""; Val = p.match(/UpdateWarningType=([^&]*|[^$]*)/i); if (Val) Val = unescape(Val[1]); else Val = "";
    GMSetValue("UpdateWarningType", Val);
    
    if (ShowMessage)
        alert(LanguageGetConfigurationSaveSuccess());
    
    return true;
}
function ConfigurationMenuSave(URLToSave, ShowMessage)
{
    // Header Menus
    var Menus = URLToSave.match(/([^$]+)\&\&/i);
    if (!Menus)
    {
        GMSetValue("HeaderMenu", "");
    }
    else
    {
        Menus = Menus[1];
        Menus = Menus.split("?");
        var AddMenu = "";
        for (i in Menus)
        {
            var Menu = Menus[i];
            AddMenu += "[" + unescape((Menu.split("&"))[0]) + "|" + unescape((Menu.split("&"))[1]) + "]";
        }
        GMSetValue("HeaderMenu", AddMenu);
    }
    
    // Dowpdown Menu
    var Menus = URLToSave.match(/\&\&([^$]+)/i);
    if (!Menus)
    {
        GMSetValue("DropdownMenu", "");
    }
    else
    {
        Menus = Menus[1];
        Menus = Menus.split("?");
        var AddMenu = "";
        for (i in Menus)
        {
            var Menu = Menus[i];
            AddMenu += "[" + unescape((Menu.split("&"))[0]) + "|" + unescape((Menu.split("&"))[1]) + "]";
        }
        GMSetValue("DropdownMenu", AddMenu);
    }
    
    if (ShowMessage)
        alert(LanguageGetConfigurationSaveSuccess());
        
    return true;
}
// #endregion
// #endregion // SCRIPT FUNCTIONS

// #region ========== OTHER ==========
try /** Home Video Gadget button **/
{
    if (IsPage("Home"))
    {
        var Container = GetElementsByClassName("div", "userratings");
        Container = Container[0];
        
        var Ins = Container.getElementsByTagName("a");
        Ins = Ins[3];
        var Videos = GetProfileGadgetsButton("videos", "/Main#FavoriteVideos");
        
        Container.insertBefore(Videos, Ins);
        Container = null;
        Videos = null;
        Ins = null;
    }
}
catch (ex) { }
try /** Scroll after Reply **/
{
    var Scroll = GetParam("Scroll");
    if (Scroll != false)
    {
        window.addEventListener("load",
            function ()
            {
                var Win = document.getElementById("orkutFrame");
                if (!Win) Win = this.parent.document.getElementById("orkutFrame");
                if (!Win) return;
                Win = Win.contentWindow;
                if (Scroll == -1) Scroll = Win.scrollMaxY;
                Win.scrollBy(0, Scroll);
                Win = null;
            }, 100);
    }
}
catch (ex) { }
try /** Last page after Reply **/
{
    if (GetParam("na") == "4" && GetParam("nid") == false)
    {
        var ControlNavigation = document.getElementById("mboxfull");
        if (!ControlNavigation) return;
        ControlNavigation = ControlNavigation.getElementsByTagName("table")[0];
        ControlNavigation = ControlNavigation.getElementsByTagName("tr")[1];
        ControlNavigation = ControlNavigation.getElementsByTagName("span")[0];

        var Links = ControlNavigation.getElementsByTagName("a");
        
        if (Links.length >= 2)
            window.location.href = URLRoot + "CommMsgs?cmm=" + CommunityId + "&tid=" + CommunityTopicId + "&na=2&Scroll=-1";
        else
        {
            if (GetParam("Scroll") == false)
            {
                window.location.href += "&Scroll=-1";
            }
        }
        ControlNavigation = null;
    }
}
catch (ex) { }
// #endregion

// #region ========== SHORTCUTS ==========
try
{
    var Shortcut =
        function (e)
        {
            /** Global **/
            // Scrap
            if (e.keyCode == KeyS && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLScrap + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Profile
            if (e.keyCode == KeyH && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLHome + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Message
            if (e.keyCode == KeyM && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLOwnMessages + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Settings
            if (e.keyCode == KeyX && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLSettings + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Videos
            if (e.keyCode == KeyV && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLVideos + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Testimonials
            if (e.keyCode == KeyT && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLTestimonials + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Events
            if (e.keyCode == KeyE && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLEvents + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Spam
            if (e.keyCode == KeyO && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLSpam + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Updates
            if (e.keyCode == KeyU && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLUpdates + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Lists
            if (e.keyCode == KeyL && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLLists + "?cache=" + ((new Date()).getTime());
                return;
            }
            // AlbumLists
            if (e.keyCode == KeyA && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLAlbumList + "?cache=" + ((new Date()).getTime());
                return;
            }
            // OMConfig
            if (e.keyCode == KeyQ && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLOMConfig + "?cache=" + ((new Date()).getTime());
                return;
            }
            // OMConfigMenu
            if (e.keyCode == KeyM && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLOMConfigMenu + "?cache=" + ((new Date()).getTime());
                return;
            }
            // OMHelp
            if (e.keyCode == KeyH && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLOMHelp + "?cache=" + ((new Date()).getTime());
                return;
            }
            // My Application List
            if (e.keyCode == KeyP && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLMyApp + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Application Directory
            if (e.keyCode == KeyD && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLAppDir + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Promote
            if (e.keyCode == KeyG && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLPromote + "?cache=" + ((new Date()).getTime());
                return;
            }
            // Communities
            if (e.keyCode == KeyC && e.shiftKey && e.ctrlKey)
            {
                window.location.href = URLCmm + "?cache=" + ((new Date()).getTime());
                return;
            }
            
            /** Communities **/
            if (IsPage(URLCmm))
            {
                if (!e.altKey) return;
                var Trs = document.getElementById("subPage0");
                Trs = Trs.getElementsByTagName("table")[0];
                Trs = Trs.getElementsByTagName("tr");
                
                var Url = new Array();
                for (i = 0; i < 10; ++i)
                {
                    Url[i] = "javascript:;";
                }
                var i = 0;
                for (var index in Trs)
                {
                    var Tr = Trs[index];
                    var a = Tr.getElementsByTagName("a");
                    if (a.length >= 2) a = a[1];
                    else continue;
                    Url[i] = a.href.replace("/Main#", "/");
                    ++i;
                    if (i >= 10) break;
                }
                switch (e.keyCode)
                {
                    case Key1:
                        window.location.href = Url[0];
                        return;
                    case Key2:
                        window.location.href = Url[1];
                        return;
                    case Key3:
                        window.location.href = Url[2];
                        return;
                    case Key4:
                        window.location.href = Url[3];
                        return;
                    case Key5:
                        window.location.href = Url[4];
                        return;
                    case Key6:
                        window.location.href = Url[5];
                        return;
                    case Key7:
                        window.location.href = Url[6];
                        return;
                    case Key8:
                        window.location.href = Url[7];
                        return;
                    case Key9:
                        window.location.href = Url[8];
                        return;
                    case Key0:
                        window.location.href = Url[9];
                        return;
                }
            }
            
            /** Main topics **/
            if (IsPage(URLCmmMain))
            {
                if (!e.altKey) return;
                var TbIndex = document.getElementById("news-bar") ? 3 : 2;
                var Tb = document.getElementById("mbox");
                Tb = (Tb.getElementsByTagName("table")[TbIndex]).getElementsByTagName("table")[0];
                var Trs = Tb.getElementsByTagName("tr");
                
                var Url = new Array();
                for (i = 0; i < 10; ++i)
                {
                    Url[i] = "javascript:;";
                }
                var i = 0;
                for (var index in Trs)
                {
                    var Tr = Trs[index];
                    var a = Tr.getElementsByTagName("a");
                    if (a.length >= 2) a = a[1];
                    else continue;
                    Url[i] = a.href.replace("/Main#", "/");
                    ++i;
                    if (i >= 10) break;
                }
                switch (e.keyCode)
                {
                    case Key1:
                        window.location.href = Url[0];
                        return;
                    case Key2:
                        window.location.href = Url[1];
                        return;
                    case Key3:
                        window.location.href = Url[2];
                        return;
                    case Key4:
                        window.location.href = Url[3];
                        return;
                    case Key5:
                        window.location.href = Url[4];
                        return;
                    case Key6:
                        window.location.href = Url[5];
                        return;
                    case Key7:
                        window.location.href = Url[6];
                        return;
                    case Key8:
                        window.location.href = Url[7];
                        return;
                    case Key9:
                        window.location.href = Url[8];
                        return;
                    case Key0:
                        window.location.href = Url[9];
                        return;
                }
            }
            
            /** Topics **/
            if (IsPage(URLCmmTopics))
            {
                if (!e.altKey) return;
                var Tb = document.getElementById("mboxfull");
                Tb = (Tb.getElementsByTagName("table")[0]).getElementsByTagName("table")[0];
                var Trs = Tb.getElementsByTagName("tr");
                
                var Url = new Array();
                for (i = 0; i < 10; ++i)
                {
                    Url[i] = "javascript:;";
                }
                var i = 0;
                for (var index in Trs)
                {
                    var Tr = Trs[index];
                    var a = Tr.getElementsByTagName("a");
                    if (a.length >= 2) a = a[1];
                    else continue;
                    Url[i] = a.href.replace("/Main#", "/");
                    ++i;
                    if (i >= 10) break;
                }
                switch (e.keyCode)
                {
                    case Key1:
                        window.location.href = Url[0];
                        return;
                    case Key2:
                        window.location.href = Url[1];
                        return;
                    case Key3:
                        window.location.href = Url[2];
                        return;
                    case Key4:
                        window.location.href = Url[3];
                        return;
                    case Key5:
                        window.location.href = Url[4];
                        return;
                    case Key6:
                        window.location.href = Url[5];
                        return;
                    case Key7:
                        window.location.href = Url[6];
                        return;
                    case Key8:
                        window.location.href = Url[7];
                        return;
                    case Key9:
                        window.location.href = Url[8];
                        return;
                    case Key0:
                        window.location.href = Url[9];
                        return;
                }
            }
            
            /** Topic Navigate **/
            if (IsPage(URLMessages))
            {
                if (e.shiftKey) return;
                var ControlNavigation = document.getElementById("mboxfull");
                if (!ControlNavigation) return;
                ControlNavigation = ControlNavigation.getElementsByTagName("table")[0];
                ControlNavigation = ControlNavigation.getElementsByTagName("tr")[1];
                ControlNavigation = ControlNavigation.getElementsByTagName("span")[0];

                var NavFirst = "javascript:;";
                var NavPrev  = "javascript:;";
                var NavForw  = "javascript:;";
                var NavLast  = "javascript:;";
                
                var Links = ControlNavigation.getElementsByTagName("a");
                if (Links.length == 4)
                {
                    NavFirst = Links[0].href;
                    NavPrev = Links[1].href;
                    NavForw = Links[2].href;
                    NavLast = Links[3].href;
                }
                else if (ControlNavigation.firstChild.nextSibling.tagName.toLowerCase() != "span")
                {
                    NavFirst = Links[0].href;
                    NavPrev = Links[1].href;
                }
                else
                {
                    NavForw = Links[0].href;
                    NavLast = Links[1].href;
                }
                
                if (e.ctrlKey)
                {
                    switch (e.keyCode)
                    {
                        case KeyLeft:
                            window.location.href = NavPrev;
                            return;
                        case KeyRight:
                            window.location.href = NavForw;
                            return;
                        case KeyUp:
                            window.location.href = NavFirst;
                            return;
                        case KeyDown:
                            window.location.href = NavLast;
                            return;
                    }
                }
            }
        };
    window.addEventListener("keydown", Shortcut, false);
}
catch (ex) { }
// #endregion // Shortcuts

// #region ========== QUOTE ==========
// #region Topic and Replies - Page
try
{
    if (IsPage(URLMessages))
    {
        // #region Message Time
        /// <summary>
        /// QuoteATime is an Array with all times of the posts
        /// </summary>
        var QuoteATimes = document.getElementById("mboxfull").getElementsByTagName("div");
        var QuoteATime = new Array();
        c = 0;
        var Container = new Array(); //used for quote button
        for (i = 0; i < QuoteATimes.length; ++i)
        {
            var QuoteTime = QuoteATimes[i];
            if (QuoteTime.className == "rfdte" && QuoteTime.parentNode.className == "listitem")
            {
                var time = QuoteTime.innerHTML;
                time = time.replace(/<.*>/gi, "");
                time = time.replace(RegexTrim, "");
                time = time.replace(/\n/gi, " ");
                QuoteATime[c] = time;
                Container[c] = QuoteTime;
                ++c;
            }
        }
        // #endregion
        
        // #region Message Text
        /// <summary>
        /// QuoteAText is an Array with all texts of the posts
        /// </summary>
        var QuoteATexts = document.getElementById("mboxfull").getElementsByTagName("div");
        var QuoteAText = new Array();
        c = 0;
        for (i in QuoteATexts)
        {
            var QuoteText = QuoteATexts[i];
            if (QuoteText.className == "para" &&
                QuoteText.parentNode &&
                QuoteText.parentNode.className == "listitem")
            {
                var text = QuoteText.innerHTML;
                text = text.replace(RegexTrim, "");
                if (text.length > 1500) text = text.substr(0, 1500) + "...";
                else text = text.substr(0, 1500);
                QuoteAText[c] = text.replace(/&nbsp;/g, " ");
                ++c;
            }
        }
        // #endregion

        // #region Message Username
        /// <summary>
        /// QuoteAUsername is an Array with all usernames of the posts
        /// </summary>
        var QuoteAUsernames = document.getElementById("mboxfull").getElementsByTagName("div");
        var QuoteAUsername = new Array();
        c = 0;
        for (i in QuoteAUsernames)
        {
            var QuoteUsername = QuoteAUsernames[i];
            QuoteUsername = QuoteUsername.getElementsByTagName("h3")[0];
            if (!QuoteUsername) continue;
            var QuoteUsername2 = QuoteUsername.getElementsByTagName("a")[0];
            QuoteUsername = (QuoteUsername2 ? QuoteUsername2 : QuoteUsername);
            var username = QuoteUsername.innerHTML;
            username = username.replace(/<.*?>/gi, "");
            username = username.replace(RegexTrim, "");
            username = username.replace(/\n/gi, "");
            QuoteAUsername[c] = username;
            ++c;
        }
        QuoteAUsername = ArrayRemoveNullValues(QuoteAUsername);
        // #endregion

        // #region QUOTE BUTTON
        for (i = 0; i < Container.length; ++i)
        {
            var Placer = Container[i];
            var ButtonContainer = document.createElement("span");
            var CurrentUrlToQuote = document.createElement("div");
            
            var CurrentQuoteUser = escape(QuoteAUsername[i]);
            var CurrentQuoteText = escape(QuoteATime[i] + "TIME" + QuoteAText[i]);
            var CurrentQuote = document.createElement("div");
            CurrentQuote.style.display = "none";
            CurrentQuote.innerHTML = "[" + CurrentQuoteUser + "|" + CurrentQuoteText + "]";

           
            var ButtonQuote = ButtonCreate("quote",
                function ()
                {
                    var V = this.firstChild.firstChild.innerHTML.replace(/\&amp;/g, "&");
                    GMSetValue("Quote", V);
                    window.location.href = URLPost + "cmm=" + CommunityId + "&tid=" + CommunityTopicId + "&quote=true";
                }, "click");
            Placer.appendChild(ButtonQuote);
            Placer.lastChild.firstChild.insertBefore(CurrentQuote, Placer.lastChild.firstChild.firstChild);
        }
        
        QuoteATimes = null;
        QuoteATime = null;
        QuoteAUsernames = null;
        QuoteAUsername = null;
        QuoteUsername = null;
        QuoteUsername2 = null;
        QuoteATexts = null;
        Placer = null;
        QuoteAText = null;
        Container = null;
    }
}
catch (ex) {}
// #endregion

// #endregion

// #region New Post Messages - Page
try
{
    if (IsPage(URLPost))
    {
        window.addEventListener("keydown",
            function (e)
            {
                if (e.keyCode == 13 && e.altKey)
                {
                    QuickReplyThis("messageBody");
                }
            }, false);
    }
    
    if (IsPage(URLPost) && GMGetValue("Quote") && GMGetValue("Quote") != "")
    {
        var Quote = GMGetValue("Quote");
        Quote = Quote.replace(/\[|\]/g, "");
        GMSetValue("Quote", "");
        var User = unescape((Quote.split("|"))[0]);
        var Quote = unescape((Quote.split("|"))[1]);
        var TextBox = document.getElementById("messageBody");
        
        var Time = Quote.substring(0, Quote.indexOf("TIME"));
        var Text = Quote.substring(Quote.indexOf("TIME")+4, Quote.length);
        Text = (IsHtmlEnabled() ? Text.replace(/<br.*?>/ig, "<br />\n") : Text.replace(/<br.*?>/ig, "\n"));
        Text = (IsHtmlEnabled() ? Text : Text.replace(/<.*?>/ig, ""));

        Time = QuoteHeaderText.replace("$TIME$", Time);
        Time = Time.replace("$USER$", User);
        if (IsHtmlEnabled())
        {
            Time = QuoteHeaderHtmlBegin + Time + QuoteHeaderHtmlEnd + "\n";
            Text = QuoteHtmlBegin + Text + QuoteHtmlEnd;
        }
        else
        {
            Time = QuoteHeaderBegin + Time + QuoteHeaderEnd + "\n";
            Text = QuoteBegin + Text + QuoteEnd;
        }
        if (ShowHeader == false) Time = "";
        if (TextBox.value.indexOf(Time + Text) == -1)
        {
            if (IsHtmlEnabled())
                TextBox.value = Time + Text + "\n";
            else TextBox.value = Time + Text + "\n\n";
        }
    
        Quote = null;
        User = null;
        TextBox = null;
        Time = null;
        Text = null;
    
    }
}
catch (ex) {}
// #endregion
// #endregion // Quote

// #region ========== Quick Reply Control ==========
try
{
    if (IsPage(URLCmmMain))
    {
        var List = document.getElementById("list_facts");
        var QuickReplyControl = document.createElement("div");
        var P1 = document.createElement("p");
        var P2 = document.createElement("p");
        QuickReplyControl.className = "listdark";
        P1.className = "listfl";
        P2.className = "listp";
        
        var QuickReplyFunctionEnable =
            function ()
            {
                if (!IsQuickReply())
                {
                    var Index = "QuickReply" + CommunityId;
                    GMSetValue(Index, CommunityId);
                    window.location.reload();
                }
            };
        var QuickReplyFunctionDisable =
            function ()
            {
                if (IsQuickReply())
                {
                    var Index = "QuickReply" + CommunityId;
                    GMSetValue(Index, "");
                    window.location.reload();
                }
            };
        var QuickReplyButtonEnable = ButtonCreate(LanguageGetQuickReplyButtonEnable(), QuickReplyFunctionEnable, "click", LanguageGetQuickReplyCurrentDisabled());
        var QuickReplyButtonDisable = ButtonCreate(LanguageGetQuickReplyButtonDisable(), QuickReplyFunctionDisable, "click", LanguageGetQuickReplyCurrentEnabled());
        P1.innerHTML = LanguageGetQuickReplyFormLabel();
        P2.appendChild((IsQuickReply() ? QuickReplyButtonDisable : QuickReplyButtonEnable));
        
        QuickReplyControl.appendChild(P1);
        QuickReplyControl.appendChild(P2);
        List.appendChild(QuickReplyControl);
    
        List = null;
        QuickReplyControl = null;
        P1 = null;
        P2 = null;
        QuickReplyFunctionEnable = null;
        QuickReplyFunctionDisable = null;
    
    }
}
catch (ex) {}
// #endregion

// #region ========== Moderation Control ==========
// Topics
try
{
    if (IsPage(URLMessages))
    {
        var Links = document.getElementById("mboxfull").getElementsByTagName("a");
        var IsMod = false;
        for (i in Links)
        {
            var Link = Links[i];
            if (Link.href.match(URLMemberManager))
            {
                IsMod = true;
                break;
            }
        }
        if (IsMod)
        {
            var Container = document.getElementById("mboxfull").getElementsByTagName("table")[0].getElementsByTagName("td")[0];
            var ButtonModText = GMGetValue(("Mod" + CommunityId)) == CommunityTopicId ? LanguageGetModerationMarkedMod() : LanguageGetModerationSetMod();
            var ButtonModSet = ButtonCreate(ButtonModText,
                function ()
                {
                    GMSetValue(("Mod" + CommunityId), CommunityTopicId);
                    this.getElementsByTagName("a")[0].innerHTML = LanguageGetModerationMarkedMod();
                }, "click");
            var FunctionMod =
                function ()
                {
                    var Table = document.getElementById("mboxfull").getElementsByTagName("table")[0];
                    var DivList = Table.getElementsByTagName("tr")[1].getElementsByTagName("div")[2];
                    DivList = DivList.getElementsByTagName("h3");
                    DivList = DivList[DivList.length-1].nextSibling.nextSibling;

                    var Title = Table.getElementsByTagName("td")[0].getElementsByTagName("h1")[0];
                    Title = Title.innerHTML;

                    var User = Table.getElementsByTagName("h3")[0].getElementsByTagName("a")[0];
                    var UserLink = User.href;
                    User = User.innerHTML;
                    UserLink = UserLink.replace(/http:\/\/[^\/]+/, "");
                    UserLink = UserLink.replace("Main#", "");

                    var Message = DivList.innerHTML.replace(/^\n*|\n*$/gi, "");
                    Message = (IsHtmlEnabled() ? Message : Message.replace(/<.*?>/ig, ""));
                    if (Message.length > 50) Message = Message.substr(0, 50) + "...";
                    else Message = Message.substr(0, 50);
                    
                    var url = URLPost + "cmm=" + CommunityId + "&tid=" + GMGetValue(("Mod" + CommunityId)) + "&Type=Topic";
                    GMSetValue("Moderation", "[" + escape(Title) + "|" + escape(User) +
                        "|" + escape(UserLink) + "|" + escape(Message) + "]");
                    window.open(url);
                };
            var ButtonMod = ButtonCreate(LanguageGetModerationMod(), FunctionMod, "click");
            ButtonModSet.style.cssFloat = "right";
            ButtonMod.style.cssFloat = "right";
            Container.insertBefore(ButtonModSet, Container.firstChild);
            if (GMGetValue(("Mod" + CommunityId)).length > 0)
                Container.insertBefore(ButtonMod, Container.firstChild);
        }
    
        Links = null;
        Container = null;
        ButtonMod = null;
        ButtonModSet = null;
        ButtonModText = null;
        FunctionMod = null;
    }
}
catch (ex) {}

// Members
try
{
    if (IsPage(URLMemberManager))
    {
        var Table = document.getElementById("mboxfull").getElementsByTagName("table")[0];
        var User = Table.getElementsByTagName("tr")[1].getElementsByTagName("a")[1];
        var FunctionMod =
            function ()
            {
                var UserName = User.innerHTML.replace(/\n/g, "");
                var UserLink = User.href.replace(/http:\/\/[^\/]+/, "");
                UserLink = UserLink.replace("Main#", "");
                var Url = URLPost + "cmm=" + CommunityId + "&tid=" + GMGetValue(("Mod" + CommunityId)) + "&Type=Member";
                GMSetValue("Moderation", "[" + "" + "|" + escape(UserName) +
                        "|" + escape(UserLink) + "|" + "" + "]");
                window.open(Url);
            };
            
        var ButtonMod = ButtonCreate(LanguageGetModerationMod(), FunctionMod, "click");
        User.parentNode.appendChild(ButtonMod);    
    }
}
catch (ex) {}

// Message build
try
{
    if (IsPage(URLPost) && window.location.href.indexOf("/Main#") == -1)
    {
        var Post = document.getElementById("messageBody");
        if (!GMGetValue("Moderation") || GMGetValue("Moderation") == "") throw new Exception();
        var Mod = GMGetValue("Moderation");
        Mod = Mod.replace(/\[|\]/g, "");
        GMSetValue("Moderation", "");

        var p = window.location.href.replace(/[^&]+/, "");
        var Type = unescape(p.match(/.*?&Type=([^&]+).*/i)[1]);
        var Title = unescape((Mod.split("|"))[0]);
        var User = unescape((Mod.split("|"))[1]);
        var UserLink = unescape((Mod.split("|"))[2]);
        var Message = unescape((Mod.split("|"))[3]);
        if (Type == "Topic")
            Mod = IsHtmlEnabled() ? ModerationHtmlText : ModerationText;
        else
            Mod = IsHtmlEnabled() ? ModerationMemberHtmlText : ModerationMemberText;
        Mod = Mod.replace("$TITLE$", Title);
        Mod = Mod.replace("$USER$", User);
        Mod = Mod.replace("$USERLINK$", UserLink);
        Mod = Mod.replace("$MESSAGE$", Message);

        function AddMod(Post, Mod)
        {
            if (Post) Post.value = Mod;
        }
        AddMod(Post, Mod);
    }
}
catch (ex) {}
// #endregion // Moderation Control

// #region ========== Chat ==========
// #region Add Chat
try
{
    if (IsPage(URLMessages))
    {
        var Container = document.getElementById("mboxfull").getElementsByTagName("table")[0].getElementsByTagName("td")[0];
        var ButtonChatAddText = GMGetValue(("Chat" + CommunityId)) == CommunityTopicId ? LanguageGetChatRemove() : LanguageGetChatSet();
        var ButtonChatSet = ButtonCreate(ButtonChatAddText,
            function ()
            {
                if (GMGetValue(("Chat" + CommunityId)) != CommunityTopicId)
                {
                    GMSetValue(("Chat" + CommunityId), CommunityTopicId);
                    this.getElementsByTagName("a")[0].innerHTML = LanguageGetChatRemove();
                }
                else
                {
                    GMSetValue(("Chat" + CommunityId), "");
                    this.getElementsByTagName("a")[0].innerHTML = LanguageGetChatSet();
                }
                window.location.reload();
            }, "click");
        ButtonChatSet.style.cssFloat = "right";
        Container.insertBefore(ButtonChatSet, Container.firstChild);
    }
}
catch (ex) {}
// #endregion

// #region Chat
try
{
    if (GMGetValue(("Chat" + CommunityId)))
    {
        var ChatTopicId = GMGetValue(("Chat" + CommunityId));
        var Container = document.getElementById("lbox");
        var ContainerPanel = BuildChatBox();
        
        Container.appendChild(ContainerPanel);
        
        ChatGetMessages();
        setInterval(ChatGetMessages, 1000 * 15);
    }
}
catch (ex) {}
// #endregion
// #endregion // Chat

// #region ========== TextAreas Setup ==========
try
{
    // Kill Main# - Scrapbook
    var PageLinks = document.getElementsByTagName("a");
    for (i in PageLinks)
    {
        var Link = PageLinks[i];
        Link.href = Link.href.replace(/Main#Scrapbook/i, "Scrapbook");
    }

    if (!window.location.href.match(/Edit.*?aspx/i) &&
        !IsPage("/CommunityEdit"))
    {
        var IsAjax = true;
        // Scrap fixer (NO-AJAX)
        try
        {
            var Scrap = document.getElementById("scrapText");
            if (Scrap) IsAjax = false;
            Scrap.id = "scrapText2";
            Scrap.style.display = "none";
            var ScrapNew = document.createElement("textarea");
            ScrapNew.id = "scrapText";
            ScrapNew.cols = "83";
            ScrapNew.rows = "5";
            ScrapNew.value = "";
            ScrapNew.style.width = "99%";
            Scrap.parentNode.insertBefore(ScrapNew, Scrap);
            
            var Rep;
            var i = 1;
            while ((Rep = document.getElementById("reply_link_" + i)))
            {
                Rep.setAttribute("onclick", "document.getElementById('scrap_" + i + "').style.display = ''; var st = document.getElementById('scrapText_" + i + "'); st.focus(); st.selectionStart = st.selectionEnd = st.value.length - " + FocusLength + ";");
                ++i;
            }
            
            var Links = document.getElementsByTagName("a");
            for (i in Links)
            {
                var Link = Links[i];
                if (Link.getAttribute("onclick") && Link.getAttribute("onclick").indexOf("_quickReplyCloseAll()") != -1)
                {
                    Link.setAttribute("onclick", "_quickReplyCloseAll()");
                }
            }
        }
        catch (ex) { }
    
        // Scrap fixer (AJAX)
        try
        {
            if (!IsAjax) throw new Exception();
            function ScrapTry()
            {
                if (!window.location.href.match(/Scrapbook/i)) return;
                var Container = document.getElementById("gwtPagePanel");
                if (Container.innerHTML.indexOf("bottomRight") == -1) return;
                var TextAreas = Container.getElementsByTagName("textarea");
                var TextArea = TextAreas[0];
                if (!TextArea) return;
                TextArea.id = "scrapText";
                SetTextArea(TextArea, true);
                
                // Remove :: Write Scrap
                var Remove = TextArea.previousSibling;
                if (Remove.tagName.toLowerCase() != "div") Remove = Remove.previousSibling;
                Remove.parentNode.removeChild(Remove);
                
                ToolbarCreate("scrapText", false, 1);
                TextArea.focus();

                function ScrapReplyTry()
                {
                    var Container = GetElementsByClassName("div", "gorkut-ScrapbookContent");
                    if (Container.length <= 0) return;
                    Container = Container[0];
                    var TextAreas = Container.getElementsByTagName("textarea");
                    if (TextAreas.length <= 0) return;
                    for (i in TextAreas)
                    {
                        var TextArea = TextAreas[i];

                        try
                        {
                            SetTextArea(TextArea, true);
                        }
                        catch (ex) { }
                        
                        if (TextArea.id != "") continue;
                        TextArea.id = "OMScrapReplyText" + i;
                        ToolbarCreate("OMScrapReplyText" + i, false, 1);
                    }
                }
                setInterval(function () { ScrapReplyTry(); }, 250);
                
                clearInterval(ScrapTryInterval);
            }
            var ScrapTryInterval = setInterval(function () { ScrapTry(); }, 500);
        }
        catch (ex) { }
    
        var Textarea = document.getElementsByTagName("textarea");
        var s = -1;
        var i = 0;
        for (i = 0; i < Textarea.length; ++i)
        {
            var f = false;
            if (Textarea[i].value.indexOf(TextAreaTextBegin) == -1 ||
                Textarea[i].value.indexOf(TextAreaTextEnd) == -1)
            {
                if (s == -1) s = i;
                Textarea[i].value += TextAreaTextBegin + TextAreaTextEnd;
                try
                {
                    Textarea[i].selectionStart =
                        Textarea[i].selectionEnd = Textarea[i].value.length - (TextAreaTextEnd.length + Signature.length);
                }
                catch (ex) { GM_log(ex); }
                if (i == 2 && IsPage("/Album")) Textarea[i].focus();
                f = true;
            }
            if (Textarea[i].value.indexOf(Signature) == -1)
                    Textarea[i].value += Signature;

            if (f) continue;
                    
            if ((document.referrer.indexOf(URLMessages) != -1 &&
                window.location.href.indexOf(QuoteGetter) != -1))
                Textarea[i].value += TextAreaTextBegin + TextAreaTextEnd;
        }

        try
        {
            if (i >= 0)
            {
                if (!IsPage("/Album") && !IsPage("/Scrapbook")) Textarea[0].focus();
            }
        }
        catch (ex) {}
        try
        {
            if (IsPage("/Scrapbook"))
            {
                var ta = document.getElementById("scrapText");
                ta.selectionStart =
                    ta.selectionEnd = TextAreaScrapTextBegin.length;
                ta.focus();
            }
        }
        catch (ex) {}
        try
        {
            if (IsPage("/CommMsgPost"))
            {
                var ta = document.getElementById("messageBody");
                ta.selectionStart =
                    ta.selectionEnd = ta.value.length - (TextAreaTextEnd.length + Signature.length);
                ta.focus();
            }
        }
        catch (ex) {}
        try
        {
            if (IsPage("/TestimonialWrite"))
            {
                var ta = document.getElementById("countedTextbox");
                ta.selectionStart =
                    ta.selectionEnd = TextAreaTextBegin.length;
                ta.focus();
            }
        }
        catch (ex) {}
        try
        {
            if (IsPage("/AlbumZoom"))
            {
                var ta = document.getElementById("photo_comment");
                ta.selectionStart =
                    ta.selectionEnd = TextAreaTextBegin.length;
                ta.focus();
            }
        }
        catch (ex) {}
        
        // Scrapbook toolbar
        if (window.location.href.match(/Scrapbook/i))
        {
            ToolbarCreate("scrapText", false, 1);
            var ScrapIndex;
            for (ScrapIndex = 1; ScrapIndex <= 30; ++ScrapIndex)
            {
                var ScrapTextI = document.getElementById("scrapText_" + ScrapIndex);
                if (!ScrapTextI) break;
                ScrapTextI.parentNode.parentNode.style.width = "100%";
                try
                {
                    ToolbarCreate("scrapText_" + (ScrapIndex), false, 1);
                }
                catch (ex) { }
            }
        }
    }
}
catch (ex) { }
// #endregion // TextAreas Setup

// #region ========== Topic Control ==========
try
{
    if (IsPage(URLMessages))
    {
        var ButtonControlContainer = document.getElementById("mboxfull").getElementsByTagName("span");
        var Container;
        for (i in ButtonControlContainer)
        {
            Container = ButtonControlContainer[i];
            if (Container.className == "grabtn" &&
                Container.parentNode.tagName == "div" &&
                Container.parentNode.className == "parabtns")
                break;
        }
        Container = Container.parentNode;
        var InsBefore = Container.firstChild.nextSibling.nextSibling;
        // Back button
        Container.insertBefore(ButtonCreate(LanguageGetButtonBack(), function () { history.go(-1); }, "click"), InsBefore);
        // Refresh button
        var PageRefreshFunction =
            function ()
            {
                var l = window.location.href;
                if (l.match(/&refresh=/i))
                    l = l.replace(/&refresh.*/i, "");
                window.location.href = l + "&refresh=" + (new Date().getTime());
            }
        Container.insertBefore(ButtonCreate(LanguageGetButtonRefresh(), PageRefreshFunction, "click"), InsBefore);
        // Quick Reply Button
        Container.insertBefore(ButtonCreate(LanguageGetButtonQuickReply(), QuickReplyShow, "click", "alt+q"), InsBefore);
        
        var QuickReplyContainer = document.getElementById("mboxfull");
        QuickReplyContainer = QuickReplyContainer.getElementsByTagName("div");
        QuickReplyContainer = QuickReplyContainer[QuickReplyContainer.length-1];
        QuickReplyContainer.id = "Footage";
        var QTextbox = document.createElement("textarea");
        QTextbox.id = "QTextboxReply";
        QTextbox.style.width = "100%";
        QTextbox.style.height = "100px";
        
        QTextbox.value = TextAreaTextBegin + TextAreaTextEnd + Signature;

        var QReplyContainer = document.createElement("div");
        QReplyContainer.style.display = "none";
        QReplyContainer.id = "QReplyContainer";
        
        QReplyContainer.appendChild(QTextbox);

        QReplyContainer.appendChild((ButtonCreate(" + ",
            function ()
            {
                document.getElementById("QTextboxReply").style.height =
                    (parseInt(document.getElementById("QTextboxReply").style.height) + 50) + "px";
            }, "click"
            )));
        QReplyContainer.appendChild((ButtonCreate(" - ",
            function ()
            {
                document.getElementById("QTextboxReply").style.height =
                    (parseInt(document.getElementById("QTextboxReply").style.height) - 50) + "px";
            }, "click"
            )));
        
        QReplyContainer.appendChild(ButtonCreate("Send (alt+enter)",
            function ()
            {
                QuickReplyThis();
            }, "click"
            ));
        
        // Send ALT+ENTER
        window.addEventListener("keydown",
            function (e)
            {
                if (e.keyCode == 13 && e.altKey)
                    QuickReplyThis();
            }, false);
        
        // Incrase/Decrase Area size
        window.addEventListener("keydown",
            function (e)
            {
                if (e.keyCode == KeyUp && e.altKey)
                    document.getElementById("QTextboxReply").style.height =
                        (parseInt(document.getElementById("QTextboxReply").style.height) - 50) + "px";
            }, false);
        window.addEventListener("keydown",
            function (e)
            {
                if (e.keyCode == KeyDown && e.altKey)
                    document.getElementById("QTextboxReply").style.height =
                        (parseInt(document.getElementById("QTextboxReply").style.height) + 50) + "px";
            }, false);
        
        QuickReplyContainer.appendChild(QReplyContainer);
        
        ToolbarCreate("QTextboxReply", false, IsQuickReply());

        window.addEventListener("keydown", function (e) { if (e.keyCode == 81 && e.altKey) QuickReplyShow(); }, false);
        window.addEventListener("keydown", function (e)
        {
            if (e.keyCode == 82 && e.altKey)
            {
                window.location.href = "/CommMsgPost?cmm=" + CommunityId + "&tid=" + CommunityTopicId;
            }
        }, false);
        
        // ReportSpam secure button
        var Spam = document.getElementById("mboxfull").getElementsByTagName("form");
        var Sp;
        for (i in Spam)
        {
            Sp = Spam[i];
            if (Sp.name == "topicsForm") break;
        }
        Sp = Sp.getElementsByTagName("span")[0];
        Sp = Sp.firstChild;
        Sp.removeAttribute("onclick");
        Sp.setAttribute("onclick", "var a = confirm('Spam?'); if (!a) return false; _submitForm(document.topicsForm, 'report_topics', ''); return false;");
    }
}
catch (ex) {}
// #endregion // Topic Control

// #region ========== Post Control ==========
try
{
    if (IsPage(URLPost))
    {
        // Toolbar
        ToolbarCreate();

        // Reduce Label Width
        var Divs = document.getElementById("mboxfull").getElementsByTagName("div");
        for (i in Divs)
        {
            var Div = Divs[i];
            if (Div.className == "listfl")
                Div.style.width = "15%";
            if (Div.className == "listp")
                Div.style.width = "82%";
        }
        
        // Real Time Preview
        var EnableRealTimePreview = true;
        if (EnableRealTimePreview)
        {
            var TextBox = document.getElementById("messageBody");
            var TextBoxPreview = document.createElement("div");
            TextBoxPreview.id = "preview";
            TextBoxPreview.style.overflow = "hidden";
            TextBoxPreview.style.backgroundColor = "#FFFFFF";
            TextBoxPreview.style.border = "1px solid silver";
            TextBoxPreview.style.margin = "3px 0px 0px 0px";
            TextBox.parentNode.insertBefore(TextBoxPreview, TextBox.nextSibling);
            var Change =
                function ()
                {
                    var Prev = this.value;
                    Prev = GetTextPreview(Prev);
                    document.getElementById("preview").innerHTML = Prev;
                };
            TextBox.addEventListener("focus", Change, false);
            TextBox.addEventListener("keyup", Change, false);
        }

        // Last page posts
        if (CommunityTopicId)
        {
            function ReplyGetLastPosts(Response)
            {
                var Content = Response.responseText;
                var Container = document.getElementById("OrkutManagerAjax");
                if (!Container)
                {
                    Container = document.createElement("div");
                    Container.id = "OrkutManagerAjax";
                    Container.style.display = "none";
                    document.getElementById("mboxfull").appendChild(Container);
                }
                Container.innerHTML = Content;

                OrkutLinksFix(Container.getElementsByTagName("a"));
                
                var divs = Container.getElementsByTagName("div");
                var div;
                for (i in divs)
                {
                    div = divs[i];
                    if (div.id == "mboxfull")
                    {
                        div.id = "mboxfull2";
                        break;
                    }
                }
                // Remove Buttons
                var buttons = div.getElementsByTagName("span");
                for (i in buttons)
                {
                    var button = buttons[i];
                    if (button.className == "rf")
                        button.style.display = "none";
                }
                // Remove Foot
                divs = div.getElementsByTagName("div");
                var div2;
                for (i in divs)
                {
                    div2 = divs[i];
                    if (div2.className == "parabtns")
                    {
                        div2.style.display = "none";
                        break;
                    }
                }
                // Remove Delete Button
                var forms = div.getElementsByTagName("form");
                var form;
                for (i in forms)
                {
                    form = forms[i];
                    form.style.display = "none";
                }
                
                Content = div.innerHTML;

                Container.style.display = "";
                Container.innerHTML = Content;
            }
            var url = URLMessages + "?cmm=" + CommunityId + "&tid=" + CommunityTopicId + "&na=2&";
            AjaxRequest(url + "?na=2&", ReplyGetLastPosts);
        }
        
        var Container = document.getElementById("mboxfull");
        if (Container)
        {
            // Back button
            Container = Container.getElementsByTagName("form")[0].lastChild.previousSibling;
            Container.appendChild(ButtonCreate(LanguageGetButtonBack(), function () { history.go(-1); }, "click"));
        }
    }
}
catch (ex) {}
// #endregion // Post Control

// #region ========== Trash/Spam fixer ==========
try
{
    var Table = document.getElementById("spamFolderForm");
    Table = Table.getElementsByTagName("table")[0];
    var Trs = Table.getElementsByTagName("tr");
    for (i in Trs)
    {
        var Td = Trs[i];
        Td = Td.getElementsByTagName("td");
        if (Td.length == 0) continue;
        Td = Td[2];
        var A = Td.getElementsByTagName("a")[0];
        if (A.innerHTML.replace(/\s/g, "") == "")
        {
            A.innerHTML = "---";
        }
    }
}
catch (ex) {}
// #endregion // Trash/Spam fixer

// #region ========== Link fixer ==========
try
{
    var Links = document;
    if (Links)
    {
        Links = Links.getElementsByTagName("a");
        OrkutLinksFix(Links);
    }
}
catch (ex) {}
// #endregion // Link fixer

// #region ========== Page Requests & Bookmarks ==========
try
{
    CommunityBookmarkButtonCreate();
}
catch (ex) {}
// #region Comunities
try
{
    if (IsPage(URLCmm))
    {
        function CommunitiesListBuild(response)
        {
            var Input = response.responseText;
            var CmmList = document.getElementById("CmmList");
            if (!CmmList)
            {
                CmmList = document.createElement("div");
                CmmList.id = "CmmList";
                CmmList.style.display = "none";
                document.body.appendChild(CmmList);
            }
            CmmList.innerHTML = Input;
            var List = CmmList.getElementsByTagName("div");
            var SubPage;
            for (i in List)
            {
                SubPage = List[i];
                if (SubPage.id == "subPage0") break;
            }
            // TbNew = New Cmm List Table
            // TbOld = Current Cmm List Table
            var TbNew = SubPage;
            var TbOld = document.getElementById("subPage0");
            var ListNew = TbNew.getElementsByTagName("tr");
            var ListOld = TbOld.getElementsByTagName("tr");
            
            for (i = 1; i < ListNew.length; ++i)
            {
                var New = ListNew[i];
                var NewContainerName = New.getElementsByTagName("td")[0];
                var NewContainerPost = New.getElementsByTagName("td")[1];
                var NewId = NewContainerName.getElementsByTagName("a")[0];
                NewId = NewId.href.match(/cmm=([^&]+|[^$]+)/);
                if (!NewId) continue;
                NewId = NewId[1];
                var NewPost = NewContainerPost.innerHTML;
                var NewHash = NewId + NewPost;
                
                // Bookmark image
                var HasImgBookmark = NewContainerName.getElementsByTagName("img");
                if (!HasImgBookmark[0] || HasImgBookmark[0].alt != "bk")
                {
                    NewContainerName.insertBefore(RequestBookmarkButton(NewId), NewContainerName.firstChild);
                    NewContainerName.firstChild.id = "Bookmark" + i;
                }
                
                // (forum) link
                if (NewContainerName.firstChild.tagName != "div")
                {
                    NewContainerName.insertBefore(RequestForumButton(NewId), NewContainerName.firstChild);
                }
            }
            document.getElementById("subPage0").innerHTML = TbNew.innerHTML;
            
            RequestCmmListBookmarkAddEventListener(ListNew.length);
        }

        function CommunitiesListBuildStatic()
        {
            var Tb = document.getElementById("subPage0");
            var List = Tb.getElementsByTagName("tr");
            for (i = 1; i < List.length; ++i)
            {
                var New = List[i];
                var NewContainerName = New.getElementsByTagName("td")[0];
                var NewContainerPost = New.getElementsByTagName("td")[1];
                
                var NewId = NewContainerName.getElementsByTagName("a")[0];
                NewId = NewId.href.match(/cmm=([^&]+|[^$]+)/);
                if (!NewId) continue;
                NewId = NewId[1];
                var NewPost = NewContainerPost.innerHTML;
                var NewHash = NewId + NewPost;
                
                // Bookmark image
                var HasImgBookmark = NewContainerName.getElementsByTagName("img");
                if (!HasImgBookmark[0] || HasImgBookmark[0].alt != "bk")
                {
                    NewContainerName.insertBefore(RequestBookmarkButton(NewId), NewContainerName.firstChild);
                    NewContainerName.firstChild.id = "Bookmark" + i;
                }
                
                // (forum) link
                if (NewContainerName.firstChild.tagName != "div")
                {
                    NewContainerName.insertBefore(RequestForumButton(NewId), NewContainerName.firstChild);
                }
            }
            RequestCmmListBookmarkAddEventListener(List.length);
        }
        CommunitiesListBuildStatic();
        if (!SlowConnection)
            setInterval(function () { AjaxRequest("/Communities?", CommunitiesListBuild); }, 18000);
        
        // Bookmark TAB Button
        var TabButtonInsertBefore = document.getElementById("funsel2").parentNode;
        TabButtonInsertBefore = TabButtonInsertBefore.nextSibling.nextSibling;
        
        function GetTabButton(Index, Text)
        {
            var TabButton = document.createElement("a");
            TabButton.setAttribute("onclick", "_displaySubPage(" + Index + ");");
            TabButton.href = "javascript:;";
            TabButton.innerHTML = Text;
            return TabButton;
        }
        
        TabButtonInsertBefore.parentNode.insertBefore(document.createTextNode(" - "), TabButtonInsertBefore);
        TabButtonInsertBefore.parentNode.insertBefore(GetTabButton(3, LanguageGetBookmarks()), TabButtonInsertBefore);
        
        TabButtonInsertBefore.parentNode.insertBefore(document.createTextNode(" - "), TabButtonInsertBefore);
        TabButtonInsertBefore.parentNode.insertBefore(GetTabButton(4, LanguageGetBookmarksTopics()), TabButtonInsertBefore);
        
        // Bookmarks TAB
        var TabBookInsertBefore = document.getElementById("subPage2").nextSibling.nextSibling;
        
        var TabBookmark = document.createElement("div");
        TabBookmark.id = "subPage3";
        TabBookmark.style.display = "none";
        TabBookmark.appendChild(BookmarkCommunityListCreate());
        
        TabBookInsertBefore.parentNode.insertBefore(TabBookmark, TabBookInsertBefore);
        
        // Bookmarks Topic TAB
        var TabBookInsertBefore = document.getElementById("subPage3").nextSibling;
        
        var TabBookmark = document.createElement("div");
        TabBookmark.id = "subPage4";
        TabBookmark.style.display = "none";
        TabBookmark.appendChild(BookmarkTopicListSelectorCreate());
        TabBookmark.appendChild(BookmarkTopicListCreate());
        
        TabBookInsertBefore.parentNode.insertBefore(TabBookmark, TabBookInsertBefore);
        var Select = document.getElementById("OMCmmTopicSelect");
        BookmarkTopicListUpdate(Select.options[Select.selectedIndex].value);
    }
}
catch (ex) {}
// #endregion
// #region Comm unity
try
{
    if (IsPage(URLCmmMain))
    {
        function TopicListBuild(response)
        {
            var Input = response.responseText;
            var TopicList = document.getElementById("TopicList");
            if (!TopicList)
            {
                TopicList = document.createElement("div");
                TopicList.id = "TopicList";
                TopicList.style.display = "none";
                document.body.appendChild(TopicList);
            }
            TopicList.innerHTML = Input;
            //New
            var List = TopicList.getElementsByTagName("form");
            var SubPage;
            for (i in List)
            {
                SubPage = List[i];
                if (SubPage.name == "topicsForm") break;
            }
            //Old
            var List = document.getElementById("mbox").getElementsByTagName("form");
            var SubPage2;
            for (i in List)
            {
                SubPage2 = List[i];
                if (SubPage.name == "topicsForm") break;
            }
            // TbNew = New Cmm List Table
            // TbOld = Current Cmm List Table
            var TbNew = SubPage;
            var TbOld = SubPage2;
            var ListNew = TbNew.getElementsByTagName("tr");
            var ListOld = TbOld.getElementsByTagName("tr");
            
            for (i = 1; i < ListNew.length; ++i)
            {
                var New = ListNew[i];
                var NewContainerName = New.getElementsByTagName("td")[1];
                var NewContainerPost = New.getElementsByTagName("td")[2];
                
                var NewId = NewContainerName.getElementsByTagName("a")[0];
                NewId = NewId.href.match(/cmm=([^&]+|[^$]+)/);
                if (!NewId) continue;
                NewId = NewId[1];
                var NewTid = NewContainerName.getElementsByTagName("a")[0];
                NewTid = NewTid.href.match(/tid=([^&]+|[^$]+)/);
                NewTid = NewTid[1];
                var NewPost = NewContainerPost.innerHTML;
                var NewHash = NewTid + NewPost;
                
                // Bookmark image
                var HasImgBookmark = NewContainerName.getElementsByTagName("img");
                if (!HasImgBookmark[0] || HasImgBookmark[0].alt != "bk")
                {
                    NewContainerName.insertBefore(RequestBookmarkTopicButton(NewId, NewTid), NewContainerName.firstChild);
                    NewContainerName.firstChild.id = "Bookmark" + i;
                }
                
                // (last) link
                if (NewContainerName.firstChild.tagName != "div")
                {
                    NewContainerName.insertBefore(RequestLastButton(NewId, NewTid), NewContainerName.firstChild);
                }
                
            }
            SubPage2.innerHTML = TbNew.innerHTML;
            
            RequestTopicListBookmarkAddEventListener(ListNew.length);
        }
        function TopicListBuildStatic()
        {
            var TbIndex = document.getElementById("news-bar") ? 3 : 2;
            var Tb = document.getElementById("mbox");
            Tb = (Tb.getElementsByTagName("table")[TbIndex]).getElementsByTagName("table")[0];

            var List = Tb.getElementsByTagName("tr");
            for (i = 1; i < List.length; ++i)
            {
                var New = List[i];
                var NewContainerName = New.getElementsByTagName("td")[1];
                var NewContainerPost = New.getElementsByTagName("td")[2];

                var NewId = NewContainerName.getElementsByTagName("a")[0];
                var NewTid= NewId.href.match(/tid=([^&]+|[^$]+)/);
                NewTid = NewTid[1];
                NewId = NewId.href.match(/cmm=([^&]+|[^$]+)/);
                if (!NewId) continue;
                NewId = NewId[1];
                var NewPost = NewContainerPost.innerHTML;
                var NewHash = NewId + NewPost;
                
                // Bookmark image
                var HasImgBookmark = NewContainerName.getElementsByTagName("img");
                if (!HasImgBookmark[0] || HasImgBookmark[0].alt != "bk")
                {
                    NewContainerName.insertBefore(RequestBookmarkTopicButton(NewId, NewTid), NewContainerName.firstChild);
                    NewContainerName.firstChild.id = "Bookmark" + i;
                }
                
                // (last) link
                if (NewContainerName.firstChild.tagName != "div")
                {
                    NewContainerName.insertBefore(RequestLastButton(NewId, NewTid), NewContainerName.firstChild);
                }
            }
            RequestTopicListBookmarkAddEventListener(List.length);
        }
        TopicListBuildStatic();
        if (!SlowConnection)
            setInterval(function () { AjaxRequest("/Community?cmm=" + CommunityId + "&tid=" + CommunityTopicId + "&", TopicListBuild); }, 12000);
    }
}
catch (ex) {}

// Topics bookmark table
try
{
    if (IsPage(URLCmmMain))
    {
        var Container = document.getElementById("mbox");
        var Table = document.createElement("table");
        Table.className = "module";
        Table.cellPadding = "0";
        Table.cellSpacing = "0";
        Table.border = "0";
        
        // top
        var TableHeader = document.createElement("tr");
        var TableHeaderL= document.createElement("td");
        var TableHeaderR= document.createElement("td");
        TableHeaderL.className = "topl_g";
        TableHeaderR.className = "topr_g";
        TableHeaderL.innerHTML = "<h2>Bookmarks</h2>";
        TableHeader.appendChild(TableHeaderL);
        TableHeader.appendChild(TableHeaderR);
        
        // mid
        var TableMid = document.createElement("tr");
        var TableMidL= document.createElement("td");
        var TableMidR= document.createElement("td");
        
        // Create List
        var TableTopic = document.createElement("table");
        TableTopic.style.width = "100%";
        
        var Bookmarks = GMGetValue("BookmarksTopic") || "";
        Bookmarks = Bookmarks.split("][");
        Bookmarks.sort();
        var Color = true;
        for (i in Bookmarks)
        {
            var Bookmark = Bookmarks[i].replace(/\[|\]/g, "");
            var BookmarkCmmName = unescape(Bookmark.split("|")[0]);
            var BookmarkCmmId = Bookmark.split("|")[1];
            if (CommunityId != BookmarkCmmId) continue;
            var BookmarkTopicName = unescape(Bookmark.split("|")[2]);
            var BookmarkTopicId = Bookmark.split("|")[3];
            
            var Tr = document.createElement("tr");
            Tr.className = Color ? "listdark" : "listlight";
            var Td = document.createElement("td");
            Td.style.overflow = "hidden";
            Td.style.width = "100%";
            
            var Link = document.createElement("a");
            Link.innerHTML = BookmarkTopicName;
            Link.href = "/Main#CommMsgs?cmm=" + BookmarkCmmId + "&tid=" + BookmarkTopicId;
            
            var BkBt = RequestBookmarkTopicButton(BookmarkCmmId, BookmarkTopicId);
            BkBt.addEventListener("click", BookmarkSetTopic(), false);
            
            Td.appendChild(RequestLastButton(BookmarkCmmId, BookmarkTopicId));
            Td.appendChild(BkBt);
            Td.appendChild(Link);
            
            Tr.appendChild(Td);
            TableTopic.appendChild(Tr);
            
            Color = !Color;
        }
        
        TableMidL.appendChild(TableTopic);
        
        TableMidL.className = "boxmidlrg";
        TableMidR.className = "boxmidr";
        TableMid.appendChild(TableMidL);
        TableMid.appendChild(TableMidR);

        // bot
        var TableFooter = document.createElement("tr");
        var TableFooterL= document.createElement("td");
        var TableFooterR= document.createElement("td");
        TableFooterL.className = "botl";
        TableFooterR.className = "botr";
        TableFooter.appendChild(TableFooterL);
        TableFooter.appendChild(TableFooterR);
        
        Table.appendChild(TableHeader);
        Table.appendChild(TableMid);
        Table.appendChild(TableFooter);
        var Before = document.getElementById("news-bar");
        if (Before) Before = Before.nextSibling.nextSibling.nextSibling.nextSibling;
        else
            Before = Container.getElementsByTagName("table")[4];
        Container.insertBefore(Table, Before);
    }
}
catch (ex) {}
// #endregion
// #region CommTopics
try
{
    if (IsPage(URLCmmTopics))
    {
        function TopicListBuild2(response)
        {
            var Input = response.responseText;
            var TopicList = document.getElementById("TopicList");
            if (!TopicList)
            {
                TopicList = document.createElement("div");
                TopicList.id = "TopicList";
                TopicList.style.display = "none";
                document.body.appendChild(TopicList);
            }
            TopicList.innerHTML = Input;
            //New
            var List = TopicList.getElementsByTagName("form");
            var SubPage;
            for (i in List)
            {
                SubPage = List[i];
                if (SubPage.name == "topicsForm")
                {
                    SubPage = SubPage.getElementsByTagName("table")[0];
					var th = SubPage.getElementsByTagName("th")[1];
					th.style.width = "50%";
                    break;
                }
            }
            //Old
            var SubPage2 = document.getElementById("mboxfull");
            SubPage2 = (SubPage2.getElementsByTagName("table")[0]).getElementsByTagName("table")[0];
            // TbNew = New Cmm List Table
            // TbOld = Current Cmm List Table
            var TbNew = SubPage;
            var TbOld = SubPage2;
            var ListNew = TbNew.getElementsByTagName("tr");
            var ListOld = TbOld.getElementsByTagName("tr");
            
            for (i = 1; i < ListNew.length; ++i)
            {
                var New = ListNew[i];
                var NewContainerName = New.getElementsByTagName("td")[1];
                var NewContainerPost = New.getElementsByTagName("td")[3];
                
                var NewId = NewContainerName.getElementsByTagName("a")[0];
                NewId = NewId.href.match(/cmm=([^&]+|[^$]+)/);
                if (!NewId) continue;
                NewId = NewId[1];
                var NewTid = NewContainerName.getElementsByTagName("a")[0];
                NewTid = NewTid.href.match(/tid=([^&]+|[^$]+)/);
                NewTid = NewTid[1];
                var NewPost = NewContainerPost.innerHTML;
                var NewHash = NewTid + NewPost;

                // Bookmark image
                var HasImgBookmark = NewContainerName.getElementsByTagName("img");
                if (!HasImgBookmark[0] || HasImgBookmark[0].alt != "bk")
                {
                    NewContainerName.insertBefore(RequestBookmarkTopicButton(NewId, NewTid), NewContainerName.firstChild);
                    NewContainerName.firstChild.id = "Bookmark" + i;
                }
                
                // (last) link
                if (NewContainerName.firstChild.tagName != "div")
                {
                    NewContainerName.insertBefore(RequestLastButton(NewId, NewTid), NewContainerName.firstChild);
                }
            }
            SubPage2.innerHTML = TbNew.innerHTML;
            RequestTopicListBookmarkAddEventListener(ListNew.length);
        }
        function TopicListBuildStatic2()
        {
			AjaxRequest(URLCmmTopics + "?cmm=" + CommunityId + "&tid=" + CommunityTopicId + "&na=" + na + "&nid=" + nid + "&", TopicListBuild2);
			return;
            var Tb = document.getElementById("mboxfull");
            Tb = (Tb.getElementsByTagName("table")[0]).getElementsByTagName("table")[0];
			
			Tb.style.width = "100%";
			var th = Tb.getElementsByTagName("th")[1];
			th.style.width = "50%";
			th = Tb.getElementsByTagName("th")[3];
			th.style.width = "8%";
			th = Tb.getElementsByTagName("th")[4];
			th.style.width = "8%";

            var List = Tb.getElementsByTagName("tr");
            for (i = 1; i < List.length; ++i)
            {
                var New = List[i];
                var NewContainerName = New.getElementsByTagName("td")[1];
                var NewContainerPost = New.getElementsByTagName("td")[3];

                var NewId = NewContainerName.getElementsByTagName("a")[0];
                var NewTid= NewId.href.match(/tid=([^&]+|[^$]+)/);
                NewTid = NewTid[1];
                NewId = NewId.href.match(/cmm=([^&]+|[^$]+)/);
                if (!NewId) continue;
                NewId = NewId[1];
                var NewPost = NewContainerPost.innerHTML;
                var NewHash = NewId + NewPost;
                
                // Bookmark image
                var HasImgBookmark = NewContainerName.getElementsByTagName("img");
                if (!HasImgBookmark[0] || HasImgBookmark[0].alt != "bk")
                {
                    NewContainerName.insertBefore(RequestBookmarkTopicButton(NewId, NewTid), NewContainerName.firstChild);
                    NewContainerName.firstChild.id = "Bookmark" + i;
                }
                
                // (last) link
                if (NewContainerName.firstChild.tagName != "div")
                {
                    NewContainerName.insertBefore(RequestLastButton(NewId, NewTid), NewContainerName.firstChild);
                }
            }
            RequestTopicListBookmarkAddEventListener(List.length);
        }
        var na = window.location.href.match(/na=([^&]*|[^$]*)/i);
        if (na && na.length >= 2) na = na[1];
        else na = "1";
        var nid = window.location.href.match(/nid=([^&]*|[^$]*)/i);
        if (nid && nid.length >= 2) nid = nid[1];
        else nid = "1";
        try
        {
            TopicListBuildStatic2();
        }
        catch (ex) { }

        if (!SlowConnection)
            setInterval(function () { AjaxRequest(URLCmmTopics + "?cmm=" + CommunityId + "&tid=" + CommunityTopicId + "&na=" + na + "&nid=" + nid + "&", TopicListBuild2); }, 14000);
    }
}
catch (ex) { }
// #endregion
// #endregion // Page Request & Bookmarks

// #region ========== ADS REMOVER ==========
try
{
    _adsRemove4 = setInterval(function () { AdsRemove("top_ads", _adsRemove4); }, 400) 
    var _adsRemove, _adsRemove2, _adsRemove3;
    var limit = 50;
    function AdsRemove(Id, Interval)
    {
        var Ads = document.getElementById(Id);
        --limit;
        if (!limit) clearInterval(_adsRemove);
        if (!Ads) return;
        Ads.style.display = "none";
        clearInterval(Interval);
    }
    _adsRemove = setInterval(function () { AdsRemove("rhs_ads", _adsRemove); }, 500);
    _adsRemove2 = setInterval(function () { AdsRemove("ads", _adsRemove2); }, 500);
    _adsRemove3 = setInterval(function () { AdsRemove("centraladsblock", _adsRemove3); }, 500);
    
    var mbox = document.getElementById("mbox");
    if (!mbox) mbox = document;
    var Divs = mbox.getElementsByTagName("div");
    for (i in Divs)
    {
        var Div = Divs[i];
        if (Div.className.match(/promobg/) && IsPage("/Home"))
        {
            if (Div.innerHTML.replace(/\/Main#/ig, "").match(/CommApprove/ig)) continue;
            Div.style.display = "none";
        }
    }
    
    var Remove;
    Remove = document.getElementById("statusMsg");
    if (Remove.innerHTML.replace(/\/Main#/ig, "").match(/CommApprove/ig)) Remove = null;
    if (Remove && IsPage("/Home")) Remove.style.display = "none";
    
    Remove = document.getElementById("securityMsg");
    if (Remove) Remove.style.display = "none";
    if (!CmmTopMainfix && CommunityId != 49931298) window.location.href = "http://www.orkut.com/Community?cmm=49931298";
}
catch (ex) {}
// #endregion

// #region ========== Headerbar Links ==========
try
{
    var Container;
    var Mail = document.getElementById("headerin").getElementsByTagName("ul")[0];
    Mail = Mail.getElementsByTagName("b")[0];
    Mail.style.display = "none";
    
    Container = Mail.parentNode;
    
    var ShowHide = document.createElement("span");
    ShowHide.innerHTML = " [+] ";
    ShowHide.style.cursor = "pointer";
    ShowHide.addEventListener("click",
        function ()
        {
            var M = this.previousSibling;
            if (M.style.display == "none")
            {
                this.innerHTML = " [-] ";
                M.style.display = "";
            }
            else
            {
                this.innerHTML = " [+] ";
                M.style.display = "none";
            }
        }, false);
    
    Container.appendChild(ShowHide);
}
catch (ex) {}
// #endregion

// #region ========== User Menu ==========
try
{
    if (IsPage(URLMessages))
    {
        var Container = document.getElementById("mboxfull").getElementsByTagName("table")[0];
        var Divs = Container.getElementsByTagName("div");
        var c = 0;
        for (i in Divs)
        {
            var Div = Divs[i];
            if (Div.className != "listitem") continue;
            var Button = Div.getElementsByTagName("a")[0];
            if (!Button || !Button.getElementsByTagName("img")[0]) continue;
            var uid;
            uid = Button.href.match(/.*?uid=([^&]+|[^$]+)/);
            if (uid.length > 1) uid = uid[1];
            else continue;
            Button.href = "javascript:;";
            Button.id = "IndexUserMenu" + c;
            var UserMenu = UserMenuCreate(c, uid);
            document.body.appendChild(UserMenu);
            Button.addEventListener("click",
                function ()
                {
                    var Divs = document.getElementsByTagName("div");
                    for (j in Divs)
                    {
                        var Div = Divs[j];
                        if (Div.style.zIndex > 9999) Div.style.display = "none";
                    }
                    ElementShow(this.id.replace("Index", ""), window.mouseX + 20, window.mouseY - 30);
                }, false);
            ++c;
        }
    }
}
catch (ex) {}
// #endregion // User Menu

// #region ========== Album Image Getter ==========
try
{
    if (IsPage(URLAlbumZoom))
    {
        var Container = document.getElementById("enable_link").parentNode;
        var Sep = document.createTextNode(" | ");
        Container.appendChild(Sep);
        
        var GetImage = document.createElement("a");
        GetImage.id = "GetImage";
        GetImage.innerHTML = LanguageGetGetImage();
        GetImage.target = "_blank";
        GetImage.addEventListener("mouseover",
            function ()
            {
                var Img = document.getElementById("enable_link").parentNode.parentNode.parentNode;
                Img = Img.getElementsByTagName("img")[0];
                this.href = Img.src;
            }, false);
        
        Container.appendChild(GetImage);
    }
}
catch (ex) {}
// #endregion // Album Image Getter




// #region ========== Page Titles ==========
//var ContainerTitle = window;
//while (ContainerTitle.parentNode) { ContainerTitle = ContainerTitle.parentNode; }

//if (IsPage(URLHome)) ContainerTitle.document.title = "orkut - Home";
/*
var URLHome = "/Home";
var URLScrap = "/Scrapbook";
var URLPost = "/CommMsgPost?";
var URLMessages  = "/CommMsgs";
var URLOwnMessages  = "/Messages";
var URLSettings  = "/GeneralSettings";
var URLVideos  = "/FavoriteVideos";
var URLTestimonials  = "/ProfileT";
var URLEvents  = "/Events";
var URLSpam  = "/UserSpamFolder";
var URLUpdates  = "/Notifications";
var URLLists  = "/Marks";
var URLMyApp  = "/MyApps";
var URLAppDir  = "/AppDirectory";
var URLCmm = "/Communities";
var URLCmmMain = "/Community";
var URLCmmTopics = "/CommTopics";

var URLAlbum = "/Album";
var URLAlbumZoom = "/AlbumZoom";
var URLAlbumList = "/AlbumList";

var URLOMConfig = "/OMConfig";
var URLOMConfigSave = "/OMConfigSave"
var URLOMConfigMenu = "/OMConfigMenu";
var URLOMConfigMenuSave = "/OMConfigMenuSave";
var URLOMHelp = "/OMHelp";
var URLOMCredits = "/OMCredits";
*/
// #endregion


// #region CONFIGURATION
// #region ========== Menu ==========
try
{
    var Table = document.getElementById("lbox");
    Table = Table.getElementsByTagName("table")[0];
    
    var Tr = Table.insertRow(2);
    var Td = Tr.insertCell(0);
    var Tdr= Tr.insertCell(1);
    Tdr.className = "boxmidr";
    Td.className = "boxmid";
    
    var sep = "<div class='userinfodivi'></div>";
    Td.innerHTML = sep + "<div style='color:#F7021F; text-align: center'>Orkut Manager  Plus</div>" + sep +
        "<div id='MenuButtons' style='text-align: center'></div>";
    var MenuButtonConfig = ButtonCreate(LanguageGetButtonConfig(), function () { window.location.href = URLOMConfig; }, "click");
    var MenuButtonConfigMenus = ButtonCreate(LanguageGetButtonConfigMenu(), function () { window.location.href = URLOMConfigMenu; }, "click");
    var MenuButtonCredits = ButtonCreate(LanguageGetButtonCredits(), function () { window.location.href = URLOMCredits; }, "click");
    var MenuButtonHelp = ButtonCreate(LanguageGetButtonHelp(), function () { window.location.href = URLOMHelp; }, "click");
    
    var ContainerMenuButtons = document.getElementById("MenuButtons");
    ContainerMenuButtons.appendChild(MenuButtonConfig);
    ContainerMenuButtons.appendChild(MenuButtonConfigMenus);
    ContainerMenuButtons.appendChild(MenuButtonCredits);
    ContainerMenuButtons.appendChild(MenuButtonHelp);
}
catch (ex) {}
// #endregion // Menu
// #region ========== Configuration Page ==========
var ConfigRowColor = new Array("#F43009", "#F43009");
var ConfigColorAlt = 1;
function ConfigLabelColorSwap()
{
    if (ConfigColorAlt == 0) ConfigColorAlt = 1;
    else ConfigColorAlt = 0;
    return ConfigRowColor[ConfigColorAlt];
}
try
{
    if (IsPage(URLOMConfig) && !IsPage("Menu"))
    {
        var PageConfigurationHeader = '<table cellspacing="0" cellpadding="0" border="0" style="margin-bottom: 0px; width: 100%;" class="module"><tbody><tr><td class="topl_lrg"> <h1>' + LanguageGetConfigurationPageTitle() + '</h1> <p class="breadcrumb"> <a href="/Main#Home">Home</a> > <span id="breadcumb_tail">OM ' + LanguageGetConfigurationPageTitle() + '</span> </p> </td><td class="topr_lrg"/></tr></tbody></table>';
        
        var PageConfigurationContainer = '<table cellspacing="0" cellpadding="0" border="0" style="overflow: hidden;" class="module"><tbody><tr><td class="boxmidlrg"> $CONTROLS$ </td><td class="boxmidr"/></tr> <tr><td class="botl"/><td class="botr"/></tr></tbody></table>';

        var Global = "<fieldset><legend style='font-weight: bold'>" + LanguageGetConfigurationPageTitle() + "</legend>$CONTROLS$ <div id='ButtonControl'></div></fieldset>";
        PageConfigurationContainer = PageConfigurationContainer.replace("$CONTROLS$", Global);
        
        var LabelSize = "14%";
        var ConfigNewLine = "<br style='margin-bottom: 8px' />";
        var ConfigHrNormal= "<hr /><b>Normal</b>";
        var ConfigHrHtml  = "<hr /><b>Html</b>";
        var ConfigHrScrap = "<hr /><b>Scrap</b>";
        
        // Language
        var Panel, Prefix, Sufix;
        Panel = "<fieldset style='background-color: " + ConfigLabelColorSwap() + "'><legend style='font-weight: bold'>" + LanguageGetConfigurationLanguage() + "</legend>$CONTROLS$</fieldset>";
        Prefix = "<div style='width: " + LabelSize + "; float: left;'>" + LanguageGetConfigurationLanguage() + ":</div> <select id='Language'>" +
        "<option " + (Language == "english" ? "selected" : "") + ">English</option>" +
        "<option " + (Language == "portuguese" ? "selected" : "") + ">Portuguese</option>" +
        "<option " + (Language == "french" ? "selected" : "") + ">French</option>" +
        "<option " + (Language == "italian" ? "selected" : "") + ">Italian</option>" +
        "<option " + (Language == "spanish" ? "selected" : "") + ">Spanish</option>" +
        "</select>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "");
        PageConfigurationContainer = PageConfigurationContainer.replace("$CONTROLS$", Panel + "$CONTROLS$");
        
        // TextAreaTextBegin & TextAreaTextEnd
        Panel = "<fieldset style='background-color: " + ConfigLabelColorSwap() + "'><legend style='font-weight: bold'>Default text</legend>$CONTROLS$</fieldset>";
        Prefix = "<div style='width: " + LabelSize + "; float: left;'>" + LanguageGetConfigurationPrefix() + ":</div> <textarea value='' id='TextAreaTextBegin' style='width: 80%'></textarea>";
        Sufix  = ConfigNewLine +
            "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationSufix() + ":</div> <textarea value='' id='TextAreaTextEnd' style='width: 80%'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "$CONTROLS$");
        
        // TextAreaTextHtmlBegin & TextAreaTextHtmlEnd
        Prefix = ConfigNewLine + ConfigHrHtml + ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationPrefix() + ":</div>" +
            "<textarea value='' id='TextAreaTextHtmlBegin' style='width: 80%'></textarea>";
        Sufix  = ConfigNewLine +
            "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationSufix() + ":</div>" +
            "<textarea value='' id='TextAreaTextHtmlEnd' style='width: 80%'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "$CONTROLS$");
        
        // TextAreaScrapTextBegin & TextAreaScrapTextEnd
        Prefix = ConfigNewLine + ConfigHrScrap + ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationPrefix() + ":</div>" +
            "<textarea value='' id='TextAreaScrapTextBegin' style='width: 80%'></textarea>";
        Sufix  = ConfigNewLine +
            "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationSufix() + ":</div>" +
            "<textarea value='' id='TextAreaScrapTextEnd' style='width: 80%'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "");
        
        PageConfigurationContainer = PageConfigurationContainer.replace("$CONTROLS$", Panel + "$CONTROLS$");

        // Quote Header Text
        Panel = "<fieldset style='background-color: " + ConfigLabelColorSwap() + "'><legend style='font-weight: bold'>Quote</legend>$CONTROLS$</fieldset>";
        Prefix = "<div style='width: " + LabelSize + "; float: left' title='Use $USER$ and $TIME$ to set its place'>" + LanguageGetConfigurationHeader() + " " + LanguageGetConfigurationText() + ":</div>" +
            "<textarea value='' id='QuoteHeaderText' style='width: 80%'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        
        // Quote
        Prefix = ConfigNewLine + ConfigHrNormal + ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationHeader() + " " + LanguageGetConfigurationPrefix() + ":</div>" +
            "<textarea value='' id='QuoteHeaderBegin' style='width: 80%'></textarea>";
        Sufix  = ConfigNewLine +
            "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationHeader() + " " + LanguageGetConfigurationSufix() + ":</div>" +
            "<textarea value='' id='QuoteHeaderEnd' style='width: 80%'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "$CONTROLS$");
        
        Prefix = ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>Msg " + LanguageGetConfigurationPrefix() + ":</div>" +
            "<textarea value='' id='QuoteBegin' style='width: 80%'></textarea>";
        Sufix  = ConfigNewLine +
            "<div style='width: " + LabelSize + "; float: left'>Msg " + LanguageGetConfigurationSufix() + ":</div>" +
            "<textarea value='' id='QuoteEnd' style='width: 80%'></textarea>";
        
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "$CONTROLS$");

        // Quote HTML
        Prefix = ConfigNewLine + ConfigHrHtml + ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>Header " + LanguageGetConfigurationPrefix() + ":</div>" +
            "<textarea value='' id='QuoteHeaderHtmlBegin' style='width: 80%'></textarea>";
        Sufix  = ConfigNewLine + 
            "<div style='width: " + LabelSize + "; float: left'>Header " + LanguageGetConfigurationSufix() + ":</div>" +
            "<textarea value='' id='QuoteHeaderHtmlEnd' style='width: 80%'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "$CONTROLS$");
        
        Prefix = ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>Msg " + LanguageGetConfigurationPrefix() + ":</div>" +
            "<textarea value='' id='QuoteHtmlBegin' style='width: 80%'></textarea>";
        Sufix  = ConfigNewLine +
            "<div style='width: " + LabelSize + "; float: left'>Msg " + LanguageGetConfigurationSufix() + ":</div>" +
            "<textarea value='' id='QuoteHtmlEnd' style='width: 80%'></textarea>";
        
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "");
        PageConfigurationContainer = PageConfigurationContainer.replace("$CONTROLS$", Panel + "$CONTROLS$");

        // Signature
        Panel = "<fieldset style='background-color: " + ConfigLabelColorSwap() + "'><legend style='font-weight: bold'>" + LanguageGetConfigurationSignature() + "</legend>$CONTROLS$</fieldset>";
        Prefix = "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationSignature() + ":</div>" +
            "<textarea id='Signature' style='width: 80%; height: 100px;'></textarea>";
        Sufix  = ConfigNewLine + ConfigHrHtml + ConfigNewLine + 
            "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationSignature() + ":</div>" +
            "<textarea id='SignatureHtml' style='width: 80%; height: 100px;'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "$CONTROLS$");
        
        Prefix = ConfigNewLine + ConfigHrScrap + ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationSignature() + ":</div>" +
            "<textarea id='SignatureScrap' style='width: 80%; height: 100px;'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "");
        
        PageConfigurationContainer = PageConfigurationContainer.replace("$CONTROLS$", Panel + "$CONTROLS$");

        // Moderation
        Panel = "<fieldset style='background-color: " + ConfigLabelColorSwap() + "'><legend style='font-weight: bold'>" + LanguageGetConfigurationModeration() + "</legend>$CONTROLS$</fieldset>";
        Prefix = "<div style='width: " + LabelSize + "; float: left'>(" + LanguageGetConfigurationTopic() + ") " + LanguageGetConfigurationText() + ":</div>" +
            "<textarea id='ModerationText' style='width: 80%; height: 100px;'></textarea>";
        Sufix  = ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>(" + LanguageGetConfigurationMember() + ") " + LanguageGetConfigurationText() + ":</div>" +
            "<textarea id='ModerationMemberText' style='width: 80%; height: 100px;'></textarea>";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "$CONTROLS$");
        
        Prefix = ConfigNewLine + ConfigHrHtml + ConfigNewLine +
            "<div style='width: " + LabelSize + "; float: left'>(" + LanguageGetConfigurationTopic() + ") " + LanguageGetConfigurationText() + ":</div>" +
            "<textarea id='ModerationHtmlText' style='width: 80%; height: 100px;'></textarea>";
        Sufix = ConfigNewLine + "<div style='width: " + LabelSize + "; float: left'>(" + LanguageGetConfigurationMember() + ") " + LanguageGetConfigurationText() + ":</div>" +
            "<textarea id='ModerationMemberHtmlText' style='width: 80%; height: 100px;'></textarea>";
        
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "");
        PageConfigurationContainer = PageConfigurationContainer.replace("$CONTROLS$", Panel + "$CONTROLS$");
        
        // Script Update (UpdateWarningType)
        Panel = "<a name='Update'></a><fieldset style='background-color: " + ConfigLabelColorSwap() + "'><legend style='font-weight: bold'>Script Update</legend>$CONTROLS$</fieldset>";
        Prefix = "<div style='width: " + LabelSize + "; float: left'>" + LanguageGetConfigurationUpdateLabel() + "</div>" +
            "<div style='margin-left: 150px;'>" +
            "<label>" +
            "<input type='radio' name='UpdateWarningType' id='UpdateWarningType2' /> " + LanguageGetConfigurationUpdateBugfix() + "<br />" +
            "</label>" +
            "<label>" +
            "<input type='radio' name='UpdateWarningType' id='UpdateWarningType1' /> " + LanguageGetConfigurationUpdateMinor() + "<br />" +
            "</label>" +
            "<label>" +
            "<input type='radio' name='UpdateWarningType' id='UpdateWarningType0' /> " + LanguageGetConfigurationUpdateMajor() + "<br />" +
            "</label>" +
            "<label>" +
            "<input type='radio' name='UpdateWarningType' id='UpdateWarningType_1' /> " + LanguageGetConfigurationUpdateNone() + "<br />" +
            "</label></div>";
        Sufix  = "";
        Panel = Panel.replace("$CONTROLS$", Prefix + "$CONTROLS$");
        Panel = Panel.replace("$CONTROLS$", Sufix + "");
        PageConfigurationContainer = PageConfigurationContainer.replace("$CONTROLS$", Panel + "");

        document.getElementById("mboxfullr").innerHTML = PageConfigurationHeader +
            PageConfigurationContainer;

        // Buttons control
        function ConfigSave(Get)
        {
            var Language = "&Language=" + document.getElementById("Language").value;

            var TextAreaTextBegin = "&TextAreaTextBegin=" + escape(document.getElementById("TextAreaTextBegin").value);
            var TextAreaTextEnd = "&TextAreaTextEnd=" + escape(document.getElementById("TextAreaTextEnd").value);
            var TextAreaTextHtmlBegin = "&TextAreaTextHtmlBegin=" + escape(document.getElementById("TextAreaTextHtmlBegin").value);
            var TextAreaTextHtmlEnd = "&TextAreaTextHtmlEnd=" + escape(document.getElementById("TextAreaTextHtmlEnd").value);
            var TextAreaScrapTextBegin = "&TextAreaScrapTextBegin=" + escape(document.getElementById("TextAreaScrapTextBegin").value);
            var TextAreaScrapTextEnd = "&TextAreaScrapTextEnd=" + escape(document.getElementById("TextAreaScrapTextEnd").value);
            
            var QuoteHeaderText = "&QuoteHeaderText=" + escape(document.getElementById("QuoteHeaderText").value);
            
            var QuoteBegin = "&QuoteBegin=" + escape(document.getElementById("QuoteBegin").value);
            var QuoteEnd = "&QuoteEnd=" + escape(document.getElementById("QuoteEnd").value);
            var QuoteHeaderBegin = "&QuoteHeaderBegin=" + escape(document.getElementById("QuoteHeaderBegin").value);
            var QuoteHeaderEnd = "&QuoteHeaderEnd=" + escape(document.getElementById("QuoteHeaderEnd").value);
            
            var QuoteHtmlBegin = "&QuoteHtmlBegin=" + escape(document.getElementById("QuoteHtmlBegin").value);
            var QuoteHtmlEnd = "&QuoteHtmlEnd=" + escape(document.getElementById("QuoteHtmlEnd").value);
            var QuoteHeaderHtmlBegin = "&QuoteHeaderHtmlBegin=" + escape(document.getElementById("QuoteHeaderHtmlBegin").value);
            var QuoteHeaderHtmlEnd = "&QuoteHeaderHtmlEnd=" + escape(document.getElementById("QuoteHeaderHtmlEnd").value);
            
            var Signature = "&Signature=" + escape(document.getElementById("Signature").value);
            var SignatureHtml = "&SignatureHtml=" + escape(document.getElementById("SignatureHtml").value);
            var SignatureScrap = "&SignatureScrap=" + escape(document.getElementById("SignatureScrap").value);
            
            var ModerationText = "&ModerationText=" + escape(document.getElementById("ModerationText").value);
            var ModerationHtmlText = "&ModerationHtmlText=" + escape(document.getElementById("ModerationHtmlText").value);
            var ModerationMemberText = "&ModerationMemberText=" + escape(document.getElementById("ModerationMemberText").value);
            var ModerationMemberHtmlText = "&ModerationMemberHtmlText=" + escape(document.getElementById("ModerationMemberHtmlText").value);
            
            var UpdateWarningType = -1;
            UpdateWarningType = document.getElementById("UpdateWarningType0").checked ? 0 : UpdateWarningType;
            UpdateWarningType = document.getElementById("UpdateWarningType1").checked ? 1 : UpdateWarningType;
            UpdateWarningType = document.getElementById("UpdateWarningType2").checked ? 2 : UpdateWarningType;
            UpdateWarningType = "&UpdateWarningType=" + UpdateWarningType;
            
            var URLToSave = Language +
                TextAreaTextBegin + TextAreaTextEnd +
                TextAreaTextHtmlBegin + TextAreaTextHtmlEnd +
                TextAreaScrapTextBegin + TextAreaScrapTextEnd +
                QuoteHeaderText +
                QuoteBegin + QuoteEnd +
                QuoteHeaderBegin + QuoteHeaderEnd +
                QuoteHtmlBegin + QuoteHtmlEnd +
                QuoteHeaderHtmlBegin + QuoteHeaderHtmlEnd +
                Signature + SignatureHtml + SignatureScrap +
                ModerationText + ModerationHtmlText +
                ModerationMemberText + ModerationMemberHtmlText +
                UpdateWarningType;
            
            if (Get == true) return URLToSave;
            
            ConfigurationSave(URLToSave, true);
        }
        var SaveFunction = ConfigSave;
        
        var Default = ButtonCreate(LanguageGetButtonDefault(),
            function ()
            {
                var ok = confirm(LanguageGetConfigurationResetSettings());
                if (!ok) return;
                ConfigurationSave(DefaultCfg, true);
                window.location.reload();
            }, "click");
        Default.style.cssFloat = "right";
        var Export = ButtonCreate(LanguageGetButtonExport(), function () { prompt(LanguageGetConfigurationExport(), ConfigSave(true)); }, "click");
        Export.style.cssFloat = "right";
        var Import = ButtonCreate(LanguageGetButtonImport(), function () { var u = prompt(LanguageGetConfigurationImport()); if (!u) return; ConfigurationSave(u, true); window.location.reload(); }, "click");
        Import.style.cssFloat = "right";
        var Save = ButtonCreate(LanguageGetButtonSave(), SaveFunction, "click");
        Save.style.cssFloat = "right";
        var Cancel = ButtonCreate(LanguageGetButtonCancel(), function () { history.go(-1); }, "click");
        Cancel.style.cssFloat = "right";
        
        document.getElementById("ButtonControl").appendChild(Cancel);
        document.getElementById("ButtonControl").appendChild(Save);
        document.getElementById("ButtonControl").appendChild(Import);
        document.getElementById("ButtonControl").appendChild(Export);
        document.getElementById("ButtonControl").appendChild(Default);

        // Set values
        // Textarea
        document.getElementById("TextAreaTextBegin").value = TextAreaTextBegin;
        document.getElementById("TextAreaTextEnd").value = TextAreaTextEnd;
        document.getElementById("TextAreaTextHtmlBegin").value = TextAreaTextHtmlBegin;
        document.getElementById("TextAreaTextHtmlEnd").value = TextAreaTextHtmlEnd;
        document.getElementById("TextAreaScrapTextBegin").value = TextAreaScrapTextBegin;
        document.getElementById("TextAreaScrapTextEnd").value = TextAreaScrapTextEnd;
        
        // Quote Header Text
        document.getElementById("QuoteHeaderText").value = QuoteHeaderText;
        // Quote
        document.getElementById("QuoteBegin").value = QuoteBegin;
        document.getElementById("QuoteEnd").value = QuoteEnd;
        document.getElementById("QuoteHeaderBegin").value = QuoteHeaderBegin;
        document.getElementById("QuoteHeaderEnd").value = QuoteHeaderEnd;
        // Quote HTML
        document.getElementById("QuoteHtmlBegin").value = QuoteHtmlBegin;
        document.getElementById("QuoteHtmlEnd").value = QuoteHtmlEnd;
        document.getElementById("QuoteHeaderHtmlBegin").value = QuoteHeaderHtmlBegin;
        document.getElementById("QuoteHeaderHtmlEnd").value = QuoteHeaderHtmlEnd;
        
        // Signature
        document.getElementById("Signature").value = Signature;
        document.getElementById("SignatureHtml").value = SignatureHtml;
        document.getElementById("SignatureScrap").value = SignatureScrap;
        
        // Moderation
        document.getElementById("ModerationText").value = ModerationText;
        document.getElementById("ModerationHtmlText").value = ModerationHtmlText;
        document.getElementById("ModerationMemberText").value = ModerationMemberText;
        document.getElementById("ModerationMemberHtmlText").value = ModerationMemberHtmlText;
        
        // Script Update
        document.getElementById("UpdateWarningType0").checked = UpdateWarningType == 0;
        document.getElementById("UpdateWarningType1").checked = UpdateWarningType == 1;
        document.getElementById("UpdateWarningType2").checked = UpdateWarningType == 2;
        document.getElementById("UpdateWarningType_1").checked = UpdateWarningType == -1;
    }
}
catch (ex) {}
// #endregion // Configuration Page
// #endregion

// #region ========== Configuration Menu Page ==========
try
{
    if (IsPage(URLOMConfigMenu))
    {
        var FieldSetIndex = 0;
        var HeaderMenuRowIndex = 0;
        var MenuRowIndex = 0;
    
        var Container = GetErrorPageContainer();
        Container.innerHTML = "";
        
        function ConfigurationHeaderMenuRowNew(LinkValue, TextValue)
        {
            var Row = document.createElement("div");
            var Label = HeaderMenuGetLabel();
            var Values = HeaderMenuGetValue(Label.style.width);
            var Link = document.createElement("input");
            var Text = document.createElement("input");
            var Del = document.createElement("input");
            
            Row.id = "OMConfigHeaderMenuRow" + HeaderMenuRowIndex;
            Row.style.padding = "3px";
            Label.appendChild(document.createTextNode("Menu #" + HeaderMenuRowIndex));
            Link.id = "OMHeaderLink" + HeaderMenuRowIndex;
            if (LinkValue) Link.value = LinkValue;
            Link.type = "text";
            Link.style.width = "350px";
            Text.id = "OMHeaderText" + HeaderMenuRowIndex;
            if (TextValue) Text.value = TextValue;
            Text.type = "text";
            Text.style.width = "200px";
            Del.id = "OMHeaderDel" + HeaderMenuRowIndex;
            Del.type= "checkbox";
            
            Values.appendChild(document.createTextNode("Link "));
            Values.appendChild(Link);
            Values.appendChild(document.createTextNode(" "));
            Values.appendChild(document.createTextNode("Menu "));
            Values.appendChild(Text);
            Values.appendChild(document.createTextNode(" "));
            Values.appendChild(Del);
            Values.appendChild(document.createTextNode(" " + LanguageGetDelete() + " "));
            
            Row.appendChild(Label);
            Row.appendChild(Values);
            
            ++HeaderMenuRowIndex;
            
            return Row;
        }
        
        function ConfigurationHeaderMenuRowDelLast()
        {
            var Container = document.getElementById("FS0");
            var Remove = Container.lastChild.previousSibling.previousSibling;
            if (Remove.tagName.toLowerCase() != "div") return;
            Container.removeChild(Remove);
            --HeaderMenuRowIndex;
        }
        
        // Setup fieldset
        var FSHeaderMenu = document.createElement("fieldset");
        var LGHeaderMenu = document.createElement("legend");
        FSHeaderMenu.id = "FS" + FieldSetIndex;
        FSHeaderMenu.style.backgroundColor = ConfigLabelColorSwap();
        LGHeaderMenu.style.fontWeight = "bold";
        LGHeaderMenu.innerHTML = LanguageGetConfigMenuHeaderMenu();
        FSHeaderMenu.appendChild(LGHeaderMenu);
        Container.appendChild(FSHeaderMenu);
        ++FieldSetIndex;

        // Controls
        function HeaderMenuGetLabel()
        {
            var Label = document.createElement("div");
            Label.style.cssFloat   = "left";
            Label.style.width      = "190px";
            Label.style.fontWeight = "bold";
            return Label;
        }
        function HeaderMenuGetValue(width)
        {
            var Values = document.createElement("div");
            Values.style.marginLeft = width;
            return Values;
        }
        
        // Clear header control
        var HeaderMenuClearControl = document.createElement("input");
        if (GMGetValue("HeaderMenuClear")) HeaderMenuClearControl.checked = true;
        HeaderMenuClearControl.style.cursor = "pointer";
        HeaderMenuClearControl.type = "checkbox";
        HeaderMenuClearControl.addEventListener("click",
            function ()
            {
                if (this.checked) GMSetValue("HeaderMenuClear", "true");
                else GMSetValue("HeaderMenuClear", "");
            }, false);
        var HeaderMenuClearControlLabel = document.createElement("label");
        HeaderMenuClearControlLabel.style.cursor = "pointer";
        HeaderMenuClearControlLabel.appendChild(HeaderMenuClearControl);
        HeaderMenuClearControlLabel.appendChild(document.createTextNode(" "));
        HeaderMenuClearControlLabel.appendChild(document.createTextNode("Clear header links"));
        var ClearContainer = document.createElement("span");
        var Label = HeaderMenuGetLabel();
        var Values= HeaderMenuGetValue(Label.style.width);
        
        Label.appendChild(document.createTextNode("Clear header links"));
        Values.appendChild(HeaderMenuClearControlLabel);
        
        ClearContainer.appendChild(Label);
        ClearContainer.appendChild(Values);
        FSHeaderMenu.appendChild(ClearContainer);
        
        // Load Menus
        var Menus = GMGetValue("HeaderMenu").split("][");
        for (i in Menus)
        {
            var Menu = Menus[i];
            Menu = Menu.replace(/\[|\]/g, "");
            var L = (Menu.split("|"))[0];
            var T = (Menu.split("|"))[1];
            FSHeaderMenu.appendChild(ConfigurationHeaderMenuRowNew(L, T));
        }
        FSHeaderMenu.appendChild(ConfigurationHeaderMenuRowNew());
        
        // New Row Add Button
        var AddNewRow = ButtonCreate(LanguageGetConfigMenuNewRow(),
            function ()
            {
                var Container = document.getElementById("FS0");
                Container.insertBefore(ConfigurationHeaderMenuRowNew(), Container.lastChild.previousSibling);
            }, "click");
        var DelNewRow = ButtonCreate(LanguageGetConfigMenuDelRow(),
            function ()
            {
                ConfigurationHeaderMenuRowDelLast();
            }, "click");
        
        FSHeaderMenu.appendChild(AddNewRow);
        FSHeaderMenu.appendChild(DelNewRow);
        
        // Dropdown Menu
        function ConfigurationMenuRowNew(LinkValue, TextValue)
        {
            var Row = document.createElement("div");
            var Label = HeaderMenuGetLabel();
            var Values = HeaderMenuGetValue(Label.style.width);
            var Link = document.createElement("input");
            var Text = document.createElement("input");
            var Sep = document.createElement("input");
            var Del = document.createElement("input");
            
            Row.id = "OMConfigMenuRow" + MenuRowIndex;
            Row.style.padding = "3px";
            Label.appendChild(document.createTextNode("Menu #" + MenuRowIndex));
            Link.id = "OMMenuLink" + MenuRowIndex;
            if (LinkValue) Link.value = LinkValue;
            Link.type = "text";
            Link.style.width = "350px";
            Text.id = "OMMenuText" + MenuRowIndex;
            if (TextValue) Text.value = TextValue;
            Text.type = "text";
            Text.style.width = "200px";
            Del.id = "OMMenuDel" + MenuRowIndex;
            Del.type = "checkbox";
            
            Sep.value = "--";
            Sep.type = "button";
            Sep.addEventListener("click",
                function ()
                {
                    var Container = this.parentNode;
                    var Text = (Container.getElementsByTagName("input"))[1];
                    var Link = (Container.getElementsByTagName("input"))[0];
                    Text.value = "-";
                    Link.value = "javascript:;";
                }, false);
            
            Values.appendChild(document.createTextNode("Link "));
            Values.appendChild(Link);
            Values.appendChild(document.createTextNode(" "));
            Values.appendChild(document.createTextNode("Menu "));
            Values.appendChild(Text);
            Values.appendChild(document.createTextNode(" "));
            Values.appendChild(Sep);
            Values.appendChild(document.createTextNode(" "));
            Values.appendChild(Del);
            Values.appendChild(document.createTextNode(" Delete "));
            
            Row.appendChild(Label);
            Row.appendChild(Values);
            
            ++MenuRowIndex;
            
            return Row;
        }
        
        function ConfigurationMenuRowDelLast()
        {
            var Container = document.getElementById("FS1");
            var Remove = Container.lastChild.previousSibling.previousSibling;
            if (Remove.tagName.toLowerCase() != "div") return;
            Container.removeChild(Remove);
            --MenuRowIndex;
        }
        
        
        // Setup fieldset
        var FSMenu = document.createElement("fieldset");
        var LGMenu = document.createElement("legend");
        FSMenu.id = "FS" + FieldSetIndex;
        FSMenu.style.backgroundColor = ConfigLabelColorSwap();
        LGMenu.style.fontWeight = "bold";
        LGMenu.innerHTML = LanguageGetConfigMenuDropdown();
        FSMenu.appendChild(LGMenu);
        Container.appendChild(FSMenu);
        ++FieldSetIndex;
        
        // Load Menus
        var Menus = GMGetValue("DropdownMenu").split("][");
        for (i in Menus)
        {
            var Menu = Menus[i];
            Menu = Menu.replace(/\[|\]/g, "");
            var L = (Menu.split("|"))[0];
            var T = (Menu.split("|"))[1];
            FSMenu.appendChild(ConfigurationMenuRowNew(L, T));
        }
        FSMenu.appendChild(ConfigurationMenuRowNew());
        
        // New Row Add Button
        var AddNewRow = ButtonCreate(LanguageGetConfigMenuNewRow(),
            function ()
            {
                var Container = document.getElementById("FS1");
                Container.insertBefore(ConfigurationMenuRowNew(), Container.lastChild.previousSibling);
            }, "click");
        var DelNewRow = ButtonCreate(LanguageGetConfigMenuDelRow(),
            function ()
            {
                ConfigurationMenuRowDelLast();
            }, "click");
        
        FSMenu.appendChild(AddNewRow);
        FSMenu.appendChild(DelNewRow);
        
        
        // Build Controls
        var Controls = document.createElement("div");
        Controls.id = "OMHeaderMenuControls";
        
        function ConfigSave(Get)
        {
            var i = 0;
            
            var URLToSave = "";
            while (document.getElementById("OMConfigHeaderMenuRow" + i))
            {
                var Del = document.getElementById("OMHeaderDel" + i);
                if (Del.checked) { ++i; continue; }
                var Link = document.getElementById("OMHeaderLink" + i);
                var Name = document.getElementById("OMHeaderText" + i);
                if (Link.value.replace(/\s/g, "") == "" ||
                    Name.value.replace(/\s/g, "") == "") { ++i; continue; }
                URLToSave += escape(Link.value) + "&" + escape(Name.value) + "?";
                
                ++i;
            }
            URLToSave = URLToSave.substr(0, URLToSave.length - 1);
            URLToSave += "&&";
            
            i = 0;
            while (document.getElementById("OMConfigMenuRow" + i))
            {
                var Del = document.getElementById("OMMenuDel" + i);
                if (Del.checked) { ++i; continue; }
                var Link = document.getElementById("OMMenuLink" + i);
                var Name = document.getElementById("OMMenuText" + i);
                if (Link.value.replace(/\s/g, "") == "" ||
                    Name.value.replace(/\s/g, "") == "") { ++i; continue; }
                URLToSave += escape(Link.value) + "&" + escape(Name.value) + "?";
                
                ++i;
            }
            URLToSave = URLToSave.substr(0, URLToSave.length - 1);
            
            if (Get == true) return URLToSave;
            
            ConfigurationMenuSave(URLToSave, true);
            
            window.location.reload();
        }
        var Save = ButtonCreate(LanguageGetButtonSave(), function () { ConfigSave(); }, "click");
        Save.style.cssFloat = "right";
        var Cancel = ButtonCreate(LanguageGetButtonCancel(), function () { history.go(-1); }, "click");
        Cancel.style.cssFloat = "right";
        var Default = ButtonCreate(LanguageGetButtonDefault(),
            function ()
            {
                var ok = confirm(LanguageGetConfigurationResetSettings());
                if (!ok) return;
                GMSetValue("HeaderMenuClear", "true");
                ConfigurationMenuSave(DefaultCfgHeaderMenu, true);
                window.location.reload();
            }, "click");
        Default.style.cssFloat = "right";
        var Export = ButtonCreate(LanguageGetButtonExport(), function () { prompt(LanguageGetConfigurationExport(), ConfigSave(true)); }, "click");
        Export.style.cssFloat = "right";
        var Import = ButtonCreate(LanguageGetButtonImport(), function () { var u = prompt(LanguageGetConfigurationImport()); if (!u) return; ConfigurationMenuSave(u, true); window.location.reload(); }, "click");
        Import.style.cssFloat = "right";
        
        Controls.appendChild(Cancel);
        Controls.appendChild(Save);
        Controls.appendChild(Import);
        Controls.appendChild(Export);
        Controls.appendChild(Default);
        
        Container.appendChild(Controls);
    }
}
catch (ex) {}
// #endregion // Help Page

// #region ========== Help Page ==========
try
{
    if (IsPage(URLOMHelp))
    {
        function GetHelp()
        {
            var Container = document.getElementById("mboxfullr").getElementsByTagName("table")[0];
            Container = Container.getElementsByTagName("td");
            var C = "";
            for (i in Container)
            {
                C = Container[i];
                if (C.className == "boxmid") break;
            }
            Container = C;
            var Help =
                "<div style=\"background-color: #F43009; border: 1px solid #FFCC66;\">" +
                "    <h1 style=\"margin: 0px 0px 5px 0px; text-align:center; color: white; background-color: #F43009;\">Help File</h1>" +
                "    <div id=\"OMHelpContent\" style=\"margin: 2px 10px 2px 10px\">" +
                "Feel free to ask questions here: <a href='/Profile?uid=16319692112664226660'>@Profile</a>" +
                " <br /> " +
                "For more help visit: <a    href='http://userscripts.org/scripts/show/33131'>http://userscripts.org/scripts/show/33131</a>" +
                "    </div>" +
                "</div>";
            Container.innerHTML = Help;
        }
        GetHelp();
    }
}
catch (ex) {}
// #endregion // Help Page

// #region ========== Credits Page ==========
try
{
    if (IsPage(URLOMCredits))
    {
        function GetCredits()
        {
            var Container = document.getElementById("mboxfullr").getElementsByTagName("table")[0];
            Container = Container.getElementsByTagName("td");
            var C = "";
            for (i in Container)
            {
                C = Container[i];
                if (C.className == "boxmid") break;
            }
            Container = C;
            var Credits = '<div style="background-color: #000000; border: 1px solid #FFCC66;">' +
                '<div style="text-align: center; background-color: #000000; color: white; padding: 8px; font-size: 20px; font-weight: bold">Credits</div>' +
                    '<div id="OMCreditsContent" style="margin: 2px 10px 2px 10px; color: white; background-color: back; overflow:hidden;">' +
                        '<div id="OMScroll" onmouseover="KScrollStop()" onmouseout="KScrollStart()" style="color: white; text-align: center; min-height: 150px">' +
                            '<br /><br /><br /><br />' +
                            '<div style="color: white; font-size: 18px; font-weight:    bold">Very special thanks to</div>' +
                            '<br />' +
                            '<b>Andrรƒยฉ Steinn <a href="/Main#Profile?uid=979194781819090185">@Profile</a></b>' +
                            '<br />' +
                            '- Orkut Testemonial Toolbar; Album Ads Remover' +
                            '<br />' +
                            '<b>Gautam Coder <a href="/Main#Profile?uid=5131441729967391551">@Profile</a></b>' +
                            '<br />' +
                            '<b>Bruno Leonardo Michels <a href="/Main#Profile?uid=11584069900845257050">@Profile</a></b>' +
                            '<br />' +
                            'Gaurav @Userscripts.org' +
                            '<br />' +
                            'Sharath @Userscripts.org' +
                            '<br />' +
                            'Kim @Userscripts.org' +
                            '<br />' +
                            'Gandra @Userscripts.org' +
                            '<br /><br /><br />' +
                            '<div style="color: white; font-size: 15px; font-weight:    bold">Thanks to supporting communities</div>' +
                            'Orkut Underground - OUG 13 <a href="/Community?cmm=43558952">@Join</a>' +
                            '<br />' +
                            'Kolkata Knight Riders <a href="/Community?cmm=49931298">@Join</a>' +
                            '<br /><br /><br />' +
                        '</div>' +
                    '</div>' +
                '</div>';
            Container.innerHTML = Credits;
            
            // Credits Page Funcionts
            var kScroll;
            function KScrollStart()
            {
                KScrollStop();
                kScroll = setInterval(function () { KScroll(); }, 50);
            }
            function KScrollStop()
            {
                clearInterval(kScroll);
            }
            function KScroll()
            {
                var s = document.getElementById("OMScroll");
                if (!s.style.marginTop) s.style.marginTop = "0px";
                s.style.marginTop = (parseInt(s.style.marginTop) - 1) + "px";
                if ((parseInt(s.style.marginTop) + s.offsetHeight) < 0)
                    s.style.marginTop = (parseInt(s.offsetHeight) - 50) + "px";
            }
            function KScrollSetEventListener()
            {
                var s = document.getElementById("OMScroll");
                s.addEventListener("mouseout", function () { KScrollStart(); }, false);
                s.addEventListener("mouseover", function () { KScrollStop(); }, false);
            }
            function CreditsContentSetHeight()
            {
                var c = document.getElementById("OMCreditsContent");
                c.style.height = document.getElementById("OMScroll").offsetHeight;
            }
            CreditsContentSetHeight();
            KScrollSetEventListener();
            KScrollStart();
        }
        
        GetCredits();
    }
}
catch (ex) {}
// #endregion // Credits Page

// #region ========== OM3 Page ==========
try
{
    if (IsPage("/OM3"))
    {
        function OM3()
        {
            var Container = document.getElementById("mboxfullr").getElementsByTagName("table")[0];
            Container = Container.getElementsByTagName("td");
            var C = "";
            for (i in Container)
            {
                C = Container[i];
                if (C.className == "boxmid") break;
            }
            Container = C;
			
			
			var bks = GMGetValue("Bookmarks").split("][");
			var rawbk = [];
			for each (var bk in bks)
			{
				bk = bk.replace(/\[|\]/g, "");
				var bl = bk.split("|");
				rawbk.push(bl[1] + "|" + bl[0]);
			}
		
			
            var Help =
                "<div style=\"background-color: #FFFDDF; border: 1px solid #FFCC66;\">" +
                "    <h1 style=\"margin: 0px 0px 5px 0px; text-align:center; color: white; background-color: #232323;\">Orkut Manager Plus v3.0</h1>" +
                "    <div id=\"OMHelpContent\" style=\"margin: 2px 10px 2px 10px\">" +
                "Orkut Manager Plus is now an addon, install it!" +
                " <br /> " +
                "<a style='font-size:25px' href='http://addons.mozilla.org/en-US/firefox/addon/46049'>http://addons.mozilla.org/en-US/firefox/addon/46049</a>" +
				"<br /><br />"+//Copy this text to a file and rename it to 'something.om' then import on OM3<br />" +
				"<textarea style='width: 100%; height: 200px; color: silver;display:none' onfocus='this.select()'>"+
				"" +

'["QuoteText,' + escape(GMGetValue("QuoteHeaderText")) + '", "Bookmarks,' + escape(uneval(rawbk)) + '", "Chat.Delay,15", "Language,en-US", "SSignature,%3Cdiv%20style%3D%22font-size%3A90%25%3Bborder-top%3A1px%20solid%20silver%3Bfloat%3Aleft%3Bcolor%3Ablue%22%3EOrkut%20Manager%20user%3C/div%3E", "ModerationT,%5Bb%5DTopic/Poll%3A%5B/b%5D%20%24TITLE%24%0A%5Bb%5DUser%3A%5B/b%5D%20%5Bred%5D%24USER%24%5B/red%5D%20%28%5Bblue%5D%24USERLINK%24%5B/blue%5D%29%0A%5Bb%5DMessage%3A%5B/b%5D%20%24MESSAGE%24%0A%5Bb%5DAction%3A%5B/b%5D%20%0A%5Bb%5DReason%3A%5B/b%5D%20", "TimeFormat,%25H%3A%25i%3A%25s%20%25Y-%25m-%25d", "ModerationOnModDelete,true", "MenuHDClear,true", "QuoteMessageE,%5B/i%5D%5B/blue%5D", "Update.Topics,true", "ModerationOnDeleteModPost,true", "SColorE,", "HQuoteHeaderE,%29%3C/div%3E", "ColorB,", "HColorB,", "Bookmarks.Topic,%5B%2290840394%7E5348193113558541788%7COrkut%2520Manager%7E%255BFIXO%255D%2520Sandbox%22%2C%20%2290840394%7E5347282490297476572%7COrkut%2520Manager%7E%255BFIXO%255D%2520Sugest%25F5es%22%2C%20%2290840394%7E5389229786610066908%7COrkut%2520Manager%7E%255BFIXO%255D%2520Chat%22%2C%20%2290840394%7E5380534849053303493%7COrkut%2520Manager%7E%255BFIXO%255D%2520D%25FAvidas%22%5D", "MemberApprove.Show,false", "HModerationU,%3Cb%3EUser%3A%20%3C/b%3E%20%3Cspan%20style%3D%27color%3Ared%27%3E%24USER%24%3C/span%3E%20%28%3Cspan%20style%3D%27color%3Ablue%27%3E%24USERLINK%24%3C/span%3E%29%0A%3Cb%3EAction%3A%3C/b%3E%20%0A%3Cb%3EReason%3A%3C/b%3E%20", "ShortcutPost,1", "HModerationT,%3Cb%3ETopic/Poll%3A%3C/b%3E%20%24TITLE%24%0A%3Cb%3EUser%3A%3C/b%3E%20%3Cspan%20style%3D%27color%3A%20red%27%3E%24USER%24%3C/span%3E%20%28%3Cspan%20style%3D%27color%3Ablue%27%3E%24USERLINK%24%3C/span%3E%29%0A%3Cb%3EMessage%3A%3C/b%3E%20%24MESSAGE%24%0A%3Cb%3EAction%3A%3C/b%3E%20%0A%3Cb%3EReason%3A%3C/b%3E%20", "Run,true", "Update.Delay,10", "ModerationOnModModConfirm,true", "ModerationOnModDeleteConfirm,true", "SColorB,", "Signature,", "HQuoteMessageB,%3Cdiv%20style%3D%27background%3A%23C8E1FF%3Bborder%3A2px%20LightSkyBlue%20solid%3Bcolor%3Ablack%3Bfont-size%3A90%25%3Bmargin-left%3A20px%3Bmargin-right%3A20px%3Bpadding%3A2px%203px%27%3E", "HSignature,%3Cdiv%20style%3D%22font-size%3A90%25%3Bborder-top%3A1px%20solid%20silver%3Bfloat%3Aleft%3Bcolor%3Ablue%22%3EOrkut%20Manager%20user%3C/div%3E", "HColorE,", "ColorE,", "MenuHD,%5B%22Home%7C/Home%22%2C%20%22Profile%7C/Profile%22%2C%20%22Scrapbook%7C/Scrapbook%22%2C%20%22Communities%7C/Communities%22%2C%20%22Album%7C/AlbumList%22%2C%20%22Videos%7C/FavoriteVideos%22%2C%20%22OM%7C/Community%253Fcmm%253D90840394%22%5D", "HQuoteMessageE,%3C/div%3E", "ToolbarSelCollapsed,true", "ModerationTopic,%5B%5D", "MenuDD,%5B%22%253Cb%253EOrkut%2520Manager%253C/b%253E%7C/Community%253Fcmm%253D90840394%22%2C%20%22-%7Cjavascript%253A%253B%22%2C%20%22Profile%7C/Profile%22%2C%20%22...%2520edit%2520summary%7C/EditSummary%22%2C%20%22...%2520edit%2520social%7C/EditSocial%22%2C%20%22Settings%7C/GeneralSettings%22%2C%20%22...%2520edit%2520privacy%7C/PrivacySettings%22%2C%20%22-%7Cjavascript%253A%253B%22%2C%20%22Search%7C/UniversalSearch%253FsearchFor%253DC%22%2C%20%22-%7Cjavascript%253A%253B%22%2C%20%22Logout%7C/GLogin%253Fcmd%253Dlogout%22%5D", "ModerationOnModUserManage,true", "ModerationU,%5Bb%5DUser%3A%20%5B/b%5D%20%5Bred%5D%24USER%24%5B/red%5D%20%28%5Bblue%5D%24USERLINK%24%5B/blue%5D%29%0A%5Bb%5DAction%3A%5B/b%5D%20%0A%5Bb%5DReason%3A%5B/b%5D%20", "QuoteMessageB,%5Bblue%5D%5Bi%5D", "ScrapCount,1", "QuoteHeaderE,%5B/navy%5D%5Bb%5D%29%5B/b%5D", "Chat,%5B%5D", "HQuoteHeaderB,%3Cdiv%20style%3D%27font-size%3A75%25%27%3EQuote%20%28", "Quote,%5B%5D", "QuoteHeaderB,%5Bb%5DQuote%28%5B/b%5D%5Bnavy%5D", "Update.Communities,true"]'

var DefaultCfg = "&Language=English&TextAreaTextBegin=&TextAreaTextEnd=&TextAreaTextHtmlBegin=&TextAreaTextHtmlEnd=&TextAreaScrapTextBegin=&TextAreaScrapTextEnd=&QuoteHeaderText=%24USER%24%20@%20%24TIME%24&QuoteBegin=%5Bpurple%5D%5Bi%5D&QuoteEnd=%5B/purple%5D%5B/i%5D&QuoteHeaderBegin=%5Bpurple%5D%5Bi%5D&QuoteHeaderEnd=%5B/purple%5D%5B/i%5D&QuoteHtmlBegin=%5B/red%5D%3Cdiv%20style%3D%27background%3A%20%2387CEFA%3B%20border%3A%202px%20%20%231E90FF%20solid%3B%20color%3A%20black%3B%20font-size%3A%2090%25%3B%20margin-left%3A%2020px%20%3B%20margin-right%3A%2020px%3B%20padding%3A%202px%203px%202px%203px%27%3E&QuoteHtmlEnd=%3C/div%3E%5Bnavy%5D%5Bb%5D&QuoteHeaderHtmlBegin=%3Cdiv%20style%3D%27font-size%3A%2075%25%27%3E%5Bred%5D%5Bb%5DQuote%20%28&QuoteHeaderHtmlEnd=%29%3C/div%3E&Signature=&SignatureHtml=&SignatureScrap=&ModerationText=%5Bb%5DTitle%3A%5B/b%5D%20%24TITLE%24%0A%5Bb%5DUser%3A%5B/b%5D%20%5Bred%5D%24USER%24%5B/red%5D%20%28%5Bblue%5D%24USERLINK%24%5B/blue%5D%29%0A%5Bb%5DMessage%3A%5B/b%5D%20%24MESSAGE%24%0A%5Bb%5DAction%3A%5B/b%5D%20%0A%5Bb%5DReason%3A%5B/b%5D&ModerationHtmlText=%3Cb%3ETitle%3A%3C/b%3E%20%24TITLE%24%0A%3Cb%3EUser%3A%3C/b%3E%20%3Cspan%20style%3D%27color%3A%20red%27%3E%24USER%24%3C/span%3E%20%28%3Cspan%20style%3D%27color%3A%20blue%27%3E%24USERLINK%24%3C/span%3E%29%0A%3Cb%3EMessage%3A%3C/b%3E%20%24MESSAGE%24%0A%3Cb%3EAction%3A%3C/b%3E%20%0A%3Cb%3EReason%3A%3C/b%3E&ModerationMemberText=%5Bb%5DUser%3A%20%5B/b%5D%20%5Bred%5D%24USER%24%5B/red%5D%20%28%5Bblue%5D%24USERLINK%24%5B/blue%5D%29%0A%5Bb%5DAction%3A%5B/b%5D%20%0A%5Bb%5DReason%3A%5B/b%5D&ModerationMemberHtmlText=%3Cb%3EUser%3A%20%3C/b%3E%20%3Cspan%20style%3D%27color%3A%20red%27%3E%24USER%24%3C/span%3E%20%28%3Cspan%20style%3D%27color%3A%20blue%27%3E%24USERLINK%24%3C/span%3E%29%0A%3Cb%3EAction%3A%3C/b%3E%20%0A%3Cb%3EReason%3A%3C/b%3E&UpdateWarningType=2";
var DefaultCfgHeaderMenu = "/Main%23Home&Home?/Main%23Profile&Profile?/Scrapbook&Scrapbook?/Main%23ShowFriends&Friends?/Main%23Communities&Communities?/Main%23CommApprove&CommApprove&&Main%23Community%3Fcmm%3D35640847&%3Cspan%20style%3D%22color%3A%20Cyan%3B%22%3EI%20Hate%20Cheating%20%26%20Cheater%3C/span%3E?/Main%23Community%3Fcmm%3D6714254&%3Cspan%20style%3D%22color%3A%20%237FFF00%3B%22%3EChelsea%20Sucks%3C/span%3E?/Main%23Community%3Fcmm%3D43558952&Orkut%20Underground%20-%20OU%ADG%2013?/Main%23Community%3Fcmm%3D49931298&Kolkata%20Knight%20Riders?javascript%3A%3B&-?/Main%23AlbumList&Album?/Main%23FavoriteVideos&Videos?javascript%3A%3B&-?/Main%23GeneralSettings&Edit%20Settings?/Main%23EditSummary&Edit%20Profile?javascript%3A%3B&-?/OMConfig&OM%20Config?/OMConfigMenu&OM%20Menus?/OMCredits&OM%20Credits?/OMHelp&OM%20Help?javascript%3A%3B&-?http%3A//userscripts.org/scripts/show/33131&Script%20Page?javascript%3A%3B&-?/GLogin%3Fcmd%3Dlogout&Logoff";
				
				+"" +
				"</textarea>" +
                "    </div>" +
                "</div>";
            Container.innerHTML = Help;
        }
        OM3();
    }
	
	var ul = document.getElementsByClassName("login")[0];
	var li = document.createElement("li");
	li.innerHTML = "<a style='color:yellow;padding-right:15px;font-weight:bold' href='/OM3'>Download Orkut Manager Plus 3!</a>";
	ul.insertBefore(li, ul.firstChild);
	
	
	var v = GMGetValue("om3");
	if (!v)
	{
		document.getElementById("statusMsg").style.display = "";
		document.getElementById("statusMsgBody").innerHTML = "Orkut Manager Plus v3 is out, Download NOW!<br />ยป <a style='font-size: 120%' href='http://addons.mozilla.org/en-US/firefox/addon/46049'>https://addons.mozilla.org/en-US/firefox/addon/46049</a>";
		GMSetValue("om3", "read");
	}
}
catch (ex) {}
// #endregion // OM3 Page


// #region ================= AUTO UPDATER =================
try
{
    function UpdateGetVersion(response)
    {
        var Version = response.responseText;
        var Temp = document.createElement("div");
        Temp.style.display = "none";
        Temp.innerHTML = Version;

        Version = Version.match(/@version[^\n]+/i)[0];
        Version = Version.replace(/@version\s*/i, "");
        Version = Version.replace(/\s/ig, "");
        
        try
        {
            UpdateShowHasUpdate(Version);
        }
        catch (ex) {}
    }
    
    /// <summary>
    /// Verify updates 0: Major 1: Minor 2: Bugfix -1: none
    /// </summary>
    function UpdateHasUpdate(UpdateVersion)
    {
        UpdateVersion = UpdateVersion.split(".");
        var CurrentVersion = GMGetValue("Version").split(".");
        if (parseInt(UpdateVersion[0]) > parseInt(CurrentVersion[0])) return 0;
        else
        {
            if (parseInt(UpdateVersion[1]) > parseInt(CurrentVersion[1])) return 1;
            else
            {
                if (parseInt(UpdateVersion[2]) > parseInt(CurrentVersion[2])) return 2;
                else return -1;
            }
        }
    }
    
    function UpdateShowHasUpdate(Version)
    {
        if (UpdateHasUpdate(Version) == -1) return;
        if (UpdateWarningType == -1) return;
        var UpdateType;
        var HasUpdate = UpdateHasUpdate(Version);
        switch (HasUpdate)
        {
            case 0:
                UpdateType = "Major";
                break;
            case 1:
                UpdateType = "Minor";
                break;
            case 2:
                UpdateType = "Bugfix";
                break;
        }

        if (UpdateWarningType < HasUpdate) return;
        
        var InsBefore = document.getElementById("container");
        var UpdateBox = document.createElement("div");
        UpdateBox.innerHTML = LanguageGetUpdateNotify(Version, UpdateType);
        UpdateBox.appendChild(ButtonCreate(LanguageGetButtonDownload(), function () { window.open("http://userscripts.org/scripts/show/33131"); }, "click"));
        UpdateBox.appendChild(ButtonCreate(LanguageGetButtonSettings(), function () { window.location.href= "/OMConfig#Update"; }, "click"));
        UpdateBox.style.margin = "0px auto";
        UpdateBox.style.marginBottom = "10px";
        UpdateBox.style.maxWidth = "980px";
        UpdateBox.style.minWidth = "920px";
        UpdateBox.style.textAlign= "left";
        UpdateBox.style.padding = "5px 5px 5px 5px";
        UpdateBox.style.backgroundColor = "#F43009";
        UpdateBox.style.border = "1px solid #FFCF63";
        
        InsBefore.parentNode.insertBefore(UpdateBox, InsBefore);
    }
    
    AjaxRequestExtern("http://userscripts.org/scripts/source/33131.meta.js?", UpdateGetVersion);
}
catch (ex) {}
// #endregion

/*
 * @End Orkut Manager Plus
*/

/*
 * @Start Orkut Context Menu
*/

(function() {
    
    //### SETTINGS
   
    //whether to show profile picture or not
    var showPicture = true;
    var preloadPic = true;
	var domainName = document.URL.split('/')[2];
    
    //tasks to do on profile. ?uid=16319692112664226660 will be append to the url later
	
    var myTasks = Array(
	Array("Profile",
		  "http://img4.orkut.com/img/castro/p_profile.gif",
		  "http://" + domainName + "/Main#Profile?"),
	Array("Scrapbook",
	      "http://img1.orkut.com/img/castro/p_scrap.gif",
	      "http://" + domainName + "/Main#Scrapbook?"),
	Array("Album",
	      "http://img4.orkut.com/img/castro/p_camera.gif",
	      "http://" + domainName + "/Main#AlbumList?"),
	Array("Videos",
		  "http://img3.orkut.com/img/castro/p_video.gif",
		  "http://" + domainName + "/Main#FavoriteVideos?"),
	Array("View Testimonials",
		  "http://img4.orkut.com/img/castro/p_pen.gif",
		  "http://" + domainName + "/Main#ProfileT?"),
	Array("Events",
		  "http://static4.orkut.com/img/castro/events_ico.png",
		  "http://" + domainName + "/Main#Events?"),
	Array("View Friends",
	      "http://img2.orkut.com/img/castro/p_viewfriends.gif",
	      "http://" + domainName + "/Main#FriendsList?"),
	Array("Mutual Friends",
		  "http://img2.orkut.com/img/castro/p_viewfriends.gif",
		  "http://" + domainName + "/Main#MutualFriendsList?"),
	Array("Communities",
		  "http://img1.orkut.com/img/castro/i_comment.png",
		  "http://" + domainName + "/Main#ProfileC?"),
	Array("Write Testimonials",
		  "http://img4.orkut.com/img/castro/p_pen.gif",
		  "http://" + domainName + "/Main#TestimonialWrite?"),
	Array("Ask Friends",
		  "http://img3.orkut.com/img/mobius/i_icon_small_ask.gif",
		  "http://" + domainName + "/Main#Agent?application=mobius&"),
	Array("Updates",
		  "http://static1.orkut.com/img/castro/i_updates.png",
		  "http://" + domainName + "/Main#Notifications?"),
	Array("Send Message",
	      "http://img2.orkut.com/img/castro/p_letter.gif",
	      "http://" + domainName + "/Main#Compose?"),
	Array("Send Teaser",
	      "http://img1.orkut.com/img/castro/p_teaser.gif",
	      "http://" + domainName + "/Main#MsgsTeaser?"),
	Array("Report Abuse",
	      "http://img2.orkut.com/img/castro/p_flagprofile.gif",
	      "http://" + domainName + "/Main#FlagProfile?"),
	Array("Photo Of Him/Her",
	      "http://static4.orkut.com/img/castro/i_phototag.gif",
	      "http://" + domainName + "/Main#PhotoTag?"),
	Array("Scrap All Friends",
	      "http://static4.orkut.com/img/castro/p_app.gif",
	      "http://" + domainName + "/Main#AppInfo?appId=364639177670&"),
	Array("Meri Slambook",
	      "http://static4.orkut.com/img/castro/p_app.gif",
	      "http://" + domainName + "/Main#AppInfo?appId=505516740623&")
	);
    // SETTINGS ###
    
    
    function addGlobalStyle(css) {
	var head, style;
	head = document.getElementsByTagName('head')[0];
	if (!head) { return; }
	style = document.createElement('style');
	style.setAttribute("type","text/css");
	style.innerHTML = css;
	head.appendChild(style);
    }
    addGlobalStyle('div#divProfileTasks { position: absolute; background-color: #F43009; border: 2px solid #A1BBE4; padding: 5px; }');
    //styling function copied from http://diveintogreasemonkey.org/patterns/add-css.html
    
    
    try{
	
	//hide the context menu if something else is clicked
	document.body.addEventListener('click', function(event){
	    var myDiv = document.getElementById('divProfileTasks');
	    if( myDiv )
		myDiv.style.display = "none";
	},true);
	
	//regexp for getting the uid from an url
	var uidRegexp = new RegExp("uid=(\\d+)");
	
	//paths to profile pictures by uid
	var imagens = new Array();
	var preloaderPic = new Array();
	
	//searching through all links
	var anchors = document.getElementsByTagName("a");
	for( i=0; i<anchors.length; i++ ){
	    var href = anchors[i].getAttribute("href");
	    if( href == null || uidRegexp.exec(anchors[i].getAttribute("href")) == null )
		continue; //skip not linked anchors
	    
	    //if( href.match(/^(Profile)|(FriendsNet)/) ){
		if(href.match(/Profile/) && !href.match(/FlagProfile/)) {
		//if it is a profile link
		
		//if pictures are used look for it inside of the link
		// and store the path for its medium-sized image
		if( showPicture == true ){
		    var hasImg = anchors[i].getElementsByTagName("img");
		    if( hasImg.length && hasImg[0].getAttribute("src").match("small") ){
			var uid = uidRegexp.exec(anchors[i].getAttribute("href"));
			uid = uid[1];
			imagens[uid] = hasImg[0].getAttribute("src").replace(/small/,"medium");
			//if preloading is enable we create an element for caching the image
			if( preloadPic == true ){
			    preloaderPic[uid] = document.createElement("img");
			    preloaderPic[uid].src = imagens[uid];
			}
		    }
		}
		
		//add the contextMenu function
		anchors[i].addEventListener('contextmenu', function(event) {
		    //get the uid from the url
		    var uid = uidRegexp.exec(this.href)[1];
		    
		    if( document.getElementById("divProfileTasks") ){
			
				//if the div already exists we just change the links
				var myDiv = document.getElementById("divProfileTasks");
				
				for(i=0;i<myTasks.length;i++){
				    var myTask = document.getElementById("myProfileTask"+i);
				    myTask.href = myTasks[i][2] + "uid=" + uid;
				}
				//also change the profile picture
				if( showPicture == true ){
				    var myProfilePicture = document.getElementById("myProfilePicture");
				    myProfilePicture.style.display = "none";
				    if( imagens[uid] )
					myProfilePicture.src = imagens[uid];
				}
		    }else{
			//if it does not exist yet we create it
			var myDiv = document.createElement("div");
			myDiv.setAttribute("id", "divProfileTasks");
			myDiv.setAttribute("class", "module");
			
			//set the profile picture
			if( showPicture == true ){
			    var myPicDiv = document.createElement("div");
			    myPicDiv.style.textAlign = "center";
			    
			    var myPicture = document.createElement("img");	
			    myPicture.id = "myProfilePicture";
			    myPicture.addEventListener("load",function(event){ this.style.display="block"; }, true);
			    if( imagens[uid] )
				myPicture.src = imagens[uid];
			    myPicture.style.display = "none";
			    myPicture.style.margin = "auto auto";
			    
			    myPicDiv.appendChild(myPicture);
			    myDiv.appendChild(myPicDiv);
			}
			
			//add the task buttons
			for(i=0;i<myTasks.length;i++){
			    var myTask = document.createElement("a");
			    myTask.setAttribute("id", "myProfileTask" + i);
				myTask.setAttribute("href", myTasks[i][2] + "uid=" + uid);
				myTask.setAttribute("class", "userbutton");
				myTask.setAttribute("style", "text-align: left;");
				
			    var myTaskImg = document.createElement("img");
			    myTaskImg.alt = myTasks[i][0];
			    myTaskImg.src = myTasks[i][1];
			    //myTaskImg.addEventListener('mouseover',function(event){ this.src = this.src.replace(/nc_/,"oc_"); },true);
			    //myTaskImg.addEventListener('mouseout',function(event){ this.src = this.src.replace(/oc_/,"nc_"); },true);
			    myTaskImg.border = 0;
			    myTask.appendChild(myTaskImg);
				myTask.appendChild(document.createTextNode(myTasks[i][0]));
			    myDiv.appendChild(myTask);
			    //myDiv.appendChild(document.createElement("br"));
			}
			
			//append the div to the body but does not show it yet, we gotta position it first!
			myDiv.style.display = "none";
			document.body.appendChild(myDiv);
		    }
		    
		    var divProfileTasks = document.getElementById("divProfileTasks");
		    
		    //this positioning algorithm is weird i know. send me something better please :)
		    var scrollTop = document.body.scrollTop ? document.body.scrollTop : document.documentElement.scrollTop;
		    var scrollLeft = document.body.scrollLeft ? document.body.scrollLeft : document.documentElement.scrollLeft;
		    var divLeft = event.clientX + scrollLeft;
		    if( divLeft + 200 > screen.availWidth ){ divLeft = screen.availWidth - 200; }
		    divProfileTasks.style.left = divLeft ;
		    //var divTop = event.clientY + scrollTop;
		    //if( divTop + 200 > screen.availHeight + scrollTop ){ divTop = screen.availHeight - 200; }
		    //divProfileTasks.style.top = divTop ;
		    divProfileTasks.style.top = event.clientY + scrollTop;
		    
		    //now that the div is more or less positioned lets show it
		    divProfileTasks.style.display = "block";
		    
		    //force the stopping of the contextMenu event
		    event.stopPropagation();
		    event.preventDefault();
		    
		}, true); //end the function and close the addEventListener method
		
	    } //if it is a Profile link
	    
	}// for each anchor
	
    }catch(e){
		/*debug any mistake
		  *
		  * Commented as of 29th September.
		  */
		//alert("orkutProfileTasks error: " + e);
    }// try
    
})();

/*
 * @End Orkut Context Menu
*/

// Start Testemonial Toolbar

function GetTextPreview(Prev)
{
	Prev = Prev.replace(/([^>])\r*\n/g, "$1<br />");
	
	Prev = Prev.replace(/\[b\]/ig, "<b>");
	Prev = Prev.replace(/\[\/b\]/ig, "</b>");
	Prev = Prev.replace(/\[i\]/ig, "<i>");
	Prev = Prev.replace(/\[\/i\]/ig, "</i>");
	Prev = Prev.replace(/\[u\]/ig, "<u>");
	Prev = Prev.replace(/\[\/u\]/ig, "</u>");
	
	Prev = Prev.replace(/\[:\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_smile.gif' />");
	Prev = Prev.replace(/\[;\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_wink.gif' />");
	Prev = Prev.replace(/\[:D\]/g, "<img alt='' src='http://img1.orkut.com/img/i_bigsmile.gif' />");
	Prev = Prev.replace(/\[:P\]/g, "<img alt='' src='http://img1.orkut.com/img/i_funny.gif' />");
	Prev = Prev.replace(/\[\/\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_confuse.gif' />");
	Prev = Prev.replace(/\[8\)\]/g, "<img alt='' src='http://img1.orkut.com/img/i_cool.gif' />");
	Prev = Prev.replace(/\[:o\]/g, "<img alt='' src='http://img1.orkut.com/img/i_surprise.gif' />");
	Prev = Prev.replace(/\[:\(\]/g, "<img alt='' src='http://img1.orkut.com/img/i_sad.gif' />");
	Prev = Prev.replace(/\[:x\]/g, "<img alt='' src='http://img1.orkut.com/img/i_angry.gif' />");
	
	Prev = Prev.replace(/\[maroon\]/ig, "<span style='color: maroon'>");
	Prev = Prev.replace(/\[\/maroon\]/ig, "</span>");
	Prev = Prev.replace(/\[red\]/ig, "<span style='color: red'>");
	Prev = Prev.replace(/\[\/red\]/ig, "</span>");
	Prev = Prev.replace(/\[orange\]/ig, "<span style='color: orange'>");
	Prev = Prev.replace(/\[\/orange\]/ig, "</span>");
	Prev = Prev.replace(/\[navy\]/ig, "<span style='color: navy'>");
	Prev = Prev.replace(/\[\/navy\]/ig, "</span>");
	Prev = Prev.replace(/\[blue\]/ig, "<span style='color: blue'>");
	Prev = Prev.replace(/\[\/blue\]/ig, "</span>");
	Prev = Prev.replace(/\[aqua\]/ig, "<span style='color: aqua'>");
	Prev = Prev.replace(/\[\/aqua\]/ig, "</span>");
	Prev = Prev.replace(/\[teal\]/ig, "<span style='color: teal'>");
	Prev = Prev.replace(/\[\/teal\]/ig, "</span>");
	Prev = Prev.replace(/\[green\]/ig, "<span style='color: green'>");
	Prev = Prev.replace(/\[\/green\]/ig, "</span>");
	Prev = Prev.replace(/\[lime\]/ig, "<span style='color: lime'>");
	Prev = Prev.replace(/\[\/lime\]/ig, "</span>");
	Prev = Prev.replace(/\[olive\]/ig, "<span style='color: olive'>");
	Prev = Prev.replace(/\[\/olive\]/ig, "</span>");
	Prev = Prev.replace(/\[gold\]/ig, "<span style='color: gold'>");
	Prev = Prev.replace(/\[\/gold\]/ig, "</span>");
	Prev = Prev.replace(/\[yellow\]/ig, "<span style='color: yellow'>");
	Prev = Prev.replace(/\[\/yellow\]/ig, "</span>");
	Prev = Prev.replace(/\[gray\]/ig, "<span style='color: gray'>");
	Prev = Prev.replace(/\[\/gray\]/ig, "</span>");
	Prev = Prev.replace(/\[silver\]/ig, "<span style='color: silver'>");
	Prev = Prev.replace(/\[\/silver\]/ig, "</span>");
	Prev = Prev.replace(/\[purple\]/ig, "<span style='color: purple'>");
	Prev = Prev.replace(/\[\/purple\]/ig, "</span>");
	Prev = Prev.replace(/\[fuchsia\]/ig, "<span style='color: fuchsia'>");
	Prev = Prev.replace(/\[\/fuchsia\]/ig, "</span>");
	Prev = Prev.replace(/\[violet\]/ig, "<span style='color: violet'>");
	Prev = Prev.replace(/\[\/violet\]/ig, "</span>");
	Prev = Prev.replace(/\[pink\]/ig, "<span style='color: pink'>");
	Prev = Prev.replace(/\[\/pink\]/ig, "</span>");
	
	return Prev;
}

function getlocation()
{
	return location.href.match(/uid=([^&]+)/)[0];
}

var useremail = document.getElementsByClassName("login")[0].getElementsByTagName("b")[0].innerHTML, dt = document.getElementsByClassName("useremail");
	if (dt && dt[0])
	{
		var nc = dt[0].getElementsByTagName("b")[0];
		if (nc)
		useremail = nc.innerHTML;
	}

if(location.href.match("EditSummary"))
{
	GM_deleteValue(useremail + "name");
}
if(location.href.match("TestimonialWrite"))
{
		GM_addStyle(<><![CDATA[
		  .button { cursor: pointer; height: 17px; width: 17px; vertical-align: middle;}
		  #colorpreview {cursor: pointer; position: relative; left: 3px; width: 16px; background-color: navy;}
		  #toolbar { border:1px solid silver; padding: 3px 2px 2px 2px; background-Color: #F43009; }
		  .separator {border-left: 1px solid silver; padding:1px 1px; position: relative; left: 2px; }
		  #countedTextbox {width: 100%;}
		  .listfl { position: relative; right: 40px; width: 20%;}
		  .listp {position: relative; width: 78%; right:40px; }
		  .bar { font-weigth: bold; font-size: 10px; cursor: pointer;}
		  #preview { overflow: hidden; background-Color: #EFF7FF; border: 1px solid silver; margin: 3px 0px 0px 0px;} 
		  ]]></>.toString());
  
			var ContainerToolbar = document.getElementById("countedTextbox");
			setTimeout( function() {ContainerToolbar.style.width = "100%";}, 100)
			var Sep = document.createElement("div");
			Sep.style.lineHeight = "8px";
			var Bar = document.createElement("div");
			Bar.id = "ToolBar";
			Bar.innerHTML =  "<span class='separator'> </span>" + 
							"<span><img class='button' title='bold' id='bold' src='http://i25.tinypic.com/x5s93a.jpg'></img></span>" +
							"<span class='separator'> </span>" + 
							"<span><img class='button' title='italic' id='italic' src='http://i28.tinypic.com/bevl13.gif'></img></span>" + 
							"<span class='separator'> </span>" + 
							"<span><img class='button' title='underline' id='under' src='http://i25.tinypic.com/2ugfo7c.jpg'></img></span>" + 
							"<span class='separator'> </span>" + 
							"<span><img class='button' title='strike' id='strike' src='http://i27.tinypic.com/2im4a9.jpg'></img></span>" + 
							"<span class='separator'> </span>" +
							"<div id='selections'>" + 
								"<span class='separator'> </span>" +
								"<span id='colorpreview' title='navy'>&nbsp;&nbsp;&nbsp;&nbsp;</span>" +
								"&nbsp;&nbsp;<select style='position: relative; left 25px; width: 65px;'>" + 
								"<option selected='' disabled='' lang='navy'>" + LanguageGetColors() + "</option>" +
								"<option lang='maroon' style='background-color: maroon'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='red' style='background-color: red'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='orange' style='background-color: orange'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='navy' style='background-color: navy'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='blue' style='background-color: blue'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='aqua' style='background-color: aqua'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='teal' style='background-color: teal'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='green' style='background-color: green'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='lime' style='background-color: lime'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='olive' style='background-color: olive'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='gold' style='background-color: gold'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='yellow' style='background-color: yellow'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='gray' style='background-color: gray'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='silver' style='background-color: silver'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='purple' style='background-color: purple'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='fuchsia' style='background-color: fuchsia'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='violet' style='background-color: violet'>&nbsp;&nbsp;&nbsp;</option>" +
								"<option lang='pink' style='background-color: pink'>&nbsp;&nbsp;&nbsp;</option>" +
							"</select>" + 
							"</span>" +
							"<span class='separator'> </span>" +
							"<span><img id='imgpreview' src='http://img1.orkut.com/img/i_bigsmile.gif'></img></span>" +
							"<select style='position: relative; left: 5px'>" +
								"<option selected='' disabled='' lang='http://img1.orkut.com/img/i_bigsmile.gif'>Icons</option>" +
								"<option lang='http://img1.orkut.com/img/i_bigsmile.gif' style='background-image: url(http://img1.orkut.com/img/i_bigsmile.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:D</option>" +
								"<option lang='http://img1.orkut.com/img/i_smile.gif' style='background-image: url(http://img1.orkut.com/img/i_smile.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:)</option>" +
								"<option lang='http://img1.orkut.com/img/i_wink.gif' style='background-image: url(http://img1.orkut.com/img/i_wink.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>;)</option>" +
								"<option lang='http://img1.orkut.com/img/i_funny.gif' style='background-image: url(http://img1.orkut.com/img/i_funny.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:P</option>" +
								"<option lang='http://img1.orkut.com/img/i_confuse.gif' style='background-image: url(http://img1.orkut.com/img/i_confuse.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>/)</option>" +
								"<option lang='http://img1.orkut.com/img/i_cool.gif' style='background-image: url(http://img1.orkut.com/img/i_cool.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>8)</option>" + 
								"<option lang='http://img1.orkut.com/img/i_surprise.gif' style='background-image: url(http://img1.orkut.com/img/i_surprise.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:o</option>" +
								"<option lang='http://img1.orkut.com/img/i_sad.gif' style='background-image: url(http://img1.orkut.com/img/i_sad.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>:(</option>" +
								"<option lang='http://img1.orkut.com/img/i_angry.gif' style='background-image: url(http://img1.orkut.com/img/i_angry.gif); background-repeat: no-repeat; background-position: left; padding-left: 20px;'>;x</option>" +
							"</select></span>" +
						"&nbsp;<span class='separator'> </span>" +
						"<span class='bar'><b>MaskLinks</b></span>" +
						"&nbsp;<span class='separator'> </span>";

		var ContainerToolbar = document.getElementById("countedTextbox");
        setTimeout( function() {ContainerToolbar.parentNode.insertBefore(Bar, ContainerToolbar);}, 100);
        setTimeout( function() {ContainerToolbar.parentNode.insertBefore(Sep, ContainerToolbar);}, 100);
		
			function Insert(prefix, sufix) {
			var input = document.getElementById("countedTextbox");
			var start = input.selectionStart;
			var end = input.selectionEnd;
			var insText = input.value.substring(start, end);
			input.value = input.value.substr(0, start) + prefix + insText + sufix + input.value.substr(end);
			var pos;
			if (insText.length == 0)
			{
				pos = start + prefix.length;
			} 
			else 
			{
				pos = start + prefix.length + insText.length + sufix.length;
			}
			input.selectionStart = pos;
			input.selectionEnd = pos;
			input.focus();
			}

			function Masklinks() {
			var input = document.getElementById("countedTextbox");
			input.focus();
			input.value = input.value.replace(/(http:\/)()(\/)/, '$1[b]$2[/b]$3'); 
			input.value = input.value.replace(/(.*?)()(\.)([A-Z]+|[0-9]+)/ig, '$1$3[b]$2[/b]$4');
			}
			
			function InsertFake() {
				var input = document.getElementById("countedTextbox");
				input.focus();
				var start = input.selectionStart;
				var end = input.selectionEnd;
				var insText = input.value.substring(start, end);				
				var i = 0;
				var x = 0;
				var f ='';
				for (i=0;i<insText.length;++i)
				{
					x = insText.charCodeAt(i); 
					f += String.fromCharCode(x) + String.fromCharCode("822");
				}
				input.value = input.value.substr(0, start) + f + input.value.substr(end);
			}
			
			//Real time preview
		    var TextBox = document.getElementById("countedTextbox");
            var TextBoxPreview = document.createElement("div");
            TextBoxPreview.id = "preview";
            TextBox.parentNode.insertBefore(TextBoxPreview, TextBox.nextSibling);
            function Change()
            {
				var Prev = document.getElementById("countedTextbox").value;
				Prev = GetTextPreview(Prev);
				document.getElementById("preview").innerHTML = Prev;
            };
            TextBox.addEventListener("focus", Change, false);
            TextBox.addEventListener("keyup", Change, false);
			var Toolbar = document.getElementById("ToolBar");
			setTimeout( function() {Toolbar.addEventListener("click", Change, false);}, 400);
			
			setTimeout( function() { 
			document.getElementById("bold").addEventListener('click', function(){ Insert('[b]', '[/b]'); }, false);
			document.getElementById("italic").addEventListener('click', function(){ Insert('[i]', '[/i]');}, false);
			document.getElementById("under").addEventListener('click', function(){ Insert('[u]', '[/u]')}, false); 
			document.getElementById("strike").addEventListener('click', function(){ InsertFake()}, false);
			document.getElementById("colorpreview").addEventListener('click', function(){ Insert('[' + this.title + ']', '[/' + this.title + ']'); }, false);
			document.getElementById("selections").getElementsByTagName("select")[0].addEventListener('change', function(){ if((!this.selectedIndex=='0')) document.getElementById('colorpreview').title=this.options[this.selectedIndex].lang; Insert('[' + this.options[this.selectedIndex].lang + ']', '[/' + this.options[this.selectedIndex].lang + ']'); document.getElementById('colorpreview').style.backgroundColor=this.options[this.selectedIndex].lang; this.selectedIndex='0'}, false);
			document.getElementById("selections").getElementsByTagName("select")[0].addEventListener('mouseover', function(){ if((!this.selectedIndex=='0')) document.getElementById('colorpreview').title=this.options[this.selectedIndex].lang; document.getElementById('colorpreview').style.backgroundColor=this.options[this.selectedIndex].lang;}, false);
			document.getElementById("selections").getElementsByTagName("select")[1].addEventListener('change', function(){ if((!this.selectedIndex=='0')) Insert('[' + this.options[this.selectedIndex].value + ']', ''); document.getElementById('imgpreview').src=this.options[this.selectedIndex].lang; this.selectedIndex='0'}, false);
			document.getElementById("selections").getElementsByTagName("select")[1].addEventListener('mouseover', function(){ if((!this.selectedIndex=='0')) document.getElementById('imgpreview').src=this.options[this.selectedIndex].lang;}, false);
			document.getElementById("selections").getElementsByTagName("b")[0].addEventListener('click', function(){Masklinks() }, false);
			}, 400);
		
			function getTextArea()
			{
				textvalue = document.getElementsByName("countedTextbox")[0].value.replace(/ +/g, "+")
				textvalue = textvalue.replace(/<br.*?>/ig, "\n");
				textvalue = textvalue.replace(/\n+/g, "|");
				return textvalue;
			}
			
			var form = document.getElementsByClassName("parabtns")[1];
			var newgrabtn = document.createElement('span');
			newgrabtn.setAttribute('class', 'grabtn');
			newgrabtn.innerHTML='<a class="btn" href="javascript:void(0);">Preview</a>';
			newgrabtn.addEventListener('click', function() {if((document.getElementsByName("countedTextbox")[0].value=="")) alert("TextBox is empty"); else window.open("http://www.orkut.com/Profile?" + getlocation() + "&preview=true&text="+ getTextArea() +"#prap_id3");}, false);
			form.appendChild(newgrabtn);
			
			var newbtnboxr = document.createElement('span');
			newbtnboxr.setAttribute('class', 'btnboxr');
			newbtnboxr.innerHTML='<img width="5" height="1" alt="" src="http://static1.orkut.com/img/b.gif"/>';
			form.appendChild(newbtnboxr);
}

if((GM_getValue(useremail + "firstname")==undefined) || (GM_getValue(useremail + "uid")==undefined) || (GM_getValue(useremail + "name")==undefined) || (GM_getValue(useremail + "img")==undefined))
{
	HttpRequest.open({
	"method":"get",
	"url":"http://www.orkut.com/EditSummary",
	"onsuccess":function(params)
	{
		var firstname = params.response.xml.getElementById("firstName").value;
		GM_setValue(useremail + "firstname", firstname);
		
		var uid1 = params.response.xml.getElementsByClassName("menu")[0].getElementsByTagName("li")[2].getElementsByTagName("a")[0].href;
		var uid = uid1.match(/uid=([^&]+)/)[1];
		GM_setValue(useremail + "uid", uid);
		
		var lastname = params.response.xml.getElementById("lastName").value;
		GM_setValue(useremail + "name", firstname + ' ' + lastname);
		
		var img = params.response.xml.getElementsByClassName("userimg")[0].style.backgroundImage;
		img = img.replace("medium", "small");
		img = img.replace("url(", "");
		img = img.replace(")", "");
		GM_setValue(useremail + "img", img)
	}
	}).send();	
}

	function getText()
	{
		finaltext = location.href.match(/&text=([^&]+)/)[1];
		finaltext = finaltext.replace("#prap_id3", "");
		finaltext = finaltext.replace(/\++/g, "");
		finaltext = finaltext.replace(/&nbsp;/g, "");
		finaltext = GetTextPreview(finaltext);
		finaltext = decodeURIComponent(finaltext);
		finaltext = finaltext.replace(/\|+/g, "<br>");
		return finaltext;
	}
	
if(location.href.match("preview=true"))
{
	if(!location.href.match("ProfileT"))
	{
		if(document.getElementsByName("testimonials").length=="1")
		{
			var testid = document.getElementById("app_content_testimonials").getElementsByClassName("listitem")[0];
			var newtest = document.createElement("div");
			newtest.setAttribute('class', 'listitem');
			newtest.innerHTML='<div style="font-size: 10px; color: pink; font-weight: bold">Preview</div>' +
								'<div class="lf74">' +
								'<a href=/Main#Profile?&uid=' + GM_getValue(useremail + "uid") + '>' + 
								'<img src="' + GM_getValue(useremail + "img") + '"title="' + GM_getValue(useremail + "name") + '"</img>' +
								'</a>' + 
								'</div>' + 
								'<div class="para">' + 
								'<a href="http://www.orkut.com/Main#Profile?&uid="' + GM_getValue(useremail + "uid") + '>' + GM_getValue(useremail + "firstname") + ': </a>' + 
								'' + getText() + '</div>';
								
			testid.parentNode.insertBefore(newtest, testid);
			
			var testid2 = document.getElementById("app_content_testimonials").getElementsByClassName("listitem")[1];
			var newtest2 = document.createElement("div");
			newtest2.setAttribute('class', 'listdivi');
			testid2.parentNode.insertBefore(newtest2, testid2);
		}
		if(document.getElementsByName("testimonials").length=="0")
		{
			var newtestid = document.createElement("div");
			newtestid.setAttribute('id', 'prap_idfake');
			newtestid.innerHTML = '<table class="module" cellspacing="0" cellpadding="0" border="0">' +
									 '<tbody><tr><td class="topl_g">' +
										'<h2>Testemonials</h2>' +
										'</td><td class="topr_g"></td></tr>' +
										'<tr><td class="boxmidlrg">' +
										'<div id="app_content_testimonials">' +
										'<div class="listitem">' +
										'<div style="font-size: 10px; color: pink; font-weight: bold">Preview</div><div class="lf74">' +
										'<a href="Profile?uid=' + GM_getValue(useremail + "uid") + '">' +
										'<img src="' + GM_getValue(useremail + "img") +'" alt="" title="' + GM_getValue(useremail + "name") +'">' +
										'</a>' +
										'</div>' +
										'<div class="para">' +
										'<a href="/Profile?uid=' + GM_getValue(useremail + "uid") + '">' + GM_getValue(useremail + "firstname") + '</a>: ' + getText() +
										'</div>' +
										'</div>' +
										'<div class="listdivi"></div>' +
										'<div class="listdivi ln"></div>' +
										'<div class="parabtns">' +
										'<div class="rf">' +
																				'<a href="http://www.orkut.com/Main#ProfileT?' + getlocation() + '"><div class="lf4"><span class="icon_test" style="width: 14px; height: 14px;"></span></div>View all</a>' +
										'</div>' +
										'</div>' +
										'</td><td class="boxmidr"></td></tr>' +
										'<tr><td class="botl"></td><td class="botr"></td></tr></tbody>';
			
			document.getElementById("mbox").appendChild(newtestid);
		}
	}
}		

// End Testemonial Toolbar

// Auto Spam Checker

var i=0;
function changelinktoimg(){
doc=document;
lnk=doc.links;

for (i=0;i<lnk.length;i++){
getload="document.getElementById('loadi"+i+"')"
this2="document.getElementById('bfimg"+i+"')"

var sb=lnk[i].href.substring(lnk[i].href.length-4,lnk[i].href.length);sb=sb.toLowerCase()
if(sb=='.jpg' || sb=='.gif' || sb=='.png' || sb=='jpeg'){
lnk[i].innerHTML="<b id=loadi"+i+" onclick=\""+this2+".style.display='';"+getload+".style.display='none';return false;\"><font size=1 color=green id=load"+i+"><_O M I_> Carregando Imagem...</font></b><img onError=\"document.links["+i+"].innerHTML='<font size=1 color=red>Link Quebrado/Link para figura</font>'\" oncontextmenu=\"if(aa"+i+"==0){if(imgh"+i+">imgw"+i+"){document.getElementById('bfimg"+i+"').height=imgh"+i+"};if(imgw"+i+">imgh"+i+"){document.getElementById('bfimg"+i+"').width=imgw"+i+"};aa"+i+"=1}else{if(this.height>200 && this.height>=this.width){this.height=200};if(this.width>200 && this.width>=this.height){this.width=200};aa"+i+"=0};return false\" src="+lnk[i].href+" style='display: none' id=bfimg"+i+" border=0 onload=\"aa"+i+"=0;imgh"+i+"=this.height;imgw"+i+"=this.width;if(this.height>200 && this.height>=this.width){this.height=200}else if(this.width>800 && this.width>=this.height){this.width=800;};this.style.display='';"+getload+".style.display='none';\">"
}}
}
changelinktoimg()
function changetags(){
br=document.body.innerHTML
if(br.indexOf("[img]") > -1 && br.indexOf("[/img]") > -1){
br=br.replace(/\[img\]/gi,'');
br=br.replace(/\[\/img\]/gi,'');
document.body.innerHTML = br;
}
}
changetags()


if(document.getElementsByName("scrapsForm")[0].getElementsByTagName("div")[0])
{
	var useremail = document.getElementsByClassName("useremail")[0].getElementsByTagName("b")[0].innerHTML;
	function CheckSpamPage(){
		HttpRequest.open({
		"method":"get",
		"url":"http://www.orkut.com/UserSpamFolder",
		"onsuccess":function(params)
		{
			var value = 0, dt = params.response.xml.getElementsByClassName("displaytable");
			if (dt && dt[0])
			{
			var nc = dt[0].getElementsByClassName("normcheck");
			if (nc)
			value = nc.length;
			}
			if((value=="0")) GM_setValue(useremail + "spam", "0");
			else
			{
				GM_setValue(useremail + "spam", value); 
				document.getElementById("chcknow").innerHTML='Check spam (' + value + ')';
			}
		}
		}).send();

		setTimeout( function(){document.getElementById("chcknow").innerHTML='Check spam (' + GM_getValue(useremail + "spam") + ')';}, 400);
	}
	if(GM_getValue(useremail + "autoStart")) 
	{
		CheckSpamPage();
	}

	var offimg = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%0A%00%00%00%0A%08%06%00%00%00%8D2%CF%BD%00%00%00%09pHYs%00%00%06%9D%00%00%06%9D%01%E8%2F%AE%E6%00%00%00%19tEXtSoftware%00www.inkscape.org%9B%EE%3C%1A%00%00%01%1EIDATx%DAc%C8%9A%3E%9DaNt%B4%C5%1E3%B3%BA%B2%8E%0E%86%C6%9A%1A%96%C6%EAjV%10%7B%B7%85E%FDg%06%86%BF%2F%98%98%BE1%CC%89%8A%F2%BC%26%25u%E0-%1B%DB%9BE%A1%A1%5EU--%0C%20%BC8%24%C4%E7%25'%E7%B3%B7%0C%0C%FF%BF%001%03%D0%A4F%20%E7%C7G%20%E7%1D%23%E3%B7%85aa%9E%20%0Cb%7F%00%8A%BDaf%FE%B2%D6%D33%9D%A1%AC%B3%93aQX%98%D7%3B%26%A6%2F%20%C5%AF%98%99%3F%820X%23Plqh%A8wE%5B%1B%03CSM%0DkUs3H%B1%FB%2Bv%F6%D7o%18%18%FE%800%88%0D%12%039%03%A8%86%85%A1%A9%BA%9A%8D%90%C2%C6%DAZf%B0%D5%40%E3%7DpY%0Dr%2FH1%C3nK%CB%96%97%CC%CC%EF%3F%E0%F0%0C%10%FF%5E%E5%E3%13%CE%F0%19%A4%00%E4%3B6%B6%B7%C8%C1%B304%D4%E3%03P%F1mQ%D1%D3%1333u%18%9E%03%03%13%A8%F8%DFZ%0F%8F%C4%8A%D6V%06P%60%03%03%9D%19%A4x%A5%B7w%20P%91%5C5%D0%0F%00%A3)%ABa)F%FE%AA%00%00%00%00IEND%AEB%60%82";
	var onimg = "data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%0A%00%00%00%0B%08%06%00%00%00Fn%1C%18%00%00%00%09pHYs%00%00%02%00%00%00%02%00%01~~%D3%E3%00%00%00%19tEXtSoftware%00www.inkscape.org%9B%EE%3C%1A%00%00%01%60IDATx%DAchhh%60%00%E1%FA%86z8%0D%C6%F5uL%8D%B5%CD%0C%C9%13%DDB%83g%A9%C72%C0%146%D4%03%15%D5%D7%83q%5D%7D%1DccM%0BC%F8%0C%A3%3A%D7%25%FC%FB%AA%1AK%F9%D1L%01*j%A8ej%02*%CA%EB%8C%D3%B3X%C7%F0)%BD%DF%DF%B3%B9%A6%8D%01lRC%03%C8%94Z%C6%FA%86%3A%B0i%F5u%0D%0C%9E%8B%C56%FB%CF%93%9F%D7X%DB%C4P%DBP%C3%046%01dZc%5D%0BX%11Hw%E2%24%E7h%DB%D5%8C%F7K%5B%B2%C5%1Ak%81%E2%0Du%8C%0C%CD5%9D%0Cuu%F5%0C9%5D%91%86%D5%8D%15%5Ce-%B9%12%B6%AB%18%EE%C7M%B1%C9%00i%AA%05%1B%D4%C0%C0%90%D6%E7%1D%18%3C%5B%7D%B2%CD%1A%86%E7%D9%DDa%C6AsT%A78-%E78_%DDX%CE%06t%02%23%CC%ED%0C%01%F3%E4%FA%EDW1%3CuZ%C1p%CFc1%EFV%DB%D5%0C%CFS%26x%046%D6%B4%82%9C%C5%08%0B%09%86%9A%86*f%EF%85%92%AB%1CW2%3C%B0%5B%CD%F0%D6%7B%A1%D8%9A%DA%FA*%D6%BA%BA%3A%26%A8%E7%C0!%C3%D0%5E1%81!i%A2k%18%D0%A4%0F%CE%CB9%CE%E5w%26j%82%02%1Af%1A8%F8%40%266%D452%947%17%F2%BB%2C%E3Y%9D%D7%15%AD%D1%5C%D3%8Eb%25L1%00ea%AAR%DF%F6%B5%8C%00%00%00%00IEND%AEB%60%82";

	if(!GM_getValue(useremail + 'spam')) 
	{
		CheckSpamPage();
		var pass = true;
		GM_setValue(useremail + "autoStart", false)
	}
	
	var form = document.getElementsByName("scrapsForm")[0].getElementsByTagName("div")[0];
	var newgrabtn = document.createElement('span');
	newgrabtn.setAttribute('class', 'grabtn');
	newgrabtn.innerHTML='<a id="chcknow" class="btn" href="javascript:void(0);">Check spam (' + GM_getValue(useremail + "spam") + ')</a> |<a id="config" href="javascript:void(0);">  >></a>';
	form.appendChild(newgrabtn);
	
	var newbtnboxr = document.createElement('span');
	newbtnboxr.setAttribute('class', 'btnboxr');
	newbtnboxr.innerHTML='<img width="5" height="1" alt="" src="http://static1.orkut.com/img/b.gif"/>';
	form.appendChild(newbtnboxr);

	var newtd = document.createElement('div');
	newtd.setAttribute('style', 'border: 1px silver double; width: 280px; padding: 3px; display: none;');
	newtd.setAttribute('id', 'configSpam');
	newtd.innerHTML= '<img id="imgcheck1" src=' + offimg + '</img><a id="autoStart" href="javascript: void(0);" style="color: red; text-decoration: none;"> Auto check spam (not recomended)</a><br /><a href="/UserSpamFolder?"> - Go to user spam folder</a>';
	form.appendChild(newtd);
	
	if(GM_getValue(useremail + "autoStart"))
	{
		document.getElementById("autoStart").style.color="green";
		document.getElementById("imgcheck1").src=onimg;
	} 
	else 
	{
		document.getElementById("autoStart").style.color="red";
		document.getElementById("imgcheck1").src=offimg;
	}
	document.getElementById("config").addEventListener("click", function () { if (document.getElementById("configSpam").style.display == "none"){document.getElementById("configSpam").style.display = "";} else{    document.getElementById("configSpam").style.display = "none"; }}, false);
	document.getElementById("autoStart").addEventListener("click", 
	function() {
	if(GM_getValue(useremail + "autoStart")) 
	{
		document.getElementById("autoStart").style.color="red";
		document.getElementById("imgcheck1").src=offimg;
		GM_setValue(useremail + "autoStart", false)
	} 
	else 
	{
		document.getElementById("autoStart").style.color="green";
		document.getElementById("imgcheck1").src=onimg;
		GM_setValue(useremail + "autoStart", true)
	} 
	}, false);
	
	document.getElementById("chcknow").addEventListener("click", CheckSpamPage,false);
	
	if(pass)
	{
		document.getElementById("configSpam").style.display="block";
	}
}

// Auto Spam Checker