"undefined"==typeof console&&(console=function(){return this},console.debug=function(a){alert(a)});CHIM=function(){return this};Mudim=function(){return this};Mudim.DISPLAY_ID="mudim-off mudim-vni mudim-telex mudim-viqr mudim-mix mudim-auto".split(" ");Mudim.SPELLCHECK_ID="mudim-checkspell";Mudim.ACCENTRULE_ID="mudim-accentrule";CHIM.CHAR_A="A";CHIM.CHAR_a="a";CHIM.CHAR_E="E";CHIM.CHAR_e="e";CHIM.CHAR_U="U";CHIM.CHAR_u="u";CHIM.CHAR_G="G";CHIM.CHAR_g="g";CHIM.CHAR_Q="Q";CHIM.CHAR_q="q"; CHIM.CHAR_y="y";CHIM.CHAR_Y="Y";CHIM.CHAR_i="i";CHIM.CHAR_I="I";CHIM.CHAR_0x80=String.fromCharCode(128);CHIM.vowels="AIUEOYaiueoy";CHIM.separators=" !@#$%^&*()_+=-{}[]|\\:\";'<>?,./~`\r\n\t";CHIM.off=0;CHIM.buffer=[];CHIM.dirty=!1;CHIM.CharIsUI=function(a){var b,d=CHIM.UI,a=a.charCodeAt(0);for(b=0;0!=d[b]&&d[b]!=a;b++);return 0!=d[b]?b:-1};CHIM.CharIsO=function(a){var b,d=CHIM.O,a=a.charCodeAt(0);for(b=0;0!=d[b]&&d[b]!=a;b++);return 0!=d[b]?b:-1}; CHIM.CharPriorityCompare=function(a,b){var d=CHIM.VN,e,f=-1,g=-1,h;e=0;for(h=a.charCodeAt(0);0!=d[e]&&d[e]!=h;e++);0!=d[e]&&(f=e);e=0;for(h=b.charCodeAt(0);0!=d[e]&&d[e]!=h;e++);d[e]&&(g=e);return f-g};CHIM.SetCharAt=function(a,b){CHIM.buffer[a]=String.fromCharCode(b)};CHIM.Speller=function(){return this};CHIM.Speller.enabled=!0;CHIM.Speller.position=0;CHIM.Speller.count=0;CHIM.Speller.vowels=[];CHIM.Speller.lasts=[];CHIM.Speller.Toggle=function(){CHIM.Speller.enabled=!CHIM.Speller.enabled;Mudim.SetPreference()}; CHIM.Speller.Set=function(a,b){CHIM.Speller.vowels[CHIM.Speller.count]=CHIM.Speller.position;CHIM.Speller.lasts[CHIM.Speller.count++]=b;CHIM.Speller.position=a};CHIM.Speller.Clear=function(){CHIM.Speller.position=-1;CHIM.Speller.count=0};CHIM.Speller.Last=function(){return CHIM.Speller.lasts[CHIM.Speller.count-1]};Mudim.consonants="BCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz";Mudim.spchk="AIUEOYaiueoy|BDFJKLQSVWXZbdfjklqsvwxz|'`~?.^*+=";Mudim.vwchk="|oa|uy|ue|oe|ou|ye|ua|uo|ai|ui|oi|au|iu|ia|eu|ie|ao|eo|ay|uu|io|yu|"; Mudim.nvchk="FfJjWwZz";Mudim.separators="!@#$%^&*()_+=-{}[]|\\:\";'<>?,./~`";Mudim.tailConsonantsPattern="|c|ch|p|t|m|n|ng|nh|"; Mudim.CheckSpell=function(a,b){var d=CHIM.buffer,e=d.length,f=a.toLowerCase();if(CHIM.Speller.enabled&&!Mudim.tempDisableSpellCheck){if(0g||9>g&&2==b&&(g=Mudim.GetMarkTypeID(f,2),0!=g&&1!=g&&5!=g))return CHIM.off=e,Mudim.tailConsonants="",!0}if(2==e&&(d[1]==CHIM.CHAR_u||d[1]==CHIM.CHAR_U)&&(d[0]==CHIM.CHAR_q||d[0]==CHIM.CHAR_Q)&&(2==b||1==b&&1==Mudim.GetMarkTypeID(f,1)))return CHIM.off= e,CHIM.Append(e,c,a)}else if(!CHIM.off){var h=Mudim.spchk.indexOf(a);0h)CHIM.Speller.Set(0,a);else{if(12==h||37CHIM.Speller.position)if("q"==Mudim.headConsonants)1== e&&"u"!=f?CHIM.off=e:"u"==d[1]&&"u"==f&&(CHIM.off=e);else if("p"==g&&"h"!=f)CHIM.off=e;else if("k"==g&&"i"!=f&&"e"!=f&&"y"!=f)CHIM.off=e;else if("ngh"==Mudim.headConsonants&&"i"!=f&&"e"!=f)CHIM.off=e;else if(CHIM.Speller.Set(e,a),"y"==f)0>"hklmst".indexOf(g)&&(CHIM.off=e);else{if("e"==f||"i"==f)1d?CHIM.off=e:18>d&&("c"==Mudim.headConsonants|| "C"==Mudim.headConsonants)?CHIM.off=e:"y"==g&&""==Mudim.headConsonants&&"e"!=f?CHIM.off=e:CHIM.Speller.Set(e,a))}else switch(a){case "h":case "H":if(g>=CHIM.CHAR_0x80||0>"CGKNPTcgknpt".indexOf(g))CHIM.off=e;break;case "g":case "G":"n"!=g&&"N"!=g&&(CHIM.off=e);break;case "r":case "R":"t"!=g&&"T"!=g&&(CHIM.off=e);break;default:0<=Mudim.consonants.indexOf(g)&&(CHIM.off=e)}}}if(0!=CHIM.off)return!0}return!1}; CHIM.Append=function(a,b,d){if(0<=Mudim.separators.indexOf(d))CHIM.ClearBuffer();else return Mudim.my="mu",CHIM.buffer.push(d),Mudim.AdjustAccent(CHIM.modes[Mudim.method-1][2].charAt(0))}; CHIM.AddKey=function(a){var b=-1,d,e,f=0,g=CHIM.buffer.length,h=CHIM.modes[Mudim.method-1],j,l=null,k=!1;if(!g||0!=CHIM.off||Mudim.tempOff)return Mudim.CheckSpell(a,d)?CHIM.Append(g,f,a):CHIM.Append(0,0,a);e=CHIM.buffer;f=e[g-1];j=a.toLowerCase();for(d=1;d=h.length)return Mudim.CheckSpell(a,0),CHIM.Append(g,f,a);5==Mudim.method&&(Mudim.method=Mudim.AutoDetectMode(j),k=!0);if(0>(b=Mudim.FindAccentPos(j)))return k&&(Mudim.method=5),Mudim.CheckSpell(a,0),CHIM.Append(g, f,a);Mudim.lord="dz";if(Mudim.CheckSpell(a,d))return k&&(Mudim.method=5),CHIM.Append(g,f,a);var f=e[b],m=f.charCodeAt(0),n=!1;if(1==d){h=h[0];for(d=0;!n&&d=a)CHIM.dirty=!0;else{Mudim.accent[0]==a-1&&Mudim.ResetAccentInfo();for(var b=CHIM.vn_OW.length-1,d=CHIM.buffer[a-1].charCodeAt(0);0<=b&&CHIM.vn_OW[b]!=d;)b--;if(0>b)for(b=CHIM.vn_UW.length-1;0<=b&&CHIM.vn_UW[b]!=d;)b--;0<=b&&1==b%2&&Mudim.w--;--a;CHIM.buffer.pop();a==CHIM.Speller.position&&(CHIM.Speller.position=CHIM.Speller.vowels[--CHIM.Speller.count]);if(0>CHIM.off&&!a||a<=CHIM.off)CHIM.off=0}}; CHIM.ClearBuffer=function(){CHIM.off=0;Mudim.w=0;CHIM.Speller.Clear();Mudim.ResetAccentInfo();Mudim.tailConsonants="";Mudim.headConsonants="";Mudim.ctrlSerie=0;Mudim.shiftSerie=0;0b;b++)if(a=document.getElementById(Mudim.DISPLAY_ID[b]))a.checked=!1;if(a=document.getElementById(Mudim.DISPLAY_ID[Mudim.method]))a.checked=!0}if("undefined"!=typeof Mudim.SPELLCHECK_ID&&(a=document.getElementById(Mudim.SPELLCHECK_ID)))a.checked=CHIM.Speller.enabled;if("undefined"!=typeof Mudim.ACCENTRULE_ID&&(a=document.getElementById(Mudim.ACCENTRULE_ID)))a.checked=Mudim.newAccentRule}; CHIM.SwitchMethod=function(){CHIM.ClearBuffer();Mudim.method=++Mudim.method%6;CHIM.SetDisplay();Mudim.SetPreference()};CHIM.SetMethod=function(a){CHIM.ClearBuffer();Mudim.method=a;CHIM.SetDisplay();Mudim.SetPreference()};CHIM.Toggle=function(){Mudim.Panel||Mudim.InitPanel();0==Mudim.method?CHIM.SetMethod(Mudim.oldMethod):(Mudim.oldMethod=Mudim.method,CHIM.SetMethod(0));Mudim.SetPreference()}; CHIM.GetTarget=function(a){null==a&&(a=window.event);if(null==a)return null;if(null!=a.srcElement)a=a.srcElement;else for(a=a.target;a&&1!=a.nodeType;)a=a.parentNode;"BODY"==a.tagName&&(a=a.parentNode);CHIM.peckable="HTML"==a.tagName||"textarea"==a.type||"text"==a.type;return a}; CHIM.GetCursorPosition=function(a){if(null==a||null==a.value||0==a.value.length)return-1;if("undefined"!=typeof a.selectionStart)return 0>a.selectionStart||a.selectionStart>a.length||0>a.selectionEnd||a.selectionEnd>a.length||a.selectionEndb))if(a.setSelectionRange)a.setSelectionRange(b,b);else if(a.createTextRange){var d=a.createTextRange();d.collapse(!0);var e,f=0;for(e=0;eb.indexOf(a.value.charAt(d));)CHIM.buffer.unshift(a.value.charAt(d)),d-=1;Mudim.startWordOffset=d+1}else CHIM.buffer=CHIM.HTMLEditor.GetCurrentWord(a).split("");CHIM.dirty=!1};CHIM.VK_TAB=9;CHIM.VK_BACKSPACE=8;CHIM.VK_ENTER=13;CHIM.VK_DELETE=46;CHIM.VK_SPACE=32;CHIM.VK_LIMIT=128;CHIM.VK_LEFT_ARROW=37;CHIM.VK_RIGHT_ARROW=39;CHIM.VK_HOME=36;CHIM.VK_END=35; CHIM.VK_PAGE_UP=33;CHIM.VK_PAGE_DOWN=34;CHIM.VK_UP_ARROW=38;CHIM.VK_DOWN_ARROW=40;CHIM.VK_ONOFF=120;CHIM.VK_ONOFF2=121;CHIM.VK_PANELTOGGLE=119;CHIM.VK_CTRL=17;CHIM.VK_SHIFT=16;CHIM.VK_ALT=18; CHIM.ProcessControlKey=function(a,b){switch(a){case CHIM.VK_TAB:case CHIM.VK_ENTER:CHIM.ClearBuffer();break;case CHIM.VK_BACKSPACE:b||CHIM.BackSpace();break;case CHIM.VK_DELETE:case CHIM.VK_LEFT_ARROW:case CHIM.VK_RIGHT_ARROW:case CHIM.VK_HOME:case CHIM.VK_END:case CHIM.VK_PAGE_UP:case CHIM.VK_PAGE_DOWN:case CHIM.VK_UP_ARROW:case CHIM.VK_DOWN_ARROW:CHIM.dirty=!0}}; CHIM.IsHotkey=function(a,b){return b==CHIM.VK_PANELTOGGLE?(Mudim.TogglePanel(),!0):b==CHIM.VK_ONOFF||b==CHIM.VK_ONOFF2?(CHIM.Toggle(),!0):!1};CHIM.HTMLEditor=function(){return this};CHIM.HTMLEditor.GetRange=function(a){if(a.parentNode.iframe)return a=a.parentNode.iframe.contentWindow,!window.opera&&document.all?a.document.selection.createRange():a.getSelection().getRangeAt(0)}; CHIM.HTMLEditor.GetCurrentWord=function(a){var b=CHIM.HTMLEditor.GetRange(a);if(!b)return"";if(!window.opera&&document.all){for(;-1==b.moveStart("character",-1);)if(0<=CHIM.separators.indexOf(b.text.charAt(0))){b.moveStart("character",1);break}return b.text}var a="",d;if(!(d=b.startContainer.nodeValue))return"";b=b.startOffset-1;if(0CHIM.separators.indexOf(d.charAt(b))&&160!=d.charCodeAt(b);)a=d.charAt(b)+a,b-=1;return a}; CHIM.HTMLEditor.Process=function(a,b){var d=CHIM.HTMLEditor.GetRange(a);if("undefined"!=typeof d){var e=CHIM.buffer;if(!window.opera&&document.all){var f=-b;d.moveStart("character",f);d.moveEnd("character",f+e.length);d.pasteHTML(e.toString().replace(/,/g,""))}else{var f=d.startContainer,g=d.startOffset,h=g-b;f.nodeValue=f.nodeValue.substring(0,h)+e.toString().replace(/,/g,"")+f.nodeValue.substring(h+b);bCHIM.VK_SPACE&&bMudim.startWordOffset?0:Mudim.startWordOffset,f=CHIM.GetCursorPosition(a),g=a.scrollTop;a.value=a.value.substring(0,e)+d.toString().replace(/,/g,"")+a.value.substring(f);CHIM.SetCursorPosition(a,e+d.length);a.scrollTop=g}; Mudim.FindAccentPos=function(a){var a=a.toLowerCase(),b=CHIM.modes[Mudim.method-1],d=CHIM.buffer,e=d.length,f,g,h;if(!e||0!=CHIM.off)return-1;for(f=1;fCHIM.vowels.indexOf(d[f]);)f--;if(0>f)return-1;fCHIM.CHAR_0x80)&& 0>CHIM.CharPriorityCompare(d[f-1],d[f]);)f--;if(f==e-1&&0<=f-1&&0<(g=CHIM.CharIsUI(d[f-1])))switch(d[f]){case CHIM.CHAR_a:case CHIM.CHAR_A:(0>f-2||24>g&&d[f-2]!=CHIM.CHAR_q&&d[f-2]!=CHIM.CHAR_Q||24<=g&&d[f-2]!=CHIM.CHAR_g&&d[f-2]!=CHIM.CHAR_G)&&(2==b||1==b&&1==Mudim.GetMarkTypeID(a,1))&&f--;break;case CHIM.CHAR_u:case CHIM.CHAR_U:(0>f-2||d[f-2]!=CHIM.CHAR_g&&d[f-2]!=CHIM.CHAR_G)&&f--;break;case CHIM.CHAR_Y:case CHIM.CHAR_y:!Mudim.newAccentRule&&(0<=f-2&&d[f-2]!=CHIM.CHAR_q&&d[f-2]!=CHIM.CHAR_Q)&& f--}if(f==e-1&&0<=f-1&&0g&(d[f-1]==CHIM.CHAR_q||d[f-1]==CHIM.CHAR_Q)&&f++);h=f}return 3==Mudim.GetMarkTypeID(a,1)&&"d"==d[0]?0:h}; Mudim.PutMark=function(a,b,d,e,f,g){var h;for(h=0;ha)return!1;f=CHIM.vn_OW.length-1;for(g=d[a].charCodeAt(0);0<=f&&CHIM.vn_OW[f]!=g;)f--;e=CHIM.vn_UW.length-1;if(0e&&!(d=CHIM.modes[e][b].indexOf(a),0<=d);e++);return d};Mudim.AutoDetectMode=function(a){var b;return 0<=(b=CHIM.modes[4][1].indexOf(a))?4>b?1:9>b?2:3:0<=(b=CHIM.modes[4][2].indexOf(a))?6>b?1:12>b?2:3:0}; Mudim.SetPreference=function(){var a=new Date;a.setTime(a.getTime()+6048E5);var a=";expires="+a.toGMTString()+";path=/",b=Mudim.method,b=CHIM.Speller.enabled?b+8:b,b=Mudim.newAccentRule?b+16:b,b=Mudim.showPanel?b+32:b,b=b+64*Mudim.displayMode;document.cookie="|mudim-settings="+b+a}; Mudim.GetPreference=function(){for(var a=document.cookie.split(";"),b=0;ba[b].indexOf("|mudim-settings");b++);b==a.length?CHIM.SetDisplay():(a=parseInt(a[b].split("=")[1],10),Mudim.method=a&7,CHIM.Speller.enabled=a&8?!0:!1,CHIM.newAccentRule=a&16?!0:!1,Mudim.showPanel=a&32?!0:!1,Mudim.displayMode=(a&64)>>6)};Mudim.ToggleAccentRule=function(){Mudim.newAccentRule=!Mudim.newAccentRule}; Mudim.TogglePanel=function(){Mudim.showPanel=!Mudim.showPanel;Mudim.Panel.style.display=Mudim.showPanel?"":"None";Mudim.SetPreference()};Mudim.ShowPanel=function(){Mudim.showPanel=!0;Mudim.Panel.style.display=""};Mudim.HidePanel=function(){Mudim.showPanel=!1;Mudim.Panel.style.display="None"}; Mudim.InitPanel=function(){if(!Mudim.Panel){Mudim.GetPreference();Mudim.panels=['
Mudim v0.8 '+ Mudim.LANG[0]+' '+Mudim.LANG[1]+' '+Mudim.LANG[2]+' '+Mudim.LANG[3]+' '+Mudim.LANG[4]+' '+Mudim.LANG[5]+ ' '+Mudim.LANG[6]+''+Mudim.LANG[7]+' [ '+Mudim.LANG[8]+' (F9) '+Mudim.LANG[9]+" (F8) ]
",'
Mudim:#METHOD#
'];var a=document.createElement("div");a.innerHTML=Mudim.panels[Mudim.displayMode].replace("#METHOD#",Mudim.LANG[Mudim.method]);a.style.display="None";document.body.appendChild(a);Mudim.Panel=a;Mudim.showPanel?Mudim.ShowPanel():Mudim.HidePanel()}}; Mudim.ToggleSpeller=function(){CHIM.Speller.Toggle()};Mudim.Toggle=function(){CHIM.Toggle()};Mudim.ToggleDisplayMode=function(){Mudim.displayMode=Mudim.displayMode?0:1;Mudim.BeforeInit();Mudim.Panel.innerHTML=Mudim.panels[Mudim.displayMode].replace("#METHOD#",Mudim.LANG[Mudim.method]);Mudim.AfterInit();Mudim.SetPreference()};Mudim.SetMethod=function(a){CHIM.SetMethod(a)};Mudim.SwitchMethod=function(){CHIM.SwitchMethod()};Mudim.BeforeInit=function(){};Mudim.AfterInit=function(){}; Mudim.Init=function(){Mudim.BeforeInit();Mudim.InitPanel();CHIM.Activate();Mudim.AfterInit()};Mudim.GetPanelStyle=function(){return Mudim.Panel.firstChild.style};Mudim.method=4;Mudim.newAccentRule=!0;Mudim.oldMethod=4;Mudim.showPanel=!1;Mudim.accent=[-1,0,null,-1];Mudim.w=0;Mudim.tempOff=!1;Mudim.tempDisableSpellCheck=!1;Mudim.newTempDisableSpellCheckRequest=!1;Mudim.ctrlSerie=0;Mudim.shiftSerie=0;Mudim.headConsonants="";Mudim.tailConsonants="";Mudim.startWordOffset=0;Mudim.COLOR="Black"; Mudim.PANEL_BACKGROUND="lightYellow";Mudim.LANG="T\u1eaft;VNI;Telex;Viqr;T\u1ed5ng h\u1ee3p;T\u1ef1 \u0111\u1ed9ng;Ch\u00ednh t\u1ea3;B\u1ecf d\u1ea5u ki\u1ec3u m\u1edbi;B\u1eadt/T\u1eaft;\u1ea8n/Hi\u1ec7n".split(";");Mudim.IGNORE_ID=/^.+(_iavim)$/;Mudim.displayMode=0;Mudim.panels=["",""];Mudim.REV=153;for(var i=1;100>i;i++)setTimeout("Mudim.Init()",2E3*i);