spiegel-keyman/output/keymanweb.js
2015-09-14 15:47:00 +10:00

270 lines
136 KiB
JavaScript

String.kmwFromCharCode=function(a){var b=[],c;for(c=0;c<arguments.length;c++){var d=Number(arguments[c]);if(!isFinite(d)||0>d||1114111<d||Math.floor(d)!==d)throw new RangeError("Invalid code point "+d);65536>d?b.push(d):(d-=65536,b.push((d>>10)+55296),b.push(d%1024+56320))}return String.fromCharCode.apply(void 0,b)};
String.prototype.kmwCharCodeAt=function(a){var b=""+this,c=0;if(0>a||a>=b.length)return NaN;for(var d=0;d<a;d++)if(c=b.kmwNextChar(c),null===c)return NaN;a=b.charCodeAt(c);return 55296<=a&&(56319>=a&&b.length>c+1)&&(b=b.charCodeAt(c+1),56320<=b&&57343>=b)?(a-55296<<10)+(b-56320)+65536:a};String.prototype.kmwIndexOf=function(a,b){var c=""+this,d=c.indexOf(a,b);if(0>d)return d;for(var e=0,f=0;null!==f&&f<d;f=c.kmwNextChar(f))e++;return e};
String.prototype.kmwLastIndexOf=function(a,b){var c=""+this,d=c.lastIndexOf(a,b);if(0>d)return d;for(var e=0,f=0;null!==f&&f<d;f=c.kmwNextChar(f))e++;return e};String.prototype.kmwLength=function(){var a=""+this;if(0==a.length)return 0;for(var b=0,c=0;null!==c;b++)c=a.kmwNextChar(c);return b};String.prototype.kmwSlice=function(a,b){var c=""+this,d=c.kmwCodePointToCodeUnit(a),e=c.kmwCodePointToCodeUnit(b);return null===d||null===e?"":c.slice(d,e)};
String.prototype.kmwSubstr=function(a,b){var c=""+this;0>a&&(a=c.kmwLength()+a);0>a&&(a=0);var d=c.kmwCodePointToCodeUnit(a),e=d;if(null===d)return"";if(2>arguments.length)e=c.length;else for(var f=0;f<b;f++)e=c.kmwNextChar(e);return null===e?c.substring(d):c.substring(d,e)};
String.prototype.kmwSubstring=function(a,b){var c=""+this,d,e;"undefined"==typeof b?(d=c.kmwCodePointToCodeUnit(a),e=c.length):(a>b&&(d=a,a=b,b=d),d=c.kmwCodePointToCodeUnit(a),e=c.kmwCodePointToCodeUnit(b));if(isNaN(d)||null===d)d=0;if(isNaN(e)||null===e)e=c.length;return c.substring(d,e)};
String.prototype.kmwNextChar=function(a){var b=""+this;if(null===a||0>a||a>=b.length-1)return null;var c=b.charCodeAt(a);return 55296<=c&&(56319>=c&&b.length>a+1)&&(c=b.charCodeAt(a+1),56320<=c&&57343>=c)?a==b.length-2?null:a+2:a+1};String.prototype.kmwPrevChar=function(a){var b=""+this;if(null==a||0>=a||a>b.length)return null;var c=b.charCodeAt(a-1);return 56320<=c&&(57343>=c&&1<a)&&(b=b.charCodeAt(a-2),55296<=b&&56319>=b)?a-2:a-1};
String.prototype.kmwCodePointToCodeUnit=function(a){if(null===a)return null;var b=""+this,c=0;if(0>a){for(var c=b.length,d=0;d>a;d--)c=b.kmwPrevChar(c);return c}if(a==b.kmwLength())return b.length;for(d=0;d<a;d++)c=b.kmwNextChar(c);return c};String.prototype.kmwCodeUnitToCodePoint=function(a){var b=""+this;return null===a?null:0==a?0:0>a?b.substr(a).kmwLength():b.substr(0,a).kmwLength()};String.prototype.kmwCharAt=function(a){return 0<=a?(""+this).kmwSubstr(a,1):""};
String.prototype.kmwBMPNextChar=function(a){return 0>a||a>=(""+this).length-1?null:a+1};String.prototype.kmwBMPPrevChar=function(a){return 0>=a||a>(""+this).length?null:a-1};String.prototype.kmwBMPCodePointToCodeUnit=function(a){return a};String.prototype.kmwBMPCodeUnitToCodePoint=function(a){return a};String.prototype.kmwBMPLength=function(){return(""+this).length};String.prototype.kmwBMPSubstr=function(a,b){var c=""+this;return-1<a?c.substr(a,b):c.substr(c.length+a,-a)};
String.kmwEnableSupplementaryPlane=function(a){var b=String.prototype;String._kmwFromCharCode=a?String.kmwFromCharCode:String.fromCharCode;b._kmwCharAt=a?b.kmwCharAt:b.charAt;b._kmwCharCodeAt=a?b.kmwCharCodeAt:b.charCodeAt;b._kmwIndexOf=a?b.kmwIndexOf:b.indexOf;b._kmwLastIndexOf=a?b.kmwLastIndexOf:b.lastIndexOf;b._kmwSlice=a?b.kmwSlice:b.slice;b._kmwSubstring=a?b.kmwSubstring:b.substring;b._kmwSubstr=a?b.kmwSubstr:b.kmwBMPSubstr;b._kmwLength=a?b.kmwLength:b.kmwBMPLength;b._kmwNextChar=a?b.kmwNextChar:
b.kmwBMPNextChar;b._kmwPrevChar=a?b.kmwPrevChar:b.kmwBMPPrevChar;b._kmwCodePointToCodeUnit=a?b.kmwCodePointToCodeUnit:b.kmwBMPCodePointToCodeUnit;b._kmwCodeUnitToCodePoint=a?b.kmwCodeUnitToCodePoint:b.kmwBMPCodeUnitToCodePoint};
var __BUILD__=408;
(function(){var b=(window.tavultesoft={}).keymanweb={_TitleElement:null,_Enabled:1,_IE:0,legacy:0,_IsActivatingKeymanWebUI:0,_JustActivatedKeymanWebUI:0,_IgnoreNextSelChange:0,_Selection:null,_SelectionControl:null,_KeyboardStubs:[],dfltStub:null,_Keyboards:[],_ActiveKeyboard:null,_ActiveStub:null,_LoadingInternalName:null,_AnyIndices:[],_DeadKeys:[],_ActiveControl:null,_Controls:[],_AttachedElements:[],_ActiveElement:null,_LastActiveElement:null,_DfltStyle:"",_MasterDocument:null,_HotKeys:[],focusTimer:null,
focusing:!1,resizing:!1,sortedInputs:[],inputList:[],languageList:null,languagesPending:[],deferredStubs:[],deferredKRS:[],deferredKR:[],loadTimer:null,waiting:null,warned:!1,baseFont:"sans-serif",appliedFont:"",embeddedFonts:[],fontCheckTimer:null,srcPath:"",rootPath:"",mustReloadKeyboard:!1,fullInitialization:!0};b.initialized=0;b.build=__BUILD__;b.version="2.0";b.helpURL="http://help.keyman.com/go";window.KeymanWeb=b;var a=b.util={},h=b.osk={ready:!1};b.ui={};b.setDefaultDeviceOptions=function(){};
b.getStyleSheetPath=function(b){return b};b.getKeyboardPath=function(b){return b};b.KC_=function(){return""};b.handleRotationEvents=function(){};b.alignInputs=function(){};b.refreshElementContent=null;h.highlightSubKeys=function(){};h.createKeyTip=function(){};h.optionKey=function(){};h.showKeyTip=function(){};h.waitForFonts=function(){return!0};b.options={root:"",resources:"",keyboards:"",fonts:"",attachType:"",ui:null};a.events=[];a.currentEvents=[];h=document.getElementsByTagName("script");h=h[h.length-
1].src;h=h.substr(0,h.lastIndexOf("/")+1);b.srcPath=h;b.rootPath=h.replace(/(https?:\/\/)([^\/]*)(.*)/,"$1$2/");b.protocol=h.replace(/(.{3,5}:)(.*)/,"$1");a.addEventListener=function(b,c){a.removeEventListener(b,c);a.events[b].push(c);return!0};a.removeEventListener=function(b,c){"undefined"==typeof a.events[b]&&(a.events[b]=[]);for(var e=0;e<a.events[b].length;e++)if(a.events[b][e]==c)return a.events[b].splice(e,1),!0;return!1};a.callEvent=function(b,c){if("undefined"==typeof a.events[b])return!0;
if("undefined"!=typeof a.currentEvents[b])return!1;a.currentEvents.push(b);for(var e=0;e<a.events[b].length;e++){var d=a.events[b][e],f=!1;try{f=d(c)}catch(m){f=!1}if(!f)return a.currentEvents.pop(),!1}a.currentEvents.pop();return!0};a.attachDOMEvent=a.attachDOMEvent=function(b,c,e,d){a.detachDOMEvent(b,c,e,d);b.attachEvent?b.attachEvent("on"+c,e):b.addEventListener&&b.addEventListener(c,e,d?!0:!1)};a.detachDOMEvent=a.detachDOMEvent=function(b,c,e,a){b.detachEvent?b.detachEvent("on"+c,e):b.removeEventListener&&
b.removeEventListener(c,e,a)};a.getOption=a.getOption=function(a,c){return a in b.options?b.options[a]:1<arguments.length?c:""};a.setOption=a.setOption=function(a,c){b.options[a]=c};a.getAbsoluteX=a._GetAbsoluteX=function(g){if(!g)return 0;var c=g.offsetLeft?g.offsetLeft:0,e=g;if(e.offsetParent)for(;e.offsetParent;)e=e.offsetParent,c+=e.offsetLeft;e&&(e.ownerDocument&&g.ownerDocument!=b._MasterDocument)&&(e=e.ownerDocument);return e&&e.parentWindow&&e.parentWindow.frameElement?c+a._GetAbsoluteX(e.parentWindow.frameElement)-
e.documentElement.scrollLeft:e&&e.defaultView&&e.defaultView.frameElement?c+a._GetAbsoluteX(e.defaultView.frameElement)-e.documentElement.scrollLeft:c};a.getAbsoluteY=a._GetAbsoluteY=function(g){if(!g)return 0;var c=g.offsetTop?g.offsetTop:0,e=g;if(e.offsetParent)for(;e.offsetParent;)e=e.offsetParent,c+=e.offsetTop;e&&(e.ownerDocument&&g.ownerDocument!=b._MasterDocument)&&(e=e.ownerDocument);return e&&e.parentWindow&&e.parentWindow.frameElement?c+a._GetAbsoluteY(e.parentWindow.frameElement)-e.documentElement.scrollTop:
e&&e.defaultView&&e.defaultView.frameElement?c+a._GetAbsoluteY(e.defaultView.frameElement)-e.documentElement.scrollTop:c};a.getAbsolute=a._GetAbsolute=function(b){var c={};c.x=a._GetAbsoluteX(b);c.y=a._GetAbsoluteY(b);return c};a.selectStartHandler=function(){return!1};a.mouseDownPreventDefaultHandler=function(b){b&&b.preventDefault()};a.mouseDownPreventDefaultHandler=function(b){b&&b.preventDefault()};a.createElement=a._CreateElement=function(b){b=document.createElement(b);"undefined"!=typeof b.onselectstart?
(b.unSelectable="on",b.onselectstart=a.selectStartHandler):(b.style.MozUserSelect="none",b.style.KhtmlUserSelect="none",b.style.UserSelect="none",b.style.WebkitUserSelect="none");return b};a.getIEVersion=a._GetIEVersion=function(){var b,c="";"userAgent"in navigator&&(c=navigator.userAgent);if("selection"in document){var e=navigator.appVersion;b=e.indexOf("MSIE ");if(0<=b){if("BackCompat"==document.compatMode)return 6;e=e.substr(b+5);b=e.indexOf(".");if(0<b)return parseInt(e.substr(0,b),10)}}b=c.indexOf("Trident/");
if(0>b)return 999;c=c.substr(b+8);b=c.indexOf(".");return 0<b?parseInt(c.substr(0,b),10)+4:999};a.getDPI=function(){var b=document.createElement("DIV"),c=b.style,e=96;if("complete"!==document.readyState)return e;b.id="calculateDPI";c.position="absolute";c.display="block";c.visibility="hidden";c.left="10px";c.top="10px";c.width="1in";c.height="10px";document.body.appendChild(b);e="undefined"==typeof window.devicePixelRatio?b.offsetWidth:b.offsetWidth*window.devicePixelRatio;document.body.removeChild(b);
return e};a.getStyleValue=function(b,c){try{if(b&&"undefined"!=typeof window.getComputedStyle)return window.getComputedStyle(b,"").getPropertyValue(c);if(b&&"undefined"!=typeof b.currentStyle)return b.currentStyle[c]}catch(e){}return""};a.getStyleInt=function(b,c,e){b=parseInt(a.getStyleValue(b,c),10);return!isNaN(b)?b:"number"==typeof e?e:0};var i=a.device={touchable:!!("ontouchstart"in window),OS:"",formFactor:"desktop",dyPortrait:0,dyLandscape:0,version:"0",orientation:window.orientation};if(navigator&&
navigator.userAgent){h=navigator.userAgent;0<=h.indexOf("iPad")&&(i.OS="iOS",i.formFactor="tablet",i.dyPortrait=i.dyLandscape=0);0<=h.indexOf("iPhone")&&(i.OS="iOS",i.formFactor="phone",i.dyPortrait=i.dyLandscape=25);if(0<=h.indexOf("Android")){i.OS="Android";i.formFactor="phone";i.dyPortrait=75;i.dyLandscape=25;try{i.version=h.match(/(?:Android\s+)(\d+\.\d+\.\d+)/)[1]}catch(j){}}if(0<=h.indexOf("Windows NT")&&(i.OS="Windows",0<=h.indexOf("Touch")&&(i.formFactor="phone"),"number"==typeof navigator.msMaxTouchPoints&&
0<navigator.msMaxTouchPoints))i.touchable=!0}"tablet"==i.formFactor&&400>Math.min(screen.width,screen.height)&&(i.formFactor="phone");"phone"==i.formFactor&&720<Math.max(screen.width,screen.height)&&(i.formFactor="tablet");"iOS"==i.OS&&(!("ongesturestart"in window)&&"Win32"!=navigator.platform)&&(i.OS="Android");i.browser="web";if(999>a._GetIEVersion())i.browser="ie";else{if("iOS"==i.OS||"macosx"==i.OS.toLowerCase())i.browser="safari";/Firefox|Chrome|OPR/.test(navigator.userAgent)&&(0<=navigator.userAgent.indexOf("Firefox")&&
"onmozorientationchange"in screen?i.browser="firefox":0<=navigator.userAgent.indexOf("OPR")?i.browser="opera":0<=navigator.userAgent.indexOf("Chrome")&&(i.browser="chrome"))}a.isTouchDevice=function(){return i.touchable};a.portraitView=function(){return!a.landscapeView()};a.landscapeView=function(){return typeof window.orientation=="undefined"?false:Math.abs(window.orientation/90)==1};a.getViewportScale=function(){try{if(screen.width>document.documentElement.clientWidth)return 1;var b=screen.width;
if(a.landscapeView()){if(screen.width<screen.height)b=screen.height}else if(screen.width>screen.height)b=screen.height;return Math.round(100*b/window.innerWidth)/100}catch(c){return 1}};a.barHeight=function(){var b=0;i.formFactor=="phone"&&(b=screen.height/2-window.innerHeight-(a.landscapeView()?i.dyLandscape:i.dyPortrait));return b};a._EncodeEntities=function(b){return b.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;")};a.createShim=a.createShim=function(){var b=a._CreateElement("IFRAME");
b.src="";b.style.display="none";b.style.position="absolute";b.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";b.frameBorder="0";b.scrolling="no";return b};a.showShim=a.showShim=function(b,c,e){if(c)try{c.style.left=a._GetAbsoluteX(b)+"px";c.style.top=a._GetAbsoluteY(b)+"px";if(e){c.style.width=a._GetAbsoluteX(e)-a._GetAbsoluteX(b)+e.offsetWidth+"px";c.style.height=a._GetAbsoluteY(e)-a._GetAbsoluteY(b)+e.offsetHeight+"px"}else{c.style.width=b.offsetWidth+"px";c.style.height=
b.offsetHeight+"px"}c.style.zindex="9999";c.style.display="block"}catch(d){}};a.hideShim=function(b){try{if(b)b.style.display="none"}catch(c){}};a.rgba=a.rgba=function(b,c,e,d,f){var m="transparent";if(a._GetIEVersion()<9){f=Math.floor(100*f);c=c.toString(16);e=e.toString(16);d=d.toString(16);c=("00"+c).substr(-2);e=("00"+e).substr(-2);d=("00"+d).substr(-2);d=f+c+e+d;b.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr=#"+d+",endColorstr=#"+d+")";b.zoom="1"}else try{m="rgba("+c+","+
e+","+d+","+f+")"}catch(h){m="rgb("+c+","+e+","+d+")"}return m};a.addStyleSheet=a.addStyleSheet=function(b){var c=document.createElement("STYLE");c.type="text/css";c.styleSheet?c.styleSheet.cssText=b:c.appendChild(document.createTextNode(b));b=document.getElementsByTagName("HEAD");b.length>0?b[0].appendChild(c):document.body.appendChild(c);return c};a.removeStyleSheet=a.removeStyleSheet=function(b){if(b==null||typeof b!="object"||b.nodeName!="STYLE"||typeof b.parentNode=="undefined"||b.parentNode==
null)return false;b.parentNode.removeChild(b);return true};a.linkStyleSheet=a.linkStyleSheet=function(b){var c=document.getElementsByTagName("head");if(c.length>0){var e=document.createElement("link");e.type="text/css";e.rel="stylesheet";e.href=b;c[0].appendChild(e)}};a.addFontFaceStyleSheet=function(g){if(typeof g!="undefined"){typeof g.files=="undefined"&&(g.files=g.source);if(typeof g.files!="undefined"){var c,e="",d="",f="",m="",h=[];for(c=0;c<b.embeddedFonts.length;c++)if(b.embeddedFonts[c]==
g.family)return;typeof g.files=="string"?h[0]=g.files:h=g.files;for(c=0;c<h.length;c++){h[c].indexOf(".ttf")>0&&(e=h[c]);h[c].indexOf(".woff")>0&&(d=h[c]);h[c].indexOf(".eot")>0&&(f=h[c]);h[c].indexOf(".svg")>0&&(m=h[c])}e!=""&&e.indexOf("/")<0&&(e=b.options.fonts+e);d!=""&&d.indexOf("/")<0&&(d=b.options.fonts+d);f!=""&&f.indexOf("/")<0&&(f=b.options.fonts+f);m!=""&&m.indexOf("/")<0&&(m=b.options.fonts+m);c="@font-face {\nfont-family:"+g.family+";\nfont-style:normal;\nfont-weight:normal;\n";if(a._GetIEVersion()>=
9)if(i.OS=="iOS")if(e!=""){e=a.unCached(e);c=c+"src:url('"+e+"') format('truetype');"}else return;else{f=[];if(i.OS=="Android"){m!=""&&f.push("url('"+m+"') format('svg')");d!=""&&f.push("url('"+d+"') format('woff')");e!=""&&f.push("url('"+e+"') format('truetype')")}else{d!=""&&f.push("url('"+d+"') format('woff')");e!=""&&f.push("url('"+e+"') format('truetype')");m!=""&&f.push("url('"+m+"') format('svg')")}if(f.length==0)return;c=c+("src:"+f.join(",")+";")}else if(f!="")c=c+"src:url('"+f+"');";else return;
a.addStyleSheet(c+"\n}\n");b.embeddedFonts.push(g.family)}}};a.unCached=function(b){return b};a.loadCookie=a.loadCookie=function(b){var c={};if(arguments.length>0){var e=a.loadCookie(),d;for(d in e)if(d==b)for(var f=unescape(e[d]).split(";"),m=0;m<f.length;m++){var h=f[m].split("=");c[h[0]]=h.length>1?h[1]:""}}else if(typeof document.cookie!="undefined"&&document.cookie!=""){e=document.cookie.split(/;\s*/);for(m=0;m<e.length;m++){f=e[m].split("=");f.length==2&&(c[f[0]]=f[1])}}return c};a.saveCookie=
a.saveCookie=function(b,c){var e="",a;for(a in c)e=e+a+"="+c[a]+";";a=(new Date((new Date).valueOf()+2592E6)).toGMTString();document.cookie=b+"="+escape(e)+"; path=/; expires="+a};a.toNumber=a.toNumber=function(b,c){var a=parseInt(b,10);return isNaN(a)?c:a};a.toFloat=a.toFloat=function(b,c){var a=parseFloat(b);return isNaN(a)?c:a};a.toNzString=a.nzString=function(b,c){var a="";arguments.length>1&&(a=c);return typeof b=="undefined"||b==null||b==0||b==""?a:""+b};a.deepCopy=function(b,c){var e=c||{},
d;for(d in b)if(typeof b[d]==="object"){e[d]=b[d].constructor===Array?[]:{};a.deepCopy(b[d],e[d])}else e[d]=b[d];return e};"indexOf"in Array||(Array.prototype.indexOf=function(b,c){for(var a=c||0;a<this.length;a++)if(this[a]==b)return a;return-1});a.eventTarget=function(b){return b&&b.target?b.target:window.event?window.event.srcElement:null};a.eventType=function(b){return b&&b.type?b.type:window.event?window.event.type:""};a.alert=a.alert=function(a,c){var e=b.waiting,d=e.firstChild.childNodes;d[0].style.display=
"block";d[1].className="kmw-alert-text";d[1].innerHTML=a;d[2].style.display="none";e.style.display="block";e.dismiss=arguments.length>1?c:null};a.prepareWait=function(){var a=document.createElement("DIV"),c=document.createElement("DIV"),e=document.createElement("DIV"),d=document.createElement("DIV"),f=document.createElement("DIV");a.className="kmw-wait-background";c.className="kmw-wait-box";a.dismiss=null;e.className="kmw-wait-text";d.className="kmw-wait-graphic";f.className="kmw-alert-close";c.onmousedown=
c.onclick=function(){if(f.style.display=="block"){a.style.display="none";a.dismiss&&a.dismiss()}};c.addEventListener("touchstart",c.onclick,false);a.onmousedown=a.onclick=function(c){c.preventDefault();c.stopPropagation()};a.addEventListener("touchstart",a.onclick,false);c.appendChild(f);c.appendChild(e);c.appendChild(d);a.appendChild(c);document.body.appendChild(a);b.waiting=a};a.myPath=function(b){var c,a=document.getElementsByTagName("script"),d;for(c=0;c<a.length;c++){d=a[c];if(d.src.indexOf(b)>=
0)return d.src.substr(0,d.src.lastIndexOf("/")+1)}return""};a.prependProtocol=function(a){return/^https?:/.test(a)?a:a.substr(0,2)=="//"?b.protocol+a:a.substr(0,1)=="/"?b.protocol+"/"+a:b.protocol+"//"+a};a.testString=function(b){var c=b.family;if("sample"in b&&typeof b.sample=="string")return"BESbswy"+b.sample;for(var a=["TamilWeb","TibetanWeb","LatinWeb","CherokeeWeb","EgyptianWeb","SinhalaWeb","KhmerWeb","ArabicWeb","BurmeseWeb","LaoWeb","OriyaWeb","GeezWeb"],d=["\u0bbe\u0bf5","\u0f7f\u0fd0","\u02b0\u02a4",
"\u13d0\u13c9","\ua723\uf7d3","\u0dd8\u0da3","\u17d6\u178e","\u0639\u06b3","\u1038\u1024","\u0ec0\u0edd","\u0b03\u0b06","\u1361\u132c"],b=0;b<a.length;b++)if(c==a[b])return"BESbswy"+d[b];return"BESbswy"};a.checkFont=function(b){var c=false,c=b.family,e=document.createElement("DIV"),d=e.style,f=document.createElement("P"),h=document.createElement("P"),k=document.createElement("SPAN"),j=k.style,i=document.createElement("SPAN"),l=i.style;d.position="absolute";d.top="10px";d.left="10px";d.visibility=
"hidden";document.body.appendChild(e);e.appendChild(f);e.appendChild(h);f.appendChild(k);h.appendChild(i);k.setAttribute("style","font-family:monospace !important");l.fontFamily=c+",monospace";j.fontSize=l.fontSize="24px";k.innerHTML=i.innerHTML=a.testString(b);if(k.offsetWidth!=i.offsetWidth){k.setAttribute("style","font-family:sans-serif !important");l.fontFamily=c+",sans-serif";if(k.offsetWidth!=i.offsetWidth){k.setAttribute("style","font-family:serif !important");l.fontFamily=c+",serif"}}c=k.offsetWidth!=
i.offsetWidth;f.removeChild(k);h.removeChild(i);e.removeChild(f);e.removeChild(h);document.body.removeChild(e);return c};b.isFontAvailable=function(b){return a.checkFont({family:b})};a.checkFontDescriptor=function(b){return typeof b=="undefined"||typeof b.family!="string"?true:a.checkFont(b)}})();(function(){var b=window.tavultesoft.keymanweb,a=b.osk,h=b.util,i=h.device;b.debug=b.debug=function(a){var c;if(null==b.debugElement){var e=document.createElement("DIV");c=e.style;c.position="absolute";c.width="30%";c.maxHeight="50%";c.top="0";c.right="0";c.minHeight="50px";c.border="1px solid blue";c.whiteSpace="pre-line";c.overflowY="scroll";c=document.createElement("P");c.id="debug_output";c.style.margin="2px";e.appendChild(c);document.body.appendChild(e);b.debugElement=c}if(null!=(c=document.getElementById("debug_output")))if(0==
arguments.length)"undefined"!=typeof c.textContent?c.textContent="":c.innerHTML="";else{var e=(new Date).toTimeString().substr(3,5)+" ",d,f,h,k;for(f=0;f<arguments.length;f++)if(0<f&&(e+="; "),k=arguments[f],"object"==typeof k)if(null==k)e+="null";else{d="";for(h in k){0<d.length&&(d+=", ");d=d+h+":";switch(typeof k[h]){case "string":case "number":case "boolean":d+=k[h];break;default:d+=typeof k[h]}if(1024<d.length){d=d.substr(0,1E3)+"...";break}}0<d.length&&(e=e+"{"+d+"}")}else e+=k;1500<e.length&&
(e=e.substr(0,1500)+" (more)");"undefined"!=typeof c.textContent?c.textContent=e+"\n"+c.textContent:c.innerHTML=e+"<br />"+c.innerHTML}};b.debugElement=null;b.addEventListener=b.addEventListener=function(b,c){return h.addEventListener("kmw."+b,c)};b.setupTouchDevice=function(){b.cancelInput=function(){b._ActiveElement=null;b.hideCaret();a.hideNow()};b.setBlur=function(c){"relatedTarget"in c&&c.relatedTarget&&("DIV"!=c.relatedTarget.nodeName||-1==c.relatedTarget.className.indexOf("keymanweb-input"))?
b.cancelInput():b.focusing||b.cancelInput()};b.setFocus=function(c){b.focusing=!0;b.focusTimer=window.setTimeout(function(){b.focusing=!1},1E3);var e=c;c?"object"==typeof c.touches&&(e=c.touches[0]):(e={clientX:0,clientY:0},e.target=b._LastActiveElement?b._LastActiveElement.kmw_ip:b.sortedInputs[0].kmw_ip);var c=e.clientX,d=e.clientY,g=e.target,f;f="SPAN"==g.nodeName?g.parentNode:null!=g.className&&0<=g.className.indexOf("keymanweb-input")?g.firstChild:g;e=f.parentNode;b._ActiveElement!=e&&(b.hideCaret(),
b._ActiveElement=e,e.focus());b._SetTargDir(e);b.useInternalKeyboard=!1;a.ready&&!a._Visible&&a._Show();if("DIV"==g.nodeName)d=h._GetAbsoluteX(f.firstChild),"rtl"==e.dir?(d+=f.firstChild.offsetWidth,f=c>d?0:1E5):f=c<d?0:1E5,b.setTextCaret(e,f),b.scrollInput(e);else{var m,k,j,n,i,l,g=f.childNodes[1];m=0;k=b.getText(e)._kmwLength();f=b.getTextCaret(e);n=document.body.scrollTop;if("TEXTAREA"==e.base.nodeName){i=Math.round(e.base.offsetHeight/e.base.rows);for(l=0;16>l;l++){j=h._GetAbsoluteY(g)-n;if(j>
d&&f>m&&f!=k)k=f,f=Math.round((f+m)/2);else if(j<d-i&&f<k&&f!=m)m=f,f=Math.round((f+k)/2);else break;b.setTextCaret(e,f)}for(;h._GetAbsoluteY(g)-n>d&&f>m;)b.setTextCaret(e,--f);for(;h._GetAbsoluteY(g)-n<d-i&&f<k;)b.setTextCaret(e,++f)}if("rtl"==e.dir){for(l=0;16>l;l++){d=h._GetAbsoluteX(g);if(d<c&&f>m&&f!=k)k=f,f=Math.round((f+m)/2);else if(d>c&&f<k&&f!=m)m=f,f=Math.round((f+k)/2);else break;b.setTextCaret(e,f)}for(;h._GetAbsoluteX(g)<c&&f>m;)b.setTextCaret(e,--f);for(;h._GetAbsoluteX(g)>c&&f<k;)b.setTextCaret(e,
++f)}else{for(l=0;16>l;l++){d=h._GetAbsoluteX(g);if(d>c&&f>m&&f!=k)k=f,f=Math.round((f+m)/2);else if(d<c&&f<k&&f!=m)m=f,f=Math.round((f+k)/2);else break;b.setTextCaret(e,f)}for(;h._GetAbsoluteX(g)>c&&f>m;)b.setTextCaret(e,--f);for(;h._GetAbsoluteX(g)<c&&f<k;)b.setTextCaret(e,++f)}}b._ActiveControl=null;b._LastActiveElement=e;for(c=0;c<b._Controls.length;c++)if(b._Controls[c].LControl==e){b._ActiveControl=b._Controls[c];break}null!=b._ActiveControl&&null!=b._ActiveControl.LDefaultInternalName&&(b._JustActivatedKeymanWebUI?
b._ActiveControl.LDefaultInternalName=null==b._ActiveKeyboard?"":b._ActiveKeyboard.KI:b._SetActiveKeyboard(b._ActiveControl.LDefaultInternalName,"",!0));!b._IsIEEditableIframe(e,1)||!b._IsMozillaEditableIframe(e,1)?b._DisableInput=1:(b._DisableInput=0,b._JustActivatedKeymanWebUI||(b._DeadKeys=[],b._NotifyKeyboard(0,e,1)),!b._JustActivatedKeymanWebUI&&b._SelectionControl!=e&&(b._IsActivatingKeymanWebUI=0),b._JustActivatedKeymanWebUI=0,b._SelectionControl=e)};b.caret=document.createElement("DIV");var g=
b.caret.style;g.position="absolute";g.height="16px";g.width="2px";g.backgroundColor="blue";g.border="none";g.left=g.top=0;g.display="block";g.visibility="hidden";g.zIndex="9998";b.showCaret=function(c){if(c&&c.firstChild&&!(3>c.firstChild.childNodes.length)){var a=c.firstChild,e=b.caret.style,d=a.childNodes[1];b.caret.parentNode!=a&&a.appendChild(b.caret);e.left=d.offsetLeft+"px";e.top=d.offsetTop+"px";e.height=d.offsetHeight-1+"px";e.visibility="hidden";b.scrollBody(c);b.setScrollBar(c)}};b.setScrollBar=
function(c){var b=c.childNodes[0],a=c.childNodes[1].style;(b.offsetWidth>c.offsetWidth||0>b.offsetLeft)&&"TEXTAREA"!=c.base.nodeName?(a.height="4px",a.width=100*(c.offsetWidth/b.offsetWidth)+"%",a.left=100*(-b.offsetLeft/b.offsetWidth)+"%",a.top="0",a.visibility="visible"):b.offsetHeight>c.offsetHeight||0>b.offsetTop?(a.width="4px",a.height=100*(c.offsetHeight/b.offsetHeight)+"%",a.top=100*(-b.offsetTop/b.offsetHeight)+"%",a.left="0",a.visibility="visible"):a.visibility="hidden"};b.flashCaret=function(){if(i.touchable&&
null!=b._ActiveElement){var c=b.caret.style;c.visibility="visible"!=c.visibility?"visible":"hidden"}};b.hideCaret=function(){var c=b._LastActiveElement;if(c&&null!=c.className&&0<=c.className.indexOf("keymanweb-input")){c.base.value=b.getText(c);b.setText(c,null,1E5);var a=c.firstChild.style;"TEXTAREA"==c.base.nodeName?a.top="0":a.left="rtl"==c.base.dir?c.offsetWidth-c.firstChild.offsetWidth-8+"px":"0";b.caret.parentNode&&b.caret.parentNode.removeChild(b.caret);b.caret.style.visibility="hidden";1<
c.childNodes.length&&(c.childNodes[1].style.visibility="hidden")}};b.timerId=window.setInterval(b.flashCaret,500);b.setText=function(c,a,e){if(c&&0<c.childNodes.length){var d=c.firstChild,g=0;if(3<=d.childNodes.length){var f=d.childNodes[0],d=d.childNodes[2],h;null===a&&(h="string"==typeof f.textContent?f.textContent:f.innerText,a="string"==typeof d.textContent?d.textContent:d.innerText,a=h+a);0>e&&(e=0);g=a._kmwLength();if(null===e||e>g)e=g;h=a._kmwSubstr(0,e);a=a._kmwSubstr(e);"string"==typeof f.textContent?
f.textContent=h:f.innerText=h;"string"==typeof d.textContent?d.textContent=a:d.innerText=a}}b.updateBaseElement(c,g)};b.updateBaseElement=function(c,a){c.base.value=b.getText(c);c.style.backgroundColor=0==a?"transparent":window.getComputedStyle(c.base,null).backgroundColor;"iOS"==i.OS&&(c.base.style.visibility=0==a?"visible":"hidden")};b.getText=function(c){return null==c?"":"string"==typeof c.textContent?c.textContent:c.innerText};b.getTextBeforeCaret=function(c){if(c&&1<c.childNodes.length&&(c=
c.firstChild,0<c.childNodes.length)){c=c.childNodes[0];if("textContent"in c)return c.textContent;if("innerText"in c)return c.innerText}return""};b.setTextBeforeCaret=function(c,a){if(c&&0<c.childNodes.length){var e=c.firstChild,d=0;1<e.childNodes.length&&(d=e.childNodes[0],e=e.childNodes[2],"TEXTAREA"!=c.base.nodeName&&(a=a.replace(/\s+$/," ")),"textContent"in d?d.textContent=a:"innerText"in d&&(d.innerText=a),d=a.length,"textContent"in e?d+=e.textContent.length:"innerText"in e&&(d+=e.innerText.length))}b.updateBaseElement(c,
d);b.scrollInput(c)};b.getTextCaret=function(c){return b.getTextBeforeCaret(c)._kmwLength()};b.setTextCaret=function(c,a){b.setText(c,null,a);b.showCaret(c)};b.dragInput=function(c){c.preventDefault();c.stopPropagation();var a="object"==typeof c.targetTouches?c.targetTouches[0].target:c.target;if(null!=a){if(null==a.className||0>a.className.indexOf("keymanweb-input"))a=a.parentNode;if(null==a.className||0>a.className.indexOf("keymanweb-input"))a=a.parentNode;if(!(null==a.className||0>a.className.indexOf("keymanweb-input"))){var e=
"object"==typeof c.touches?c.touches[0].screenX:c.screenX,d="object"==typeof c.touches?c.touches[0].screenY:c.screenY;if("undefined"==typeof b.firstTouch||null==b.firstTouch)b.firstTouch={x:e,y:d};else{var g=b.firstTouch.x,f=b.firstTouch.y,c=a.firstChild,m;if("TEXTAREA"==a.base.nodeName){if(e=parseInt(c.style.top,10),isNaN(e)&&(e=0),g=f-d,-4>g||4<g)c.style.top=(e<g?e-g:0)+"px",b.firstTouch.y=d}else if(d=parseInt(c.style.left,10),isNaN(d)&&(d=0),m=g-e,-4>m||4<m)g=0,f=h._GetAbsoluteX(a)+a.offsetWidth-
c.offsetWidth-32,"rtl"==a.base.dir?g=16:f-=24,d-=m,d>g&&(d=g),d<f&&(d=f),c.style.left=d+"px",b.firstTouch.x=e}b.setScrollBar(a)}}};b.scrollInput=function(c){if(c&&c.firstChild&&!(null==c.className||0>c.className.indexOf("keymanweb-input"))){var a=c.firstChild;if(!(3>a.childNodes.length)){var e=a.childNodes[1],d=h._GetAbsoluteX(e),e=h._GetAbsoluteY(e),g=h._GetAbsoluteX(c),f=h._GetAbsoluteY(c),m=parseInt(a.style.left,10),k=parseInt(a.style.top,10),j=0,n=0;isNaN(m)&&(m=0);isNaN(k)&&(k=0);"TEXTAREA"==
c.base.nodeName?(d=Math.round(c.offsetHeight/c.base.rows),e<f&&(n=e-f),e>f+c.offsetHeight-d&&(n=e-f-c.offsetHeight+d),0!=n&&(a.style.top=(k<n?k-n:0)+"px")):(d<g+8&&(j=d-g-12),d>g+c.offsetWidth-12&&(j=d-g-c.offsetWidth+12),0!=j&&(a.style.left=(m<j?m-j:0)+"px"));b.showCaret(c)}}};b.scrollBody=function(c){if(c&&!(null==c.className||0>c.className.indexOf("keymanweb-input")||!a.ready)){var c=c.firstChild.childNodes[1],b=h._GetAbsoluteY(c),e=window.pageYOffset,d=0;b<e?d=b-e:(d=b-e-(window.innerHeight-a._Box.offsetHeight-
c.offsetHeight-2),0>d&&(d=0));0!=d&&window.scrollTo(0,d+window.pageYOffset)}};b.updateInput=function(c){var b=c.style,a=c.base,e=window.getComputedStyle(a,null),d=parseInt(e.marginLeft,10),g=parseInt(e.marginTop,10),f=h._GetAbsoluteX(a),m=h._GetAbsoluteY(a),k=c.offsetParent;k&&(f-=h._GetAbsoluteX(k),m-=h._GetAbsoluteY(k));isNaN(d)&&(d=0);isNaN(g)&&(g=0);b.left=f-d+"px";b.top=m-g+"px";"undefined"!=typeof e.MozBoxSizing&&(b.left=f+"px",b.top=m+"px");var d=a.offsetWidth,a=a.offsetHeight,g=parseInt(e.paddingLeft,
10),f=parseInt(e.paddingRight,10),m=parseInt(e.paddingTop,10),k=parseInt(e.paddingBottom,10),j=parseInt(e.borderLeft,10),n=parseInt(e.borderRight,10),l=parseInt(e.borderTop,10),o=parseInt(e.borderBottom,10),B="undefined";"undefined"!=typeof e.boxSizing?B=e.boxSizing:"undefined"!=typeof e.MozBoxSizing&&(B=e.MozBoxSizing);"content-box"==B&&(isNaN(g)||(d-=g),isNaN(f)||(d-=f),isNaN(j)||(d-=j),isNaN(n)||(d-=n),isNaN(m)||(a-=m),isNaN(k)||(a-=k),isNaN(l)||(a-=l),isNaN(o)||(a-=o));"Android"==i.OS&&("undefined"!=
typeof e.MozBoxSizing?(b.paddingTop=m+1+"px",b.paddingLeft=g+"px","TEXTAREA"==c.base.nodeName?b.marginTop="1px":b.marginLeft="1px",d--,a--):(d++,a++));b.width=d+"px";b.height=a+"px"};for(var c=0;2>c;c++)for(var e=document.getElementsByTagName(0==c?"INPUT":"TEXTAREA"),g=0;g<e.length;g++)if(e[g].kmwInput){var d=document.createElement("DIV");d.base=d.base=e[g];d.base.className=d.base.className?d.base.className+" keymanweb-font":"keymanweb-font";e[g].kmw_ip=d;b.inputList.push(d)}else e[g].addEventListener("touchstart",
function(){b.focusing=!1;clearTimeout(b.focusTimer);a.hideNow()},!1);for(var f,m,k,j,o,l,g=0;g<b.inputList.length;g++)d=b.inputList[g],d.className="keymanweb-input",d.dir=d.base.dir,f=document.createElement("DIV"),e=window.getComputedStyle(d.base,null),c=d.style,c.overflow="hidden",c.position="absolute",c.border="hidden",c.border="none",c.borderRadius="5px",o=document.createElement("DIV"),m=o.style,m.position="absolute",m.height=m.width="4px",m.left=m.top="0",m.display="block",m.visibility="hidden",
m.backgroundColor="#808080",m.borderRadius="2px",m=document.createElement("SPAN"),k=document.createElement("SPAN"),j=document.createElement("SPAN"),m.innerHTML=k.innerHTML=j.innerHTML="",m.className=k.className=j.className="keymanweb-font",f.appendChild(m),f.appendChild(j),f.appendChild(k),d.appendChild(f),d.appendChild(o),f=f.style,f.position="absolute",o=m.style,l=k.style,j=j.style,o.border=l.border="none",o.height=l.height="100%",o.fontFamily=l.fontFamily=f.fontFamily=e.fontFamily,"INPUT"==d.base.nodeName&&
!isNaN(parseInt(e.height,10))&&(o.lineHeight=l.lineHeight=e.height),j.border="1px solid red",j.visibility="hidden",j.marginLeft=j.marginRight="-1px",c.padding="8px",f.padding="0px 2px",f.backgroundColor="Android"==i.OS&&"transparent"==e.backgroundColor?"#fff":e.backgroundColor,d.tabIndex="0",d.style.msTouchAction="none",d.addEventListener("touchstart",b.setFocus),d.onmspointerdown=function(c){c.preventDefault();c.stopPropagation();return b.setFocus(c)},d.addEventListener("touchend",function(c){c.stopPropagation()}),
d.onmspointerup=function(c){c.stopPropagation()},d.addEventListener("touchmove",b.dragInput,!1),d.onmspointermove=b.dragInput,d.onblur=b.setBlur,m.style.whiteSpace="TEXTAREA"==d.base.nodeName?k.style.whiteSpace="pre-wrap":k.style.whiteSpace="pre",d.base.parentNode.appendChild(d),b.updateInput(d),c=d.style,c.color=e.color,c.fontFamily=e.fontFamily,c.fontSize=e.fontSize,c.fontWeight=e.fontWeight,c.textDecoration=e.textDecoration,c.padding=e.padding,c.margin=e.margin,c.border=e.border,c.borderRadius=
e.borderRadius,"webkitTapHighlightColor"in c&&(c.webkitTapHighlightColor="rgba(0,0,0,0)"),"TEXTAREA"==d.base.nodeName?(2==d.base.rows&&(m=parseInt(e.height,10)-parseInt(e.paddingTop,10)-parseInt(e.paddingBottom,10),e=parseInt(e.fontSize,10),e=Math.round(m/e),e>d.base.rows+1&&(d.base.rows=e)),f.width=c.width,f.minHeight=c.height):(f.minWidth=c.width,f.height=c.height),d.base.style.visibility="hidden",function(c){c.base.addEventListener("resize",function(){b.updateInput(c)},false)}(d),b.setText(d,d.base.value,
null)};b.setupDesktopPage=function(){for(var a=0;2>a;a++)for(var c=document.getElementsByTagName(0==a?"INPUT":"TEXTAREA"),e=0;e<c.length;e++)0>c[e].className.indexOf("kmw-disabled")&&!c[e].readOnly&&b.inputList.push(c[e]),c[e].className=c[e].className?c[e].className+" keymanweb-font":"keymanweb-font"};b.getBaseFont=function(){var b=document.getElementsByTagName("INPUT"),c=document.getElementsByTagName("TEXTAREA"),a=0,d;0==b.length&&0==c.length?a=0:0<b.length&&0==c.length?a=1:0==b.length&&0<c.length?
a=2:b[0].offsetTop<c[0].offsetTop?a=1:b[0].offsetTop>c[0].offsetTop?a=2:b[0].offsetLeft<c[0].offsetLeft?a=1:b[0].offsetLeft>c[0].offsetLeft&&(a=2);switch(a){case 0:case 1:h.getStyleValue(b[0],"font-family");case 2:d=h.getStyleValue(c[0],"font-family")}if("undefined"==typeof d||"monospace"==d)d="Arial,sans-serif";return d};b.setFocus=function(){};b.timerID=null;b.getText=function(){return""};b.setText=function(){};b.getTextBeforeCaret=function(){return""};b.setTextBeforeCaret=function(){};b.getTextCaret=
function(){return 0};b.setTextCaret=function(){};b.hideCaret=function(){};b.flashCaret=function(){};b.updateInput=function(){};b.addKeyboards=function(a){0==arguments.length?b.keymanCloudRequest("",!1):b.addKeyboardArray(arguments)};b.addKeyboardArray=function(a){if(b.initialized){if(0!=a.length){var c,e,d,f,m,h=e="";b.cloudList=[];for(c=0;c<a.length;c++){if("string"==typeof a[c]&&0<a[c].length){d=a[c].split("@");f=[""];"english"==d[0].toLowerCase()&&(d[0]="us");1<d.length&&(f=d[1].split(","));for(e=
0;e<f.length;e++)m={id:d[0]},""!=f[e]&&(m.language=f[e]),2<d.length&&(m.version=d[2]),b.cloudList.push(m)}if("object"==typeof a[c]&&null!=a[c])if("string"==typeof a[c].filename)b.addStub(a[c])||alert("To use a custom keyboard, you must specify file name, keyboard name, language, language code and region code.");else if(f=a[c].language,"number"==typeof f.length)for(e=0;e<f.length;e++)b.cloudList.push({id:a[c].id,language:a[c].language[e].id});else b.cloudList.push({id:a[c].id,language:a[c].language.id})}if(0!=
b.cloudList.length){e="&keyboardid=";for(c=0;c<b.cloudList.length;c++)a=b.cloudList[c],d=a.id,m=f="","string"==typeof a.language&&""!=a.language&&(f=a.language),"string"==typeof a.version&&""!=a.version&&(m=a.version),""!=f?(d=d+"@"+f,""!=m&&(d=d+"@"+m)):""!=m&&(d=d+"@@"+m),e=e+h+d,h=",";b.keymanCloudRequest(e,!1)}}}else for(c=0;c<a.length;c++)b.deferredStubs.push(a[c])};b.keymanCloudRequest=function(a,c){var e="https://r.keymanweb.com/api/4.0/",d,f=h._CreateElement("SCRIPT"),e=e+(1<arguments.length&&
c?"languages":"keyboards")+"?jsonp=tavultesoft.keymanweb.register";d="&timerid="+window.setTimeout(function(){b.serverUnavailable(a)},1E4);f.charset="UTF-8";f.src=e+a+d;f.type="text/javascript";try{document.body.appendChild(f)}catch(m){document.getElementsByTagName("head")[0].appendChild(f)}};b.addKeyboardsForLanguage=function(a){b.addLanguageKeyboards(arguments)};b.addLanguageKeyboards=function(a){var c,e,d,f=b.languageList,m,k;if(null==f){e=0==b.languagesPending.length;for(c=0;c<a.length;c++)b.languagesPending.push(a[c]);
e&&b.keymanCloudRequest("",!0)}else{m="";for(c=0;c<a.length;c++){d=a[c].toLowerCase();(k="$"==d.substr(-1,1))&&(d=d.substr(0,d.length-1));for(e=0;e<f.length;e++)if(d==f[e].name.toLowerCase()){""!=m&&(m+=",");m=m+"@"+f[e].id;k&&(m+="$");break}}""==m?h.alert("No keyboards are available for "+a[0]+". Does it have another language name?"):b.keymanCloudRequest("&keyboardid="+m,!1)}};b.addStub=function(a){if("string"!=typeof a.id||"undefined"==typeof a.language)return!1;"string"!=typeof a.name&&(a.name=
a.id.replace("_"," "),a.name=a.name.substr(0,1).toUpperCase()+a.name.substr(1));var c=a.language,e=[];"undefined"==typeof c.length?e[0]=c:e=c;for(var d={keyboardBaseUri:b.options.keyboards,fontBaseUri:b.options.fonts},c=0;c<e.length;c++)b.mergeStub(a,e[c],d);return!0};b.findStub=function(a,c){var e,d=b._KeyboardStubs;for(e=0;e<d.length;e++)if(d[e].KI=="Keyboard_"+a&&d[e].KLC==c)return d[e];return null};b.regions="World;Africa;Asia;Europe;South America;North America;Oceania;Central America;Middle East".split(";");
b.regionCodes="un af as eu sa na oc ca me".split(" ");b.mergeStub=function(a,c,e){var d=b.findStub(a.id,c.id);null==d&&(d={KI:"Keyboard_"+a.id,KLC:c.id},b._KeyboardStubs.push(d));var f=c.region,m=0;if("number"==typeof f)m=1>f||9<f?0:f-1;else if("string"==typeof f)for(var h=2==f.length?b.regionCodes:b.regions,j=0;j<h.length;j++)if(f.toLowerCase()==h[j].toLowerCase()){m=j;break}f=null;"undefined"==typeof d.KL&&(d.KL=c.name);"undefined"==typeof d.KR&&(d.KR=b.regions[m]);"undefined"==typeof d.KRC&&(d.KRC=
b.regionCodes[m]);"undefined"==typeof d.KN&&(d.KN=a.name);"undefined"==typeof d.KF&&(f=/^(([.]\/)|([.][.]\/)|(\/))|(:)/,d.KF=a.filename,f.test(d.KF)||(d.KF=e.keyboardBaseUri+d.KF));a=e.fontBaseUri;""!=b.options.fonts?(a=b.options.fonts,f=/^https?:/,f.test(a)||(a="//"==a.substr(0,2)?b.protocol+a:"/"==a.substr(0,1)?b.rootPath+a.substr(1):b.rootPath+a)):b.options.fonts=a;"undefined"==typeof d.KFont&&"undefined"!=typeof c.font&&(e=d.KFont=c.font,e.files=e.source,e.path=a);"undefined"==typeof d.KOskFont&&
"undefined"!=typeof c.oskFont&&(e=d.KOskFont=c.oskFont,e.files=e.source,e.path=a);b.doKeyboardRegistered(d.KI,d.KL,d.KN,d.KLC);1==b._KeyboardStubs.length&&"complete"==document.readyState&&b._SetActiveKeyboard(d.KI,d.KLC)};b.registerLanguagesForKeyboard=function(a,c,e){var d,f,h,k=0;d="";if("undefined"!=typeof a)if("string"==typeof c.keyboardid&&(d=c.keyboardid.split(",")[e]),"number"==typeof a.length)if(1==a.length||"$"==d.substr(-1,1)||""==d)for(d=0;d<a.length;d++)b.registerLanguagesForKeyboard(a[d],
c,e);else{for(d=0;d<a.length;d++){h=a[d].id.toLowerCase();"us"==h&&(h="english");for(f=0;f<a[d].languages.length;f++)if(h==a[d].languages[f].name.toLowerCase()){k=d;break}}b.registerLanguagesForKeyboard(a[k],c,e)}else if(e=d.split("@")[1],"string"==typeof e&&(e=e.replace(/\$$/,"")),k=a.languages,"undefined"!=typeof k)if("number"==typeof k.length)for(d=0;d<k.length;d++)("undefined"==typeof e||k[d].id==e)&&b.mergeStub(a,k[d],c);else b.mergeStub(a,k,c)};b.register=function(a){var c=a.options;a.timerid&&
window.clearTimeout(a.timerid);if("string"==typeof a.error)c="","string"==typeof a.keyboardid&&(c=a.keyboardid.substr(0,1).toUpperCase()+a.keyboardid.substr(1)),b.serverUnavailable(c+" keyboard not found.");else if(!("undefined"==typeof c||"undefined"==typeof c.context))if("keyboard"==c.context){var e=a.keyboard;if("number"==typeof e.length)for(a=0;a<e.length;a++)b.registerLanguagesForKeyboard(e[a],c,a);else b.registerLanguagesForKeyboard(e,c,0)}else"language"==c.context&&(b.languageList=a.languages,
b.languagesPending&&b.addLanguageKeyboards(b.languagesPending),b.languagesPending=[])};b.serverUnavailable=function(a){h.alert(""==a?"Unable to connect to Keyman Cloud server!":a);b.warned=!0};b.removeKeyboards=function(a){if(0!=arguments.length){var c,e,d=b._KeyboardStubs;for(c=0;c<arguments.length;c++)for(e=d.length-1;0<=e;e--)if("Keyboard_"+arguments[c]==d[e].KI&&1<d.length){d.splice(e,1);break}b._SetActiveKeyboard(d[0].KI,d[0].KLC,!0);b.doKeyboardUnregistered()}};if(document.selection){var j=
navigator.appVersion;"undefined"==typeof document.createEventObject&&(0<=j.indexOf("MSIE 5.0")||0<=j.indexOf("MSIE 4.0")||0<=j.indexOf("MSIE 3.0"))?b.legacy=1:0<=j.indexOf("MSIE 6.0")?b._IE=6:0<=j.indexOf("MSIE 7.0")?b._IE=7:0<=j.indexOf("MSIE 8.0")&&(b._IE=8);b._IE&&"BackCompat"==document.compatMode&&(b._IE=6)}a._BaseLayout="undefined"!==typeof window.KeymanWeb_BaseLayout?window.KeymanWeb_BaseLayout:"us";b._BrowserIsSafari=0<=navigator.userAgent.indexOf("AppleWebKit");b._GetEventObject=function(a){if(!a&&
(a=window.event,!a&&(a=b._GetLastActiveElement()))){if(a=a.ownerDocument)a=a.parentWindow;if(!a)return null;a=a.event}return a};b._push=function(a,c){a.push?a.push(c):a=a.concat(c);return a};b._IsAttached=function(a){for(var c=0;c<b._AttachedElements.length;c++)if(b._AttachedElements[c]==a)return 1;return 0};b.attachToControl=b.attachToControl=function(a){var c=a.attributes.readonly,e=a.className;!("object"==typeof c&&"false"!=c.value)&&!("string"==typeof e&&0<=e.indexOf("kmw-disabled"))&&("iframe"==
a.tagName.toLowerCase()?b._AttachToIframe(a):(h.attachDOMEvent(a,"focus",b._ControlFocus),h.attachDOMEvent(a,"blur",b._ControlBlur),a.onkeypress=b._KeyPress,a.onkeydown=b._KeyDown,a.onkeyup=b._KeyUp),b._IsAttached(a)||b._AttachedElements.push(a))};b._AttachToIframe=function(a){try{var c=a.contentWindow.document;if(c)if(c.parentWindow){if("on"==c.designMode.toLowerCase()||c.body.isContentEditable)h.attachDOMEvent(a,"focus",b._ControlFocus),h.attachDOMEvent(a,"blur",b._ControlBlur),h.attachDOMEvent(c,
"keydown",b._KeyDown),h.attachDOMEvent(c,"keypress",b._KeyPress),h.attachDOMEvent(c,"keyup",b._KeyUp),b.legacy||(h.attachDOMEvent(c,"selectionchange",b._SelectionChange),b._SelectionChange())}else"on"==c.designMode.toLowerCase()?(h.attachDOMEvent(c,"focus",b._ControlFocus),h.attachDOMEvent(c,"blur",b._ControlBlur),h.attachDOMEvent(c,"keydown",b._KeyDown),h.attachDOMEvent(c,"keypress",b._KeyPress),h.attachDOMEvent(c,"keyup",b._KeyUp)):b._AttachToControls(c)}catch(e){}};b.GetEnabled=function(){return b._Enabled};
b.SetEnabled=function(a){a=a?1:0;b._Enabled!=a&&(b._Enabled=a,!a&&b.HideInterface&&b.HideInterface())};b.DisableControl=function(a){var c;for(c=0;c<b._Controls.length;c++)if(b._Controls[c].LControl==a){b._Controls[c].LEnabled=0;return}b._Controls=b._push(b._Controls,{LControl:a,LEnabled:0,LDefaultInternalName:"-"})};b.EnableControl=function(a){var c;for(c=0;c<b._Controls.length;c++)if(b._Controls[c].LControl==a){b._Controls[c].LEnabled=1;return}b._Controls=b._push(b._Controls,{LControl:a,LEnabled:1,
LDefaultInternalName:"-"})};b.SetDefaultKeyboardForControl=function(a,c){var e;for(e=0;e<b._Controls.length;e++)if(b._Controls[e].LControl==a){b._Controls[e].LDefaultInternalName=c;return}b._Controls=b._push(b._Controls,{LControl:a,LEnabled:1,LDefaultInternalName:c})};b.focusLastActiveElement=b._FocusLastActiveElement=function(){b._LastActiveElement&&(b._JustActivatedKeymanWebUI=1,b._IsMozillaEditableIframe(b._LastActiveElement,0)?b._LastActiveElement.defaultView.focus():b._LastActiveElement.focus&&
b._LastActiveElement.focus())};b.getLastActiveElement=b._GetLastActiveElement=function(){return b._LastActiveElement};b.setActiveElement=b.setActiveElement=function(a,c){"string"==typeof a&&(a=document.getElementById(a));b._ActiveElement=b._LastActiveElement=a;1<arguments.length&&c&&(i.touchable?b.setFocus():b.focusLastActiveElement())};b.getUIState=b.getUIState=function(){var a={};a.activationPending=a.activationPending=b._IsActivatingKeymanWebUI;a.activated=a.activated=b._JustActivatedKeymanWebUI;
return a};b.activatingUI=function(a){b._IsActivatingKeymanWebUI=a?1:0};b._ControlFocus=function(g){var c;if(!b._Enabled)return!0;g=b._GetEventObject(g);if(!g)return!0;if(g.target)g=g.target;else if(g.srcElement)g=g.srcElement;else return!0;if(i.touchable&&(null==g.className||0>g.className.indexOf("keymanweb-input")))return!0;c=g.nodeName.toLowerCase();if("input"==c){if(c=g.type.toLowerCase(),!("text"==c||"search"==c))return!0}else if("textarea"!=c)return!0;b._ActiveElement=g;3==g.nodeType&&(g=g.parentNode);
var e=g;i.touchable&&(null==g.className||0>g.className.indexOf("keymanweb-input"))&&b.scrollBody(g);"IFRAME"==g.tagName&&(b._AttachToIframe(g),g=g.contentWindow.document);b._ActiveControl=null;b._LastActiveElement=g;for(c=0;c<b._Controls.length;c++)if(b._Controls[c].LControl==g){b._ActiveControl=b._Controls[c];break}null!=b._ActiveControl&&null!=b._ActiveControl.LDefaultInternalName&&(b._JustActivatedKeymanWebUI?b._ActiveControl.LDefaultInternalName=null==b._ActiveKeyboard?"":b._ActiveKeyboard.KI:
b._SetActiveKeyboard(b._ActiveControl.LDefaultInternalName,"",!0));if(!b._IsIEEditableIframe(g,1)||!b._IsMozillaEditableIframe(g,1))return b._DisableInput=1,!0;b._DisableInput=0;b._JustActivatedKeymanWebUI||(b._DeadKeys=[],b._NotifyKeyboard(0,g,1));!b._JustActivatedKeymanWebUI&&b._SelectionControl!=g&&(b._IsActivatingKeymanWebUI=0);b._JustActivatedKeymanWebUI=0;b._SelectionControl=g;g._KeymanWebSelectionStart=g._KeymanWebSelectionEnd=null;b._SetTargDir(g);b.doControlFocused(e,b._ActiveControl);i.touchable?
a._Enabled=1:a.ready&&(b.isCJK()&&(a._Enabled=1),a._Enabled?a._Show():a._Hide(!1));return!0};b._IsIEEditableIframe=function(a,c){var b,d=a&&(b=a.tagName)&&"body"==b.toLowerCase()&&(b=a.ownerDocument)&&b.parentWindow;return!c&&d||c&&(!d||a.isContentEditable)};b._IsMozillaEditableIframe=function(a,c){var b,d=a&&(b=a.defaultView)&&b.frameElement;return!c&&d||c&&(!d||"on"==b.document.designMode.toLowerCase())};b._ControlBlur=function(g){var c;if(!b._Enabled)return!0;g=b._GetEventObject(g);if(!g)return!0;
if(g.target)c=g.target;else if(g.srcElement)c=g.srcElement;else return!0;b._ActiveElement=null;i.touchable&&b.hideCaret();3==c.nodeType&&(c=c.parentNode);"IFRAME"==c.tagName&&(c=c.contentWindow.document);c.setSelectionRange&&(c._KeymanWebSelectionStart=c.value._kmwCodeUnitToCodePoint(c.selectionStart),c._KeymanWebSelectionEnd=c.value._kmwCodeUnitToCodePoint(c.selectionEnd));b._LastActiveElement=c;null!=b._ActiveControl&&null!=b._ActiveControl.LDefaultInternalName&&(b._ActiveControl.LDefaultInternalName=
null==b._ActiveKeyboard?"":b._ActiveKeyboard.KI);b._ActiveControl=null;b._IsActivatingKeymanWebUI||b._NotifyKeyboard(0,c,0);g=b._GetEventObject(g);b.doControlBlurred(c,g,b._IsActivatingKeymanWebUI);a.ready&&!b._IsActivatingKeymanWebUI&&a._Hide(!1);return!0};b.doControlBlurred=function(a,c,b){var d={};d.target=a;d.event=c;d.isActivating=b;return h.callEvent("kmw.controlblurred",d)};b.doControlFocused=function(a,c){var b={};b.target=a;b.activeControl=c;return h.callEvent("kmw.controlfocused",b)};b.doKeyboardRegistered=
function(a,c,b,d){return h.callEvent("kmw.keyboardregistered",{internalName:a,language:c,keyboardName:b,languageCode:d})};b.doKeyboardUnregistered=function(){return h.callEvent("kmw.keyboardregistered",{})};b.doKeyboardLoaded=function(a){var c={};c.keyboardName=a;return h.callEvent("kmw.keyboardloaded",c)};b.doBeforeKeyboardChange=function(a,c){var b={};b.internalName=a;b.languageCode=c;return h.callEvent("kmw.beforekeyboardchange",b)};b.doKeyboardChange=function(a,c,b){var d={};d.internalName=a;
d.languageCode=c;d.indirect=2<arguments.length?b:!1;return h.callEvent("kmw.keyboardchange",d)};b.doUnloadOSK=function(){return h.callEvent("kmw.unloadosk",{})};b.doLoadUI=function(){return h.callEvent("kmw.loaduserinterface",{})};b.doUnloadUI=function(){return h.callEvent("kmw.unloaduserinterface",{})};b._BubbledFocus=function(){};window.addEventListener&&window.addEventListener("focus",b._BubbledFocus,!0);b._GetKeyEventProperties=function(a){var c={},a=b._GetEventObject(a);if(!a||!0===a.cancelBubble)return null;
if(a.target)c.Ltarg=a.target;else if(a.srcElement)c.Ltarg=a.srcElement;else return null;3==c.Ltarg.nodeType&&(c.Ltarg=c.Ltarg.parentNode);if(a.keyCode)c.Lcode=a.keyCode;else if(a.which)c.Lcode=a.which;else return null;c.Lmodifiers=(a.shiftKey?16:0)|(a.ctrlKey?32:0)|(a.altKey?64:0);c.LisVirtualKeyCode="undefined"!=typeof a.charCode&&null!=a.charCode&&(0==a.charCode||0!=(c.Lmodifiers&96));c.LisVirtualKey=c.LisVirtualKeyCode||"keypress"!=a.type;return c};b._SelectionChange=function(){if(b._IgnoreNextSelChange)b._IgnoreNextSelChange--;
else{var a=document.selection;if("control"!=a.type.toLowerCase()&&(a=a.createRange(),!b._Selection||!b._Selection.isEqual(a)))b._Selection=a,b._DeadKeys=[]}return!0};b._FindCaret=function(a){if(!a.createTextRange&&a.selectionStart){var c=document.createEvent("KeyboardEvent");if(c.initKeyEvent){c.initKeyEvent("keypress",!0,!0,null,!1,!1,!1,!1,0,32);var e=b._KeyPress;b._KeyPress=function(){};a.dispatchEvent(c);c=document.createEvent("KeyboardEvent");c.initKeyEvent("keypress",!0,!0,null,!1,!1,!1,!1,
8,0);a.dispatchEvent(c);b._KeyPress=e}}};b._NotifyKeyboard=function(a,c,e){null!=b._ActiveKeyboard&&"function"==typeof b._ActiveKeyboard.KNS&&b._ActiveKeyboard.KNS(a,c,e)};b._KeyDown=function(g){var c;b._KeyPressToSwallow=0;if(!b._Enabled||b._DisableInput||null==b._ActiveKeyboard||null!=b._ActiveControl&&!b._ActiveControl.LEnabled)return!0;var e=h.eventTarget(g);if(i.touchable){if(e&&"undefined"!=typeof e.kmwInput&&!1==e.kmwInput)return!0}else if(e&&0<=e.className.indexOf("kmw-disabled"))return!0;
if(!a.ready)return!0;e=b._GetKeyEventProperties(g);if(null==e)return!0;switch(e.Lcode){case 8:b._DeadKeys=[];break;case 16:case 17:case 18:return b._NotifyKeyboard(e.Lcode,e.Ltarg,1),a._UpdateVKShift(e,e.Lcode-15,1)}(c=e.Ltarg.ownerDocument)&&((c=c.selection)&&(33>e.Lcode||40<e.Lcode))&&c.createRange().select();!window.event&&b._VKMap_FF_IE["k"+e.Lcode]&&(e.Lcode=b._VKMap_FF_IE["k"+e.Lcode]);if(b._ActiveKeyboard.KM){if(8==e.Lcode)return b._KeyPressToSwallow=1,b.callKeyboardStartGroup(e.Ltarg,e)||
b.KO(1,b._LastActiveElement,""),!1;b._KeyPressToSwallow=0}else{var d=0;if((c=b._VKMap[a._BaseLayout])&&c["k"+e.Lcode])e.Lcode=c["k"+e.Lcode];"undefined"==typeof b._ActiveKeyboard.KM&&!(e.Lmodifiers&96)&&(c={Lcode:b._USKeyCodeToCharCode(e),Ltarg:e.Ltarg,Lmodifiers:0,LisVirtualKey:0},b.callKeyboardStartGroup(c.Ltarg,c)&&(d=1));d=d||b.callKeyboardStartGroup(e.Ltarg,e);8==e.Lcode&&(!d&&null!=e.Ltarg.className&&0<=e.Ltarg.className.indexOf("keymanweb-input"))&&b.KO(1,b._LastActiveElement,"")}!d&&(96<=
e.Lcode&&111>=e.Lcode)&&(b.KO(0,e.Ltarg,String._kmwFromCharCode(106>e.Lcode?e.Lcode-48:e.Lcode-64)),d=1);if(d)return b._FindCaret(e.Ltarg),g&&g.preventDefault&&g.preventDefault(),b._KeyPressToSwallow=g?g.keyCode:0,!1;b._KeyPressToSwallow=0;return 8==e.Lcode&&null!=e.Ltarg.className&&0<=e.Ltarg.className.indexOf("keymanweb-input")?!1:!0};b.callKeyboardStartGroup=function(a,c){b._CachedSelectionStart=null;b._DeadkeyResetMatched();b.cachedContext.reset();return b._ActiveKeyboard.gs(a,c)};b._KeyPress=
function(a){var c;if(!b._Enabled||b._DisableInput||null==b._ActiveKeyboard||null!=b._ActiveControl&&!b._ActiveControl.LEnabled)return!0;c=b._GetKeyEventProperties(a);if(null==c||c.LisVirtualKey)return!0;if(!b._ActiveKeyboard.KM){if(!b._KeyPressToSwallow||32>c.Lcode||b._BrowserIsSafari&&63232<c.Lcode&&63744>c.Lcode)return!0;if(a=b._GetEventObject(a))a.returnValue=!1;return!1}if(b._KeyPressToSwallow||b.callKeyboardStartGroup(c.Ltarg,c))return b._KeyPressToSwallow=0,a&&a.preventDefault&&a.preventDefault(),
b._FindCaret(c.Ltarg),!1;b._KeyPressToSwallow=0;return!0};b._KeyUp=function(g){g=b._GetKeyEventProperties(g);if(null==g||!a.ready)return!0;switch(g.Lcode){case 13:if("TEXTAREA"==g.Ltarg.nodeName)break;"search"==g.Ltarg.type||"submit"==g.Ltarg.type?g.Ltarg.form.submit():b.moveToNext(!1);return!0;case 16:case 17:case 18:return b._NotifyKeyboard(g.Lcode,g.Ltarg,0),a._UpdateVKShift(g,g.Lcode-15,1)}var c;if((c=g.Ltarg.ownerDocument)&&(c=c.selection)&&"control"!=c.type)c=c.createRange(),b._Selection=c;
return!1};b.moveToNext=function(a){var c,e=b.sortedInputs,d=b._ActiveElement;i.touchable&&(d=d.base);for(c=0;c<e.length&&e[c]!=d;c++);c=a?c-1:c+1;c>=e.length&&(c-=e.length);0>c&&(c+=e.length);i.touchable?(b.focusing=!0,a=e[c].kmw_ip,"undefined"==typeof a?e[c].focus():(b._ActiveElement=b._LastActiveElement=a,b.setTextCaret(a,1E4),b.scrollInput(a))):e[c].focus()};b.moveToElement=function(a){"string"==typeof a&&(a=document.getElementById(a));i.touchable&&a.kmw_ip?a.kmw_ip.focus():a.focus()};b._SetActiveKeyboard=
function(g,c,e){var d,f,m;m=2>arguments.length||!c?"---":c;for(d=0;d<b._KeyboardStubs.length&&!(g==b._KeyboardStubs[d].KI&&(m==b._KeyboardStubs[d].KLC||"---"==m));d++);if(i.touchable&&(""==g||null==g||d>=b._KeyboardStubs.length))g=b._KeyboardStubs[0].KI,m=b._KeyboardStubs[0].KLC;2<arguments.length&&e&&b.saveCurrentKeyboard(g,m);if(!b._ActiveStub||!b._ActiveKeyboard||!(b._ActiveKeyboard.KI==g&&b._ActiveStub.KI==g&&b._ActiveStub.KLC==c&&!b.mustReloadKeyboard)){if(b._ActiveKeyboard&&b._ActiveKeyboard.KI==
g)for(f=0;f<b._KeyboardStubs.length;f++)if(b._KeyboardStubs[f].KI==g&&b._KeyboardStubs[f].KLC==c){b._ActiveStub=b._KeyboardStubs[f];a.appendStyleSheet();b.mustReloadKeyboard&&a._Load();return}b._ActiveKeyboard=null;b._ActiveStub=null;if(""==g)a._Hide(!1);else{for(f=0;f<b._Keyboards.length;f++)if(b._Keyboards[f].KI==g){b._ActiveKeyboard=b._Keyboards[f];b._SetTargDir(b._LastActiveElement);for(d=0;d<b._KeyboardStubs.length;d++)if(b._KeyboardStubs[d].KI==g&&b._KeyboardStubs[d].KLC==c){b._ActiveStub=b._KeyboardStubs[d];
break}break}if("undefined"==c||""==c)c="---";if(null==b._ActiveKeyboard){for(f=0;f<b._KeyboardStubs.length;f++)if(b._KeyboardStubs[f].KI==g&&(b._KeyboardStubs[f].KLC==c||"---"==c)){if(b.isCJK(b._KeyboardStubs[f])||i.touchable)a._Enabled=1;if(null==b._LoadingInternalName||b._LoadingInternalName!=g)a.ready&&a._Hide(!1),b._LoadingInternalName=g,null!=b.loadTimer&&window.clearTimeout(b.loadTimer),b.loadTimer=null,b.loadTimer="function"==typeof b.keyboardUnavailable?b.keyboardUnavailable(f):null,d="Installing keyboard<br/>"+
b._KeyboardStubs[f].KN.replace(/\s*keyboard\s*/i,""),"function"==typeof h.wait&&h.wait(d),window.setTimeout(function(){b.installKeyboard(b._KeyboardStubs[f].KF)},0);b._ActiveStub=b._KeyboardStubs[f];return}b._SetTargDir(b._LastActiveElement)}d=b._ActiveKeyboard;null!==d&&String.kmwEnableSupplementaryPlane(d&&(d.KS&&1==d.KS||"Hieroglyphic"==d.KN));a._Load()}}};b.installKeyboard=function(a){var c=h._CreateElement("SCRIPT");c.charset="UTF-8";c.src=b.getKeyboardPath(a);c.type="text/javascript";try{document.body.appendChild(c)}catch(e){document.getElementsByTagName("head")[0].appendChild(c)}};
b.setDfltKeyboard=function(){b._SetActiveKeyboard("Keyboard_us","eng",!0);b.doKeyboardChange("Keyboard_us","eng",!0)};b.isCJK=function(a){var c=b._ActiveKeyboard,e="";0<arguments.length&&(c=a);c&&("undefined"!=typeof c.KLC?e=c.KLC:"undefined"!=typeof c.LanguageCode&&(e=c.LanguageCode));return"cmn"==e||"jpn"==e||"kor"==e};b.isCJK=b.isCJK;b.setActiveKeyboard=function(a,c){b.doBeforeKeyboardChange(a,c);b._SetActiveKeyboard(a,c,!0);null!=b._LastActiveElement&&b._FocusLastActiveElement();b.doKeyboardChange(a,
c)};b.getActiveKeyboard=function(){return null==b._ActiveKeyboard?"":b._ActiveKeyboard.KI};b.getActiveLanguage=function(){return null==b._ActiveStub?"":b._ActiveStub.KLC};b.getKeyboard=function(a,c){var e,d;for(e=0;e<b._KeyboardStubs.length;e++)if(d=b._GetKeyboardDetail(b._KeyboardStubs[e]),d.InternalName==a&&(2>arguments.length||d.LanguageCode==c))return d;return null};b.GetKeyboardDetail=function(a){for(var c=b.getKeyboards(),e=0;e<c.length;e++)if(c[e].InternalName==a)return c[e];return null};b._GetKeyboardDetail=
function(a){var c=[];c.Name=a.KN;c.InternalName=a.KI;c.LanguageName=a.KL;c.LanguageCode=a.KLC;c.RegionName=a.KR;c.RegionCode=a.KRC;c.CountryName=a.KC;c.CountryCode=a.KCC;c.KeyboardID=a.KD;c.Font=a.KFont;c.OskFont=a.KOskFont;return c};b.getKeyboards=function(){var a=[],c,e;for(c=0;c<b._KeyboardStubs.length;c++)e=b._KeyboardStubs[c],e=b._GetKeyboardDetail(e),a=b._push(a,e);return a};b._WindowUnload=function(){b.doUnloadUI();a.ready&&a._Unload();b._LastActiveElement=0};h.attachDOMEvent(window,"load",
function(){document.body.scrollTop=0;"undefined"!=typeof document.documentElement&&(document.documentElement.scrollTop=0)},!1);h.attachDOMEvent(window,"unload",b._WindowUnload,!1);b._AttachToControls=function(a){for(var c=a.getElementsByTagName("INPUT"),e=a.getElementsByTagName("TEXTAREA"),d=a.getElementsByTagName("IFRAME"),a=document.evaluate?document.evaluate('//*[@contenteditable and @contenteditable != "false"]',document,null,XPathResult.ANY_TYPE,null):null,f=0;f<c.length;f++)"text"==c[f].type.toLowerCase()&&
b.attachToControl(c[f]);for(f=0;f<e.length;f++)b.attachToControl(e[f]);for(f=0;f<d.length;f++)try{d[f].contentWindow.document&&b._AttachToIframe(d[f])}catch(h){}if(a)for(c=a.iterateNext();c;c=a.iterateNext())b.attachToControl(c);for(f=0;f<b.inputList.length;f++)b.attachToControl(b.inputList[f])};b.fixPath=function(a){if(0==a.length)return a;var c=a.substr(a.length-1,1);return"/"==c||"\\"==c?a:a+"/"};b.init=b.init=function(g){var c,e,d,f,m,k;e=function(c){if(0==c.length)return c;"/"!=c.substr(c.length-
1,1)&&(c+="/");return"http"==c.replace(/^(http)s?:.*/,"$1")||"file"==c.replace(/^(file):.*/,"$1")?c:"//"==c.substr(0,2)?b.protocol+c:"/"==c.substr(0,1)?b.rootPath+c.substr(1):b.srcPath+c};c=b.options;if("object"==typeof g&&null!==g)for(f in c)g.hasOwnProperty(f)&&(c[f]=g[f]);""!=c.root&&(b.rootPath=e(c.root));""==c.resources&&(c.resources=b.srcPath);c.resources=e(c.resources);c.keyboards=e(c.keyboards);c.fonts=e(c.fonts);""==c.attachType&&(c.attachType=i.touchable?"manual":"auto");b.setDefaultDeviceOptions(c);
if(!b.initialized)if("complete"!==document.readyState)window.setTimeout(function(){b.init(g)},50);else{b._MasterDocument=window.document;if(i.touchable){m=document.getElementsByTagName("textarea");k=document.getElementsByTagName("input");for(c=0;c<m.length;c++)if(d=m[c],e=d.className,d.kmwInput=!1,(!e||0>e.indexOf("kmw-disabled"))&&!d.readOnly)d.disabled=!0,d.kmwInput=!0;for(c=0;c<k.length;c++)if(d=k[c],e=d.className,d.kmwInput=!1,(!e||0>e.indexOf("kmw-disabled"))&&!d.readOnly)if("text"==d.type||
"search"==d.type)d.disabled=!0,d.kmwInput=!0}"Android"==i.OS&&(i.dpi=h.getDPI(),i.formFactor=screen.height<4*i.dpi||screen.width<4*i.dpi?"phone":"tablet");window.removeEventListener&&window.removeEventListener("focus",b._BubbledFocus,!0);"manual"!=b.options.attachType&&b._AttachToControls(document);b.initialized=1;a.prepare();h.prepareWait();b.addKeyboardArray(b.deferredStubs);for(c=0;c<b.deferredKRS.length;c++)b.KRS(b.deferredKRS[c]);b.initializeUI();for(c=0;c<b.deferredKR.length;c++)b.KR(b.deferredKR[c]);
b.fullInitialization&&(b.appliedFont=b.baseFont=b.getBaseFont(),b.listInputs(),i.touchable&&b.handleRotationEvents(),i.touchable?b.setupTouchDevice():b.setupDesktopPage(),6==h._GetIEVersion()&&(a.shim=h.createShim()),i.touchable&&(a._Box.addEventListener("touchend",function(c){c.stopPropagation()},!1),c=document.createElement("DIV"),e=c.style,e.width="100%",e.height=screen.width/2+"px",document.body.appendChild(c),"Android"==i.OS&&0<navigator.userAgent.indexOf("Chrome")?(b.hideOskWhileScrolling=function(c){if(typeof a._Box!=
"undefined"&&typeof a._Box.style!="undefined"){f=c.target.parentNode;if(typeof f!="undefined"&&f!=null){if(f.className.indexOf("keymanweb-input")>=0||f.className.indexOf("kmw-key-")>=0)return;if(typeof f.parentNode!="undefined"){f=f.parentNode;if(f.className.indexOf("keymanweb-input")>=0||f.className.indexOf("kmw-key-")>=0)return}}a.hideNow()}},document.body.addEventListener("touchstart",b.hideOskWhileScrolling,!1)):(b.conditionallyHideOsk=function(){b.hideOnRelease&&!a.lgList&&a.hideNow();b.hideOnRelease=
false},b.hideOskIfOnBody=function(c){b.touchY=c.touches[0].screenY;b.hideOnRelease=true},b.cancelHideIfScrolling=function(c){var c=c.touches[0].screenY,a=b.touchY;if(c-a>5||a-c<5)b.hideOnRelease=false},document.body.addEventListener("touchstart",b.hideOskIfOnBody,!1),document.body.addEventListener("touchmove",b.cancelHideIfScrolling,!1),document.body.addEventListener("touchend",b.conditionallyHideOsk,!1))),a.shim&&document.body.appendChild(a.shim),document.selection&&!b.legacy&&h.attachDOMEvent(document,
"selectionchange",b._SelectionChange),"manual"!=b.options.attachType&&(document.attachEvent?document.attachEvent("onfocusin",b._IEFocusIn):document.addEventListener&&document.addEventListener("DOMNodeInserted",b._DOMNodeInserted,!0)),b.restoreCurrentKeyboard(),b.initialized=2)}};b.listInputs=function(){var a,c=[],e=document.getElementsByTagName("INPUT"),d=document.getElementsByTagName("TEXTAREA");for(a=0;a<e.length;a++)switch(e[a].type){case "text":case "search":case "email":case "url":0>e[a].className.indexOf("kmw-disabled")&&
c.push({ip:e[a],x:h._GetAbsoluteX(e[a]),y:h._GetAbsoluteY(e[a])})}for(a=0;a<d.length;a++)0>d[a].className.indexOf("kmw-disabled")&&c.push({ip:d[a],x:h._GetAbsoluteX(d[a]),y:h._GetAbsoluteY(d[a])});c.sort(function(c,a){return c.y!=a.y?c.y-a.y:c.x-a.x});e=[];for(a=0;a<c.length;a++)e.push(c[a].ip);b.sortedInputs=e};b.initializeUI=function(){"function"==typeof b.ui.initialize?(b.ui.initialize(),a._Show()):window.setTimeout(b.initializeUI,1E3)};b.isPositionSynthesized=function(){return i.touchable};b._SelPos=
function(a){var c,e=999>h._GetIEVersion();if(b.isPositionSynthesized())return b.getTextCaret(a);if(a._KeymanWebSelectionStart)return a._KeymanWebSelectionStart;if(a.setSelectionRange)return a.value.substr(0,a.selectionStart)._kmwLength();if((c=a.ownerDocument)&&(c=c.defaultView)&&c.getSelection&&"on"==a.ownerDocument.designMode.toLowerCase()){if(a=c.getSelection(),3==a.focusNode.nodeType)return a.focusNode.substringData(0,a.focusOffset)._kmwLength()}else if(e){if("string"==typeof a.value)return c=
b.getInputSelection(a),a.value.substr(0,c.start)._kmwLength();if(a=a.body?a:a.ownerDocument)c=a.selection;else return 0;a=c.createRange();a.moveStart("textedit",-1);return a.text._kmwLength()}return 0};b.getInputSelection=function(a){var c=0,b=0,d="",f,h=0;if("number"==typeof a.selectionStart&&"number"==typeof a.selectionEnd)c=a.selectionStart,b=a.selectionEnd;else if((f=document.selection.createRange())&&f.parentElement()==a)h=a.value.length,d=a.value.replace(/\r\n/g,"\n"),b=a.createTextRange(),
b.moveToBookmark(f.getBookmark()),a=a.createTextRange(),a.collapse(!1),-1<b.compareEndPoints("StartToEnd",a)?c=b=h:(c=-b.moveStart("character",-h),c+=d.slice(0,c).split("\n").length-1,-1<b.compareEndPoints("EndToEnd",a)?b=h:(b=-b.moveEnd("character",-h),b+=d.slice(0,b).split("\n").length-1));return{start:c,end:b}};b._DeadkeyResetMatched=function(){var a,c=b._DeadKeys;for(a=0;a<c.length;a++)c[a].matched=0};b._DeadkeyDeleteMatched=function(){var a,c=b._DeadKeys;for(a=0;a<c.length;a++)c[a].matched&&
c.splice(a,1)};b._DeadkeyAdjustPos=function(a,c){var e,d=b._DeadKeys;for(e=0;e<d.length;e++)d[e].p>a&&(d[e].p+=c)};b._SetTargDir=function(a){var c=null!=b._ActiveKeyboard&&b._ActiveKeyboard.KRTL?"rtl":"ltr";a&&(i.touchable?0==a.textContent.length&&(a.base.dir=a.dir=c,b.setTextCaret(a,1E4)):0==a.value.length&&(a.dir=c))};b._IEFocusIn=function(){var a=b._GetEventObject(null);a&&(a=a.srcElement,null!=a&&!b._IsAttached(a)&&("input"==a.tagName.toLowerCase()&&"text"==a.type.toLowerCase()||"textarea"==a.tagName.toLowerCase()||
"iframe"==a.tagName.toLowerCase())&&b.attachToControl(a))};b._DOMNodeInserted=function(a){a=a.target;null!=a&&1==a.nodeType&&b._AttachToControls(a)};b._ResetVKShift=function(){b._IsActivatingKeymanWebUI||a._UpdateVKShift&&a._UpdateVKShift(null,15,0)};b.addHotKey=b.addHotKey=function(a,c,e){for(var d=0;d<b._HotKeys.length;d++)if(b._HotKeys[d].Code==a&&b._HotKeys[d].Shift==c){b._HotKeys[d].Handler=e;return}b._HotKeys.push({Code:a,Shift:c,Handler:e})};b.removeHotKey=b.removeHotKey=function(a,c){for(var e=
0;e<b._HotKeys.length;e++)if(b._HotKeys[e].Code==a&&b._HotKeys[e].Shift==c){b._HotKeys.splice(e,1);break}};b._ProcessHotKeys=function(a){a||(a=window.event);if(a.keyCode)var c=a.keyCode;else if(a.which)c=a.which;else return 0;for(var e=(a.shiftKey?16:0)|(a.ctrlKey?32:0)|(a.altKey?64:0),d=0;d<b._HotKeys.length;d++)if(c==b._HotKeys[d].Code&&e==b._HotKeys[d].Shift)return b._HotKeys[d].Handler(),a.returnValue=0,a&&a.preventDefault&&a.preventDefault(),a.cancelBubble=!0,!1;return!0};h.attachDOMEvent(document,
"keyup",b._ProcessHotKeys,!1);b.saveCurrentKeyboard=function(a,c){h.saveCookie("KeymanWeb_Keyboard",{current:a+":"+c})};b.restoreCurrentKeyboard=function(){var a=b._KeyboardStubs,c,e=a.length;if(!(1>a.length)){c=b.getSavedKeyboard();var d=c.split(":"),d=c.split(":");2>d.length&&(d[1]="");for(c=0;c<e&&!(a[c].KI==d[0]&&(a[c].KLC==d[1]||""==d[1]));c++);if(c<e||null==b._ActiveKeyboard)b._SetActiveKeyboard(d[0],d[1],!1),b.doKeyboardChange(d[0],d[1])}};b.getSavedKeyboard=b.getSavedKeyboard=function(){var a=
h.loadCookie("KeymanWeb_Keyboard");if("string"!=typeof a.current)return"Keyboard_us:eng";var c,e=b._KeyboardStubs,d;for(c=0;c<e.length;c++)if(d=e[c].KI+":"+e[c].KLC,d==a.current)return d;for(c=0;c<e.length;c++)if(d=e[c].KI+":"+e[c].KLC,"Keyboard_us:eng"==d)return d;return 0<e.length?e[0].KI+":"+e[0].KLC:"Keyboard_us:eng"};h.attachDOMEvent(window,"focus",b._ResetVKShift,!1);h.attachDOMEvent(window,"blur",b._ResetVKShift,!1);String.kmwEnableSupplementaryPlane(!1)})();(function(){var b=window.tavultesoft.keymanweb,a=b.osk,h=b.util,i=h.device;a.keyCodes={K_BKSP:8,K_TAB:9,K_ENTER:13,K_SHIFT:16,K_CONTROL:17,K_ALT:18,K_PAUSE:19,K_CAPS:20,K_ESC:27,K_SPACE:32,K_PGUP:33,K_PGDN:34,K_END:35,K_HOME:36,K_LEFT:37,K_UP:38,K_RIGHT:39,K_DOWN:40,K_SEL:41,K_PRINT:42,K_EXEC:43,K_INS:45,K_DEL:46,K_HELP:47,K_0:48,K_1:49,K_2:50,K_3:51,K_4:52,K_5:53,K_6:54,K_7:55,K_8:56,K_9:57,K_A:65,K_B:66,K_C:67,K_D:68,K_E:69,K_F:70,K_G:71,K_H:72,K_I:73,K_J:74,K_K:75,K_L:76,K_M:77,K_N:78,K_O:79,K_P:80,
K_Q:81,K_R:82,K_S:83,K_T:84,K_U:85,K_V:86,K_W:87,K_X:88,K_Y:89,K_Z:90,K_NP0:96,K_NP1:97,K_NP2:98,K_NP3:99,K_NP4:100,K_NP5:101,K_NP6:102,K_NP7:103,K_NP8:104,K_NP9:105,K_NPSTAR:106,K_NPPLUS:107,K_SEPARATOR:108,K_NPMINUS:109,K_NPDOT:110,K_NPSLASH:111,K_F1:112,K_F2:113,K_F3:114,K_F4:115,K_F5:116,K_F6:117,K_F7:118,K_F8:119,K_F9:120,K_F10:121,K_F11:122,K_F12:123,K_NUMLOCK:144,K_SCROLL:145,K_LSHIFT:160,K_RSHIFT:161,K_LCONTROL:162,K_RCONTROL:163,K_LALT:164,K_RALT:165,K_COLON:186,K_EQUAL:187,K_COMMA:188,K_HYPHEN:189,
K_PERIOD:190,K_SLASH:191,K_BKQUOTE:192,K_LBRKT:219,K_BKSLASH:220,K_RBRKT:221,K_QUOTE:222,K_oE2:226,K_LOPT:50001,K_ROPT:50002,K_NUMERALS:50003,K_SYMBOLS:50004,K_CURRENCIES:50005,K_UPPER:50006,K_LOWER:50007,K_ALPHA:50008,K_SHIFTED:50009,K_ALTGR:50010,K_TABBACK:50011,K_TABFWD:50012};var j=[["0123456789",";=,-./`","[\\]'"],[")!@#$%^&*(",":+<_>?~",'{|}"']],g="K_BKQUOTE K_1 K_2 K_3 K_4 K_5 K_6 K_7 K_8 K_9 K_0 K_HYPHEN K_EQUAL K_* K_* K_* K_Q K_W K_E K_R K_T K_Y K_U K_I K_O K_P K_LBRKT K_RBRKT K_BKSLASH K_* K_* K_* K_A K_S K_D K_F K_G K_H K_J K_K K_L K_COLON K_QUOTE K_* K_* K_* K_* K_* K_oE2 K_Z K_X K_C K_V K_B K_N K_M K_COMMA K_PERIOD K_SLASH K_* K_* K_* K_* K_* K_SPACE".split(" ");
a._Box=null;a._DivVKbd=null;a._DivVKbdHelp=null;a._Visible=0;a._Enabled=1;a._VShift=[];a._VKeySpans=[];a._VKeyDown=null;a._VKbdContainer=null;a._VOriginalWidth=1;a._BaseLayout="us";a._BaseLayoutEuro={};a._BaseLayoutEuro.se="\u00a71234567890+\u00b4~~~QWERTYUIOP\u00c5\u00a8'~~~ASDFGHJKL\u00d6\u00c4~~~~~<ZXCVBNM,.-~~~~~ ";a._BaseLayoutEuro.uk="`1234567890-=~~~QWERTYUIOP[]#~~~ASDFGHJKL;'~~~~~\\ZXCVBNM,./~~~~~ ";a.lgTimer=null;a.lgKey=null;a.hkKey=null;a.spaceBar=null;a.lgList=null;a.frameColor="#ad4a28";
a.keyPending=null;a.fontFamily="";a.fontSize="1em";a.layout=null;a.layers=null;a.layerId="default";a.nextLayer="default";a.layerIndex=0;a.currentKey="";a.subkeyDelayTimer=null;a.popupPending=!1;a.popupVisible=!1;a.popupCallout=null;a.styleSheet=null;a.loadRetry=0;a.popupDelay=500;a.currentTarget=null;a.touchCount=0;a.touchX=0;a.deleting=0;a.x=99;a.y=0;a.width=1;a.height=1;a.rowHeight=1;a.nRows=1;a.vpScale=1;a.closeButton=null;a.resizeIcon=null;a.resizing=0;a.pinImg=null;a.userPositioned=0;a.dfltX=
"";a.dfltY="";a.noDrag=!1;a.shim=null;a.keytip=null;a.touchY=0;a.addCallout=function(){};a.addEventListener=function(a,b){return h.addEventListener("osk."+a,b)};a._TitleBarInterior=function(){var c=h._CreateElement("DIV"),e=c.style;e.paddingLeft="2px";e.cursor="move";e.background="#ad4a28";e.font="8pt Tahoma,Arial,sans-serif";e=h._CreateElement("DIV");e.className="kmw-title-bar-actions";e.onmousedown=a._CancelMouse;var d=h._CreateElement("DIV");d.className="kmw-close-button";d.onmousedown=a._CancelMouse;
d.onclick=function(){a._Hide(!0)};a.closeButton=d;e.appendChild(d);a.restorePosition=function(){a._Visible&&(b._FocusLastActiveElement(),a.loadCookie(),a.userPositioned=!1,a.saveCookie(),a._Show(),a.doResizeMove());a.pinImg&&(a.pinImg.style.display="none");window.event&&(window.event.returnValue=!1)};d=a.pinImg=h._CreateElement("DIV");d.className="kmw-pin-image";d.title="Pin the On Screen Keyboard to its default location on the active text box";d.onclick=a.restorePosition;d.onmousedown=a._CancelMouse;
d.style.display="none";i.touchable||e.appendChild(d);c.appendChild(e);d=b._TitleElement=h._CreateElement("SPAN");d.className="kmw-title-bar-caption";d.innerHTML="Tavultesoft KeymanWeb";c.appendChild(d);return c};a.isEnabled=a.isEnabled=function(){return a._Enabled};a.isVisible=a.isVisible=function(){return a._Visible};a.getRect=a.getRect=function(){var c={};a._DivVKbd?(c.left=c.left=h._GetAbsoluteX(a._DivVKbd),c.top=c.top=h._GetAbsoluteY(a._DivVKbd),c.width=c.width=h._GetAbsoluteX(a._DivVKbdHelp)-
h._GetAbsoluteX(a._DivVKbd)+a._DivVKbdHelp.offsetWidth,c.height=c.height=h._GetAbsoluteY(a._DivVKbdHelp)-h._GetAbsoluteY(a._DivVKbd)+a._DivVKbdHelp.offsetHeight):(c.left=c.left=h._GetAbsoluteX(a._Box),c.top=c.top=h._GetAbsoluteY(a._Box),c.width=c.width=h._GetAbsoluteX(a._Box)+a._Box.offsetWidth,c.height=c.height=h._GetAbsoluteY(a._Box)+a._Box.offsetHeight);return c};a.setRect=a.setRect=function(c){if(!(null==a._Box||"desktop"!=i.formFactor)){var b=a._Box,d=b.style;"left"in c&&(d.left=c.left-h._GetAbsoluteX(b)+
b.offsetLeft+"px",a.dfltX=d.left);"top"in c&&(d.top=c.top-h._GetAbsoluteY(b)+b.offsetTop+"px",a.dfltY=d.top);if(null!=a._DivVKbd){var f=a._DivVKbd,d=f.style;if("width"in c){var g=c.width-(b.offsetWidth-f.offsetWidth);g<0.2*screen.width&&(g=0.2*screen.width);g>0.9*screen.width&&(g=0.9*screen.width);d.width=g+"px";a.width=g}"height"in c&&(b=c.height-(b.offsetHeight-f.offsetHeight),b<0.1*screen.height&&(b=0.1*screen.height),b>0.5*screen.height&&(b=0.5*screen.height),d.height=b+"px",d.fontSize=b/8+"px",
a.height=b);"nosize"in c&&a.resizeIcon&&(a.resizeIcon.style.display=c.nosize?"none":"block")}"nomove"in c&&(a.noDrag=c.nomove,a.pinImg&&(a.pinImg.style.display=c.nomove||!a.userPositioned?"none":"block"));a.saveCookie()}};a.getPos=function(){var c=a._Box,b={};b.left=a._Visible?c.offsetLeft:a.x;b.top=a._Visible?c.offsetTop:a.y;return b};a.setPos=a.setPos=function(c){if(!("undefined"==typeof a._Box||i.touchable)){if(a.userPositioned){var b=c.left,c=c.top;"undefined"!=typeof b&&(b<-0.8*a._Box.offsetWidth&&
(b=-0.8*a._Box.offsetWidth),a.userPositioned&&(a._Box.style.left=b+"px",a.x=b));"undefined"!=typeof c&&(0>c&&(c=0),a.userPositioned&&(a._Box.style.top=c+"px",a.y=c))}a.pinImg&&(a.pinImg.style.display=a.userPositioned?"block":"none")}};a._VKeyGetTarget=function(a){a=b._GetEventObject(a);if(!a)return null;if(a.target)a=a.target;else if(a.srcElement)a=a.srcElement;else return null;3==a.nodeType&&(a=a.parentNode);"SPAN"==a.tagName&&(a=a.parentNode);return a};a.highlightKey=function(c,b){if(c&&!(""==c.className||
0<=c.className.indexOf("kmw-key-row"))){var d=c.className;null!=a.keytip&&0>d.indexOf("kmw-key-shift")&&0>d.indexOf("kmw-spacebar")&&0>c.id.indexOf("popup")?a.showKeyTip(c,b):b&&0>d.indexOf(" kmw-key-touched")?(c.className=d+" kmw-key-touched",a.showKeyTip(null,!1)):c.className=d.replace(" kmw-key-touched","")}};a.showSubKeys=function(c){if(null!=a.keyPending){var b=document.createElement("DIV"),d,f,g,k,j,o;b.id="kmw-popup-keys";a.popupBaseKey=c;"phone"==i.formFactor&&a.prependBaseKey(c);d=c.id.split("-");
var l=d[d.length-1];if("phone"==i.formFactor&&c.subKeys[0].id!=l){l={id:l,layer:""};1<d.length&&(l.layer=d[0]);for(d=0;d<c.childNodes.length&&!a.hasClass(c.childNodes[d],"kmw-key-text");d++);d<c.childNodes.length&&(l.text=c.childNodes[d].textContent);c.subKeys.splice(0,0,l)}d=b.style;d.bottom=parseInt(c.style.bottom,10)+parseInt(c.style.height,10)+4+"px";d.fontFamily=a.fontFamily;d.fontSize=h.getStyleValue(c,"font-size");d.visibility="hidden";var l=c.subKeys.length,p,q;p=Math.min(Math.ceil(l/9),2);
q=Math.ceil(l/p);1<p&&(d.width=q*c.offsetWidth+5*q+"px");for(d=0;d<l;d++)f=c.subKeys[d],j=document.createElement("DIV"),j.className="kmw-key-square-ex",j.keyId=f.id,g=j.style,o=Math.floor(d/q),1<p&&0<o&&(g.marginTop="5px"),j.width="undefined"!=typeof f.width?g.width=parseInt(f.width,10)*c.offsetWidth/100+"px":g.width=c.offsetWidth+"px",g.height=c.offsetHeight+"px",o=document.createElement("DIV"),a.setButtonClass(f,o),o.id="string"==typeof f.layer&&""!=f.layer?"popup-"+f.layer+"-"+f.id:"popup-default-"+
f.id,"string"==typeof f.nextlayer&&""!=f.nextlayer&&(o.nextLayer=f.nextlayer),k=o.style,k.height=g.height,k.width=g.width,k.position="absolute",g=h._CreateElement("SPAN"),g.className="kmw-key-text",null==f.text||""==f.text?(g.innerHTML="\u00a0","string"==typeof f.id&&/^U_[0-9A-F]{4}$/i.test(f.id)&&(g.innerHTML=String.fromCharCode(parseInt(f.id.substr(2),16)))):g.innerHTML=f.text,k=g.style,k.fontSize=a.fontSize,"string"==typeof f.font&&""!=f.font&&(k.fontFamily=f.font),"string"==typeof f.fontsize&&
0!=f.fontsize&&(k.fontSize=f.fontsize),o.appendChild(g),j.appendChild(o),b.appendChild(j);a.showKeyTip(null,!1);a._Box.appendChild(b);d=b.style;l=h._GetAbsoluteX(c)+0.5*(c.offsetWidth-b.offsetWidth);p=(h.landscapeView()?screen.height:screen.width)-b.offsetWidth;l>p&&(l=p);0>l&&(l=0);d.left=l+"px";a.popupCallout=a.addCallout(c);d.visibility="visible";b.shim=document.createElement("DIV");b.shim.id="kmw-popup-shim";a._Box.appendChild(b.shim);"phone"==i.formFactor&&(c=b.childNodes[0].firstChild,a.keyPending=
c,a.highlightKey(c,!0))}};a.prependBaseKey=function(c){if(c&&"undefined"!=typeof c.id){var b;b=c.id.split("-");var d=b[b.length-1];if("undefined"!=typeof c.subKeys&&0<c.subKeys.length&&c.subKeys[0].id!=d){d={id:d,layer:""};1<b.length&&(d.layer=b[0]);for(b=0;b<c.childNodes.length&&!a.hasClass(c.childNodes[b],"kmw-key-text");b++);b<c.childNodes.length&&(d.text=c.childNodes[b].textContent);c.subKeys.splice(0,0,d)}}};a.getVKDictionaryCode=function(a){if(!b._ActiveKeyboard.VKDictionary){var e=[];if("string"==
typeof b._ActiveKeyboard.KVKD)for(var d=b._ActiveKeyboard.KVKD.split(" "),f=0;f<d.length;f++)e[d[f]]=f+256;b._ActiveKeyboard.VKDictionary=e}return(a=b._ActiveKeyboard.VKDictionary[a])?a:0};a.selectLayer=function(c,b){var d=2>arguments.length?null:b;"number"==typeof d&&(d=a.getLayerId(d));if(!d)switch(c){case "K_LSHIFT":case "K_RSHIFT":case "K_SHIFT":d="shift";break;case "K_LCONTROL":case "K_RCONTROL":case "K_LCTRL":case "K_RCTRL":case "K_CTRL":d="ctrl";break;case "K_LMENU":case "K_RMENU":case "K_LALT":case "K_RALT":case "K_ALT":d=
"alt";break;case "K_ALTGR":d="ctrlalt";break;case "K_CURRENCIES":case "K_NUMERALS":case "K_SHIFTED":case "K_UPPER":case "K_LOWER":case "K_SYMBOLS":d="default"}if(!d||d==a.layerId&&"desktop"!=i.formFactor)return!1;a.updateLayer(d);a._Show();return!0};a.defaultKeyOutput=function(a,b,d){var f=0;"U_"==a.substr(0,2)&&32<b&&!(127<b&&!1>b)?f=String.fromCharCode(b):48<=b&&57>=b?f=j[d][0][b-48]:65<=b&&90>=b?f=String.fromCharCode(b+(d?0:32)):186<=b&&192>=b?f=j[d][1][b-186]:219<=b&&222>=b&&(f=j[d][2][b-219]);
return f};a.clickKey=function(c){var e=b._LastActiveElement,d,f,g,h=c.id.split("-");if(2>h.length)return!0;"popup"==h[0]&&h.splice(0,1);if(null!=e){var j=h[0],h=h[1];d=f=a.getModifierState(a.layerId);"undefined"!=typeof c.key&&(d=c.key.nextlayer);null==b._ActiveElement&&(b._ActiveElement=e);if("K_LOPT"==h||"K_ROPT"==h)return a.optionKey(c,h,!0),!0;a.highlightKey(c,!1);if(a.selectLayer(h,d))return!0;"K_SPACE"!=h&&(g=c.childNodes[0].innerHTML);d=e._KeymanWebSelectionStart;f=e._KeymanWebSelectionEnd;
g=b._Selection;b._IsActivatingKeymanWebUI=1;b._IgnoreNextSelChange=100;b._FocusLastActiveElement();b._IsMozillaEditableIframe(e,0)&&(e=e.documentElement);document.selection&&null!=g&&g.select();e._KeymanWebSelectionStart=d;e._KeymanWebSelectionEnd=f;b._IgnoreNextSelChange=0;b._CachedSelectionStart=null;b._DeadkeyDeleteMatched();d={Ltarg:e,Lmodifiers:0,Lcode:a.keyCodes[h],LisVirtualKey:!0};"U_"==h.substr(0,2)&&(d.LisVirtualKey=!1);"undefined"==typeof d.Lcode&&(d.Lcode=a.getVKDictionaryCode(h),!d.Lcode&&
"U_"==h.substr(0,2)&&(f=parseInt(h.substr(2),16),isNaN(f)||(d.Lcode=f)));f="undefined"==typeof c.key?null:c.key.layer;f=null==f?a.getModifierState(j):a.getModifierState(f);d.Lmodifiers=16*f;b._ActiveKeyboard&&b._ActiveKeyboard.KM?(g=c.firstChild.firstChild.wholeText,d.LisVirtualKey=!1,d.LisVirtualKeyCode=!1,d.vkCode=d.Lcode,32!=d.Lcode&&(d.Lcode="string"==typeof g&&""!=g?g.charCodeAt(0):0,160==d.Lcode&&(d.Lcode=0)),d.Lmodifiers=0):d.vkCode=d.Lcode;"undefined"==typeof b._ActiveKeyboard.KM&&(d.Lcode=
b._USKeyCodeToCharCode(d),d.LisVirtualKey=!1);if(!b._ActiveKeyboard||0!=d.Lcode&&!b._ActiveKeyboard.gs(e,d))switch(d.Lcode=d.vkCode,h){case "K_BKSP":b.KO(1,b._LastActiveElement,"");break;case "K_TAB":b.moveToNext("shift"==a.layerId);break;case "K_TABBACK":b.moveToNext(!0);break;case "K_TABFWD":b.moveToNext(!1);break;case "K_ENTER":"TEXTAREA"==e.nodeName||"undefined"!=typeof e.base&&"TEXTAREA"==e.base.nodeName?b.KO(0,e,"\n"):"INPUT"==e.nodeName&&("search"==e.type||"submit"==e.type)?e.form.submit():
"undefined"!=typeof e.base&&("search"==e.base.type||"submit"==e.base.type)?(e.base.disabled=!1,e.base.form.submit()):b.moveToNext(!1);break;case "K_SPACE":b.KO(0,e," ");break;default:(j=a.defaultKeyOutput(h,d.Lcode,f))&&b.KO(0,e,j)}"undefined"!=typeof c.key&&null!==c.key.nextlayer?a.nextLayer=c.key.nextlayer:"undefined"!=typeof c.nextLayer&&null!==c.nextLayer&&(a.nextLayer=c.nextLayer);a.nextLayer!=a.layerId&&(a.layerId=a.nextLayer,a._Show());e._KeymanWebSelectionStart=null;e._KeymanWebSelectionEnd=
null}b._IsActivatingKeymanWebUI=0;return!0};a.getLayerId=function(a){var b="";if(0==a)return"default";a&1&&(b="shift");a&4&&(b="alt"+b);a&2&&(b="ctrl"+b);return b};a.getModifierState=function(a){var b=0;0<=a.indexOf("shift")&&(b+=1);0<=a.indexOf("ctrl")&&(b+=2);0<=a.indexOf("alt")&&(b+=4);return b};a.updateLayer=function(c){var b=a.layerId,d;d=c.replace("shift","");d=d.replace("ctrl","");d=d.replace("alt","");if("default"==a.layerId||"numeric"==a.layerId||"symbol"==a.layerId||"currency"==a.layerId||
""!=d)b=c;else{d=a.getModifierState(b);b=b.replace("shift","");b=b.replace("ctrl","");b=b.replace("alt","");switch(c){case "shift":d^=1;break;case "ctrl":d^=2;break;case "alt":d^=4;break;default:b=c}"default"!=b&&(d&1&&(b="shift"+b),d&2&&(b="ctrl"+b),d&4&&(b="alt"+b))}""==b&&(b="default");a.layerId=b.replace("altctrl","ctrlalt");for(c=0;c<a.layers.length;c++)if(a.layerId==a.layers[c].id)return;a.layerId="default"};a.showLanguage=function(){var c="",e="";b._ActiveStub?(c=b._ActiveStub.KL,e=b._ActiveStub.KN):
c=b._ActiveLanguage?b._ActiveLanguage.KN:"English";try{var d=a.spaceBar.firstChild.firstChild;d.parentNode.className="undefined"==typeof d.parentNode.className||""==d.parentNode.className?"kmw-spacebar":d.parentNode.className+" kmw-spacebar";d.className="kmw-spacebar-caption";e=e.replace(/\s*keyboard\s*/i,"");d.innerHTML=e==c?c:c+" ("+e+")"}catch(f){}};a.showLanguageMenu=function(){var c=b._KeyboardStubs;if(!(1>c.length)){var e=a.lgList=h._CreateElement("DIV");a.lgList.id="kmw-language-menu";e.shim=
h._CreateElement("DIV");e.shim.id="kmw-language-menu-background";e.shim.addEventListener("touchstart",function(c){c.preventDefault();a.hideLanguageList();if(2<c.touches.length){var b=c.touches[1].pageX,c=c.touches[1].pageY;b>a.spaceBar.offsetLeft&&(b<a.spaceBar.offsetLeft+a.spaceBar.offsetWidth&&c>a.spaceBar.offsetTop&&c<a.spaceBar.offsetTop+a.spaceBar.offsetHeight)&&a.showBuild()}},!1);document.body.appendChild(e.shim);var d=h._CreateElement("DIV"),f=d.style,g=h._CreateElement("DIV");d.id="kmw-menu-scroll-container";
g.id="kmw-menu-scroller";"WebkitOverflowScrolling"in f&&(f.WebkitOverflowScrolling="touch");d.appendChild(g);e.appendChild(d);var k,j,f=h._CreateElement("DIV");f.id="kmw-menu-index";for(k=1;26>=k;k++)j=h._CreateElement("P"),j.innerHTML=String.fromCharCode(k+64),f.appendChild(j);f.addEventListener("touchstart",function(c){a.scrollToLanguage(c,d,g)},!1);f.addEventListener("touchend",function(a){a.stopPropagation();a.preventDefault()},!1);e.appendChild(f);e.addEventListener("scroll",function(){a.lgList.scrolling=
true},!1);d.addEventListener("scroll",function(){if(d.scrollTop<1)d.scrollTop=1;if(d.scrollTop>d.scrollHeight-d.offsetHeight-1)d.scrollTop=d.scrollHeight-d.offsetHeight-1},!1);a.lgList.activeLgNo=a.addLanguagesToMenu(g,c);a.lgList.visibility="hidden";document.body.appendChild(a.lgList);"Android"==i.OS&&"devicePixelRatio"in window&&(a.lgList.style.fontSize=2/window.devicePixelRatio+"em");if("Android"==i.OS&&("tablet"==i.formFactor&&"devicePixelRatio"in window)&&(k=parseInt(h.getStyleValue(e,"width"),
10),c=e.style,isNaN(k)||(c.width=c.maxWidth=2*k/window.devicePixelRatio+"px"),k=parseInt(h.getStyleValue(d,"width"),10),c=d.style,isNaN(k)||(c.width=c.maxWidth=2*k/window.devicePixelRatio+"px"),k=parseInt(h.getStyleValue(g,"width"),10),c=g.style,!isNaN(k)))c.width=c.maxWidth=2*k/window.devicePixelRatio+"px";a.adjustLanguageMenu(0);c=Math.floor(e.offsetHeight/26);j=Math.round(100*c/(f.childNodes[1].offsetTop-f.childNodes[0].offsetTop))/100;var o=0.6<j?1:2;1.25<j&&(j=1.25);for(k=0;26>k;k++){var l=f.childNodes[k].style;
2==o&&1==k%2?l.display="none":(l.fontSize=j*o+"em",l.lineHeight=c*o+"px")}k=d.offsetWidth;d.scrollHeight>d.offsetHeight+3?k+=f.offsetWidth:f.style.display="none";e.style.width=k+"px";a.lgList.visibility="";e=g.firstChild.offsetHeight*a.lgList.activeLgNo+1;d.scrollTop=e;d.scrollTop<e&&(d.scrollTop=d.scrollHeight-d.offsetHeight);d.scrollTop>d.scrollHeight-d.offsetHeight-1&&(d.scrollTop=d.scrollHeight-d.offsetHeight-1)}};a.adjustLanguageMenu=function(c){var b=a.lgList,d=b.firstChild,f=d.firstChild,g=
0,k=b.style,b=b.childNodes[1],j=window.innerHeight-a.lgKey.offsetHeight-16,c=(f.childNodes.length+c-1)*f.firstChild.firstChild.offsetHeight;"iOS"==i.OS&&("phone"==i.formFactor?(g=h.landscapeView()?36:0,j=(window.innerHeight-g-16)*h.getViewportScale()):"tablet"==i.formFactor&&(g=h.landscapeView()?16:0,j-=g));k.left=h._GetAbsoluteX(a.lgKey)+"px";c>j&&(c=j);k.height=c+"px";k.top=h._GetAbsoluteY(a._Box)+a._Box.offsetHeight-c+window.pageYOffset-6+"px";k.bottom="auto";b.style.height=d.style.height=k.height};
a.scrollToLanguage=function(a,b,d){a.stopImmediatePropagation();a.stopPropagation();a.preventDefault();if("P"==a.touches[0].target.nodeName){var f,g,h=0,a=a.touches[0].target.innerHTML.charCodeAt(0),j=d.childNodes;try{for(f=0;f<j.length-1&&!(g=j[f].firstChild.innerHTML.toUpperCase().charCodeAt(0),g>=a);f++);}catch(i){}try{h=d.firstChild.offsetHeight*f+1,b.scrollTop=h}catch(l){h=0}try{if(b.scrollTop<h&&(b.scrollTop=b.scrollHeight-b.offsetHeight),b.scrollTop>b.scrollHeight-b.offsetHeight-1)b.scrollTop=
b.scrollHeight-b.offsetHeight-1}catch(p){}}};a.addLanguagesToMenu=function(c,e){var d=e.length,f,g,j,n=[];for(g=0;g<d;g++)j=e[g].KL,-1==n.indexOf(j)&&n.push(j);n.sort();var o=Math.round(100/h.getViewportScale())/100,l,p,q;j=-1;for(f=0;f<n.length;f++){l=h._CreateElement("DIV");l.className="kbd-list-closed";p=h._CreateElement("P");p.kList=[];for(g=0;g<d;g++)e[g].KL==n[f]&&p.kList.push(e[g]);"iOS"==i.OS&&(p.style.fontSize=o+"em");l.appendChild(p);c.appendChild(l);n[f]==b._ActiveStub.KL&&(j=f);if(1<p.kList.length){p.className=
"kbd-list";p.innerHTML=n[f]+"...";p.scrolled=!1;p.ontouchend=function(c){c.preventDefault();c.stopPropagation();c.target.scrolled?c.target.scrolled=false:this.parentNode.className=this.parentNode.className=="kbd-list-closed"?"kbd-list-open":"kbd-list-closed";a.adjustLanguageMenu(this.parentNode.className=="kbd-list-closed"?0:this.kList.length)};p.addEventListener("touchstart",function(a){a.stopPropagation()},!1);p.addEventListener("touchmove",function(a){a.target.scrolled=true;a.stopPropagation()},
!1);for(g=0;g<p.kList.length;g++)q=h._CreateElement("P"),q.className="kbd-list-entry","iOS"==i.OS&&(q.style.fontSize=o+"em"),a.addKeyboardToMenu(p.kList[g],q,!1),l.appendChild(q)}else p.innerHTML=n[f],p.className="kbd-single-entry",a.addKeyboardToMenu(p.kList[0],p,!0);f==j&&(p.className+=" current")}d=h._CreateElement("DIV");d.id="kmw-menu-footer";n=function(a){a.preventDefault();a.stopPropagation()};d.addEventListener("touchstart",n,!1);d.addEventListener("touchmove",n,!1);d.addEventListener("touchend",
n,!1);c.appendChild(d);return j};a.addKeyboardToMenu=function(c,e,d){e.kn=c.KI;e.kc=c.KLC;e.innerHTML=d?c.KL:c.KN.replace(" Keyboard","");var c=function(c){c.stopPropagation();0>=this.className.indexOf("selected")&&(this.className+=" selected");a.lgList.scrolling=!1;a.lgList.y0=c.touches[0].pageY;return!0},d=function(c){c.stopImmediatePropagation();var b=a.lgList.childNodes[0],e=b.scrollHeight-b.offsetHeight,d,f;if("undefined"!=typeof c.pageY)d=c.pageY;else if("undefined"!=typeof c.touches)d=c.touches[0].pageY;
else return;f=d-a.lgList.y0;if(0>f)b.scrollTop>=e-1&&(c.preventDefault(),a.lgList.y0=d);else if(0<f)2>b.scrollTop&&(c.preventDefault(),a.lgList.y0=d);else return;if(-5>f||5<f)a.lgList.scrolling=!0,this.className=this.className.replace(/\s*selected/,""),a.lgList.y0=d;return!0},f=function(c){c.preventDefault();"undefined"!=typeof c.stopImmediatePropagation?c.stopImmediatePropagation():c.stopPropagation();a.lgList.scrolling?this.className=this.className.replace(/\s*selected/,""):(b.focusing=!0,b.focusTimer=
window.setTimeout(function(){b.focusing=!1},1E3),a.lgList.style.display="none",b._SetActiveKeyboard(this.kn,this.kc,!0),b.doKeyboardChange(this.kn,this.kc),b._FocusLastActiveElement(),a.hideLanguageList(),a._Show());return!0};e.onmspointerdown=c;e.addEventListener("touchstart",c,!1);e.onmspointermove=d;e.addEventListener("touchmove",d,!1);e.onmspointerout=f;e.addEventListener("touchend",f,!1)};a.hideLanguageList=function(){a.lgList&&(a.highlightKey(a.lgKey.firstChild,!1),a.lgList.style.visibility=
"hidden",window.setTimeout(function(){null!=a.lgList&&"undefined"!=typeof a.lgList&&(document.body.removeChild(a.lgList.shim),document.body.removeChild(a.lgList));a.lgList=null},500))};a._UpdateVKShift=function(c,b,d){var f=0,f=c?c.Lmodifiers/16:d?f|b:f&~b;a.layerId=a.getLayerId(f);a._Visible&&a._Show();return!0};a._CancelMouse=function(a){(a=b._GetEventObject(a))&&a.preventDefault&&a.preventDefault();a&&(a.cancelBubble=!0,a.returnValue=!1);return!1};a.showLayer=function(c){if(b._ActiveKeyboard)for(var e=
0;e<a.layers.length;e++)if(a.layers[e].id==c)return a.layerId=c,a._Show(),!0;return!1};a.getHeight=function(){if("function"==typeof b.getOskHeight)return b.getOskHeight();var a=Math.floor(Math.min(screen.availHeight,screen.availWidth)/2);if("phone"==i.formFactor)var e=Math.min(screen.height,screen.width),d=Math.max(screen.height,screen.width),a=h.portraitView()?Math.floor(Math.max(screen.availHeight,screen.availWidth)/3):a*(d/e)/1.6;"iOS"==i.OS&&(a/=h.getViewportScale());"Android"==i.OS&&"phone"==
i.formFactor&&"devicePixelRatio"in window&&/Firefox|Chrome|OPR/.test(navigator.userAgent)&&(a*=window.devicePixelRatio);return a};a.getWidth=function(){if("function"==typeof b.getOskWidth)return b.getOskWidth();var a=screen.width;if("Android"==i.OS)try{a=document.documentElement.clientWidth}catch(e){a=screen.availWidth}return a};a.mouseOverMouseDownHandler=function(c){var b=h.eventTarget(c);null===b||"desktop"!=i.formFactor||(("SPAN"==b.nodeName&&(b=b.parentNode),"mousedown"==h.eventType(c))?(a.currentKey=
b.id,a._CancelMouse(c),a.highlightKey(b,!0)):b.id==a.currentKey&&a.highlightKey(b,!0))};a.mouseUpMouseOutHandler=function(c){var b=h.eventTarget(c);if(!(null===b||"desktop"!=i.formFactor))if("SPAN"==b.nodeName&&(b=b.parentNode),a.highlightKey(b,!1),"mouseup"==h.eventType(c))b.id==a.currentKey&&a.clickKey(b),a.currentKey=""};a.deviceDependentLayout=function(c,b){var d=h._CreateElement("DIV"),f=d.style,g=0;d.className="kmw-key-layer-group";switch(b){case "phone":case "tablet":g=a.getHeight(),f.height=
g+"px"}if(null==c)return d;f.fontSize="undefined"==typeof c.fontsize||null==c.fontsize?"1em":c.fontsize;a.fontSize=f.fontSize;var j,n,o,l,p,q,w,t,s,r,x,A,u,z;o=c.layer;var D={text:""};D.fontsize=f.fontSize;D.width="100";D.pad="15";D.sp="0";D.layer=null;D.nextlayer=null;for(var G=/\*\w+\*/,g=0;g<o.length;g++){l=o[g];q=l.row;for(j=q.length;0<j&&!(0<q[j-1].key.length);j--);j<q.length&&q.splice(j-q.length,q.length-j)}w=100/q.length;"desktop"==b&&(w=100/q.length);var E,B;"desktop"==b?(E=function(a){return a+
"%"},B=100):(E=function(a){return Math.round(a)+"px"},B=a.getWidth());i.touchable&&"ontouchstart"in window&&(d.addEventListener("touchstart",a.touch,!0),d.addEventListener("touchend",a.release,!1),d.addEventListener("touchmove",a.moveOver,!1));for(g=0;g<o.length;g++){l=o[g];l.aligned=!1;p=h._CreateElement("DIV");q=p.style;p.className="kmw-key-layer";q.display=0==g?"block":"none";q.height=f.height;q.fontFamily="font"in c?c.font:"";p.layer=p.nextLayer=l.id;"string"==typeof l.nextlayer&&(p.nextLayer=
l.nextlayer);q=l.row;var C=0;for(j=0;j<q.length;j++){t=0;n=q[j];s=n.key;for(n=0;n<s.length;n++)if(r=s[n],null==r)s.length-=1;else{var y;A="string"==typeof r.width&&""!=r.width?parseInt(r.width,10):100;if(isNaN(A)||0==A)A=100;r.width=A.toString();y="string"==typeof r.pad&&""!=r.pad?parseInt(r.pad,10):15;if(isNaN(y)||0==y)y=15;r.pad=y.toString();t+=A+y}t>C&&(C=t)}C="desktop"==b?C+5:C+15;for(j=0;j<q.length;j++){t=h._CreateElement("DIV");t.className="kmw-key-row";t.onmousedown=h.mouseDownPreventDefaultHandler;
n=q[j];A=t.style;A.maxHeight=A.height=w+"%";s=n.key;for(n=0;n<s.length;n++){r=s[n];for(var F in D)"string"!=typeof r[F]&&(r[F]=D[F]);switch(r.sp){case "1":!G.test(r.text)&&""!=r.text&&(r.sp="3");break;case "2":!G.test(r.text)&&""!=r.text&&(r.sp="4")}}for(n=y=0;n<s.length-1;n++)r=Math.round(parseInt(s[n].width,10)*B/C),s[n].widthpc=r,x=Math.round(parseInt(s[n].pad,10)*B/C),s[n].padpc=x,y+=x+r;y+=Math.round(15*B/C);1==s.length&&0>parseInt(s[0].pad,10)?(r=Math.round(parseInt(s[0].width,10)*B/C),s[0].widthpc=
r,y+=r,s[0].padpc=B-y):0<s.length&&(n=s.length-1,x=Math.round(parseInt(s[n].pad,10)*B/C),s[n].padpc=x,y+=x,s[n].widthpc=B-y);for(n=y=0;n<s.length;n++){r=s[n];x=h._CreateElement("DIV");x.keyId=r.id;x.className="kmw-key-square";u=x.style;x.width=u.width=E(r.widthpc);"desktop"!=b?(u.left=E(y+s[n].padpc),u.bottom=A.bottom,u.height=A.height):u.marginLeft=E(r.padpc);y=y+s[n].padpc+s[n].widthpc;z=h._CreateElement("DIV");a.setButtonClass(r,z,c);"desktop"!=b&&(z.style.left=u.left,z.style.width=u.width);u=
null;if(c.keyLabels||"desktop"==b){var v=a.keyCodes[r.id];switch(v){case 186:v=59;break;case 187:v=61;break;case 188:v=44;break;case 189:v=45;break;case 190:v=46;break;case 191:v=47;break;case 192:v=96;break;case 219:v=91;break;case 220:v=92;break;case 221:v=93;break;case 222:v=39;break;default:if(48>v||90<v)v=0}0<v&&(u=h._CreateElement("DIV"),u.className="kmw-key-label",u.innerHTML=String.fromCharCode(v),z.appendChild(u))}z.id=l.id+"-"+r.id;z.key=r;if("undefined"!=typeof r.sk&&null!=r.sk){v=z.subKeys=
r.sk;for(u=0;u<v.length;u++)if("1"==v[u].sp||"2"==v[u].sp)v[u].text=a.renameSpecialKey(v[u].text)}else z.subKeys=null;i.touchable||(z.onmouseover=z.onmousedown=a.mouseOverMouseDownHandler,z.onmouseup=z.onmouseout=a.mouseUpMouseOutHandler);u=h._CreateElement("SPAN");v=u.style;null==r.text||""==r.text?(u.innerHTML="\u00a0","string"==typeof r.id&&/^U_[0-9A-F]{4}$/i.test(r.id)&&(u.innerHTML=String.fromCharCode(parseInt(r.id.substr(2),16)))):u.innerHTML=r.text;u.className="kmw-key-text";if("1"==r.sp||
"2"==r.sp)u.innerHTML=a.renameSpecialKey("*Tab*"==r.text&&1==g?"*TabLeft*":r.text);"font"in r&&(v.fontFamily=r.font);"fontsize"in r&&(v.fontSize=r.fontsize);z.appendChild(u);x.appendChild(z);"undefined"!=typeof r.sk&&null!=r.sk&&(r=h._CreateElement("DIV"),r.className="kmw-key-popup-icon",z.appendChild(r));t.appendChild(x)}p.appendChild(t)}d.appendChild(p)}return d};a.renameSpecialKey=function(a){for(var b="*Shift* *Enter* *Tab* *BkSp* *Menu* *Hide* *Alt* *Ctrl* *Caps* *ABC* *abc* *123* *Symbol* *Currency* *Shifted* *AltGr* *TabLeft*".split(" "),
d=[8,5,6,4,11,10,25,1,3,16,17,19,21,20,8,2,7],f=0;f<b.length;f++)if(a==b[f])return String.fromCharCode(57344+d[f]);return a};a.clearPopup=function(){var c=document.getElementById("kmw-popup-keys");null!=c&&(c.shim&&a._Box.removeChild(c.shim),c.parentNode.removeChild(c));a.popupCallout&&a._Box.removeChild(a.popupCallout);a.popupCallout=null;a.subkeyDelayTimer&&(window.clearTimeout(a.subkeyDelayTimer),a.subkeyDelayTimer=null);a.popupBaseKey=null};a.touch=function(c){var e=c.changedTouches[0].target,
d=a.keyTarget(e);a.touchX=c.changedTouches[0].pageX;a.currentTarget=d;var f=document.getElementById("kmw-popup-keys");if(!(f&&"visible"==f.style.visibility||a.popupVisible)){a.touchCount=c.touches.length;if(d&&0<=d.className.indexOf("key-hidden")||0<=e.className.indexOf("kmw-key-row"))d=a.findNearestKey(c,e);null!=d&&(c=d.id.split("-")[1],a.highlightKey(d,!0),"K_LOPT"==c||"K_ROPT"==c?(window.setTimeout(function(){a.clickKey(d)},0),a.keyPending=null):"K_BKSP"==c?(b.KO(1,b._LastActiveElement,""),a.deleting=
window.setTimeout(a.repeatDelete,500),a.keyPending=null):(a.keyPending?(a.highlightKey(a.keyPending,!1),a.clickKey(a.keyPending),a.clearPopup(),a.touchCount--):a.touchHold(d),a.keyPending=d))}};a.release=function(c){var b=document.getElementById("kmw-popup-keys"),d=a.currentTarget;if(b&&"visible"==b.style.visibility||a.popupVisible){if(0<c.touches.length)return;if(null==d||0>d.id.indexOf("popup")&&d.id!=a.popupBaseKey.id)a.highlightKey(a.keyPending,!1),a.clearPopup(),a.keyPending=null}d&&d.id&&a.optionKey(c,
d.id,!1);d=c.changedTouches[0].pageX;d=2>d&&5<a.touchX||d>window.innerWidth-2&&a.touchX<window.innerWidth-5;b=a.touchCount;0<a.touchCount&&a.touchCount--;a.keyPending?(a.highlightKey(a.keyPending,!1),0>a.keyPending.className.indexOf("hidden")&&(0<b&&!d)&&a.clickKey(a.keyPending),a.clearPopup(),a.keyPending=null):(b=c.changedTouches[0],d=a.keyTarget(b.target),d||(d=document.elementFromPoint(b.clientX,b.clientY),d=a.findNearestKey(c,d)),a.highlightKey(d,!1));a.deleting&&window.clearTimeout(a.deleting);
a.deleting=0};a.moveOver=function(c){c.preventDefault();c.cancelBubble=!0;"function"==typeof c.stopImmediatePropagation?c.stopImmediatePropagation():"function"==typeof c.stopPropagation&&c.stopPropagation();if(!(1<c.touches.length||0==a.touchCount)){var b="object"==typeof c.touches?c.touches[0].clientX:c.clientX,d="object"==typeof c.touches?c.touches[0].clientY:c.clientY,f=document.elementFromPoint(b,d),g=a.keyPending,h=a.keyTarget(f);if(h&&0<=h.className.indexOf("key-hidden")||f&&!h&&0<=f.className.indexOf("key-row"))h=
a.findNearestKey(c,f);h&&("string"==typeof h.id&&0>h.id.indexOf("BKSP"))&&(a.deleting&&window.clearTimeout(a.deleting),a.deleting=0);if(a.popupVisible)null==h?(g&&a.highlightKey(g,!1),a.keyPending=null):h==a.popupBaseKey?(a.hasClass(h,"kmw-key-touched")||a.highlightKey(h,!0),a.keyPending=h):(g&&a.highlightKey(g,!1),a.keyPending=null);else{if((f=document.getElementById("kmw-popup-keys"))&&"visible"==f.style.visibility&&"phone"==i.formFactor&&h==a.popupBaseKey)h=f.childNodes[0].firstChild;a.currentTarget=
h;g&&(h&&h.id!=g.id)&&a.highlightKey(g,!1);a.highlightSubKeys(h,b,d);if(f&&"visible"==f.style.visibility){if(h&&0>h.id.indexOf("popup")&&h!=a.popupBaseKey)return;h&&(h==a.popupBaseKey&&0>h.className.indexOf("kmw-key-touched"))&&a.highlightKey(h,!0)}else Math.max(5,a._Box.offsetTop-0.25*a._Box.offsetHeight),g&&c.touches[0].pageY<Math.max(5,a._Box.offsetTop-0.25*a._Box.offsetHeight)&&(a.highlightKey(g,!1),a.showKeyTip(null,!1),a.keyPending=null);h&&a.keyPending&&(a.keyPending=h);a.keyPending&&(g!=h||
0>h.className.indexOf("kmw-key-touched"))&&a.highlightKey(h,!0);g&&(h&&h!=g&&""!=h.id)&&a.touchHold(h)}}};a.hasClass=function(a,b){return 0<=(" "+a.className+" ").replace(/[\n\t\r\f]/g," ").indexOf(" "+b+" ")};a.keyTarget=function(c){try{if(c){if(a.hasClass(c,"kmw-key"))return c;if(c.parentNode&&a.hasClass(c.parentNode,"kmw-key"))return c.parentNode;if(c.firstChild&&a.hasClass(c.firstChild,"kmw-key"))return c.firstChild}}catch(b){}return null};a.findNearestKey=function(a,b){if(!a||"undefined"==typeof a.changedTouches||
0==a.changedTouches.length)return null;for(var d=a.changedTouches[0].pageX;b&&0>b.className.indexOf("key-row");)b=b.parentNode;if(!b)return null;var f,g=0,h,j=24,i=1E5,l;for(f=0;f<b.childNodes.length;f++)if(!(0<=b.childNodes[f].firstChild.className.indexOf("key-hidden"))&&(h=b.childNodes[f].firstChild.offsetLeft,l=h+b.childNodes[f].firstChild.offsetWidth,h-=d,0<=h&&h<i&&(g=f,i=h),h=d-l,0<=h&&h<i))g=f,i=h;return 1E5>i&&(b=b.childNodes[g].firstChild,h=b.offsetLeft,l=h+b.offsetWidth,40<b.offsetWidth&&
(j=0.6*b.offsetWidth),0<=h-d&&h-d<j||0<=d-l&&d-l<j)?b:null};a.repeatDelete=function(){a.deleting&&(b.KO(1,b._LastActiveElement,""),a.deleting=window.setTimeout(a.repeatDelete,100))};a.setButtonClass=function(c,b,d){var f=0,g="default shift shift-on special special-on deadkey blank hidden".split(" ");"string"==typeof c.dk&&"1"==c.dk&&(f=8);"string"==typeof c.sp&&(f=parseInt(c.sp,10));if(0>f||10<f)f=0;d=d||a.layout;b.className=4<d.layer[0].row.length&&"phone"==h.device.formFactor?"kmw-key kmw-5rows kmw-key-"+
g[f]:"kmw-key kmw-key-"+g[f]};a.buildDefaultLayout=function(a,b){var d;d=b;var f=window.dfltLayout;"object"!=typeof f[d]&&(d="desktop");d=h.deepCopy(f[d]);var j=d.layer,k=a.BK,i=a.K102,o,l,p,q,w;p=/\*\w+\*/;for(var t="default shift ctrl ctrlshift alt altshift ctrlalt ctrlaltshift".split(" "),f=0;8>f;f++){0<f&&(j[f]=h.deepCopy(j[0]));j[f].id=t[f];j[f].nextlayer=t[f];for(o=0;o<j[f].row.length;o++){l=j[f].row[o];w=l.key;for(l=0;l<w.length;l++)switch(q=w[l],q.id){case "K_SHIFT":case "K_LSHIFT":case "K_RSHIFT":1==
(f&1)&&(q.sp="2");"desktop"!=b&&0<f&&(q.nextlayer="default");break;case "K_CONTROL":case "K_LCTRL":case "K_LCONTROL":case "K_RCTRL":case "K_RCONTROL":2==(f&2)&&(q.sp="2");break;case "K_ALT":case "K_LALT":case "K_RALT":4==(f&4)&&(q.sp="2")}}if("undefined"==typeof i||!i)for(o=0;o<j[f].row.length;o++)for(l=0;l<j[f].row[o].key.length;l++)"K_oE2"==j[f].row[o].key[l].id&&("desktop"==b?(j[f].row[o].key.splice(l,1),j[f].row[o].key[0].width="200"):j[f].row[o].key[l].sp="10")}for(f=0;f<j.length;f++){var s=
j[f],r,x=null,A="",i=s.row;for(o=0;o<i.length;o++){w=i[o].key;for(l=0;l<w.length;l++)q=w[l],r=g.indexOf(q.id),"undefined"!=typeof k&&(0<=r&&r+65*f<k.length)&&(q.text=k[r+65*f]),""==q.text&&("K_SPACE"!=q.id&&130>r+65*f)&&(q.text="`1234567890-=\u00a7~~qwertyuiop[]\\~~~asdfghjkl;'~~~~~?zxcvbnm,./~~~~~ ~!@#$%^&*()_+\u00a7~~QWERTYUIOP{}\\~~~ASDFGHJKL:\"~~~~~?ZXCVBNM<>?~~~~~ "[r+65*f]),"undefined"==typeof q.text&&(q.text=""),"K_SHIFT"==q.id&&(x=q),p.test(q.text)||(A+=q.text)}s.valid=0<A.trim().length;s.shiftKey=
x;if("desktop"!=b&&0<f&&null!=x)switch(x.sp="2",x.sk=null,j[f].id){case "ctrl":x.text="*Ctrl*";break;case "alt":x.text="*Alt*";break;case "ctrlalt":x.text="*AltGr*"}}for(f=0;8>f;f++){i=j[f].row;for(o=0;o<i.length;o++){w=i[o].key;for(l=0;l<w.length;l++)if(q=w[l],null!=q.sk){for(p=0;8>p;p++)for(k=0;k<q.sk.length;k++)if(q.sk[k].nextlayer==t[p]){j[p].valid||q.sk.splice(k,1);break}0==q.sk.length&&(q.sk=null)}}}return d};a._GenerateVisualKeyboard=function(c,e,d){e=h._CreateElement("DIV");if("object"!=typeof d||
null==d)d=a.buildDefaultLayout(c,i.formFactor);a.layout=d;a.layers=d.layer;a.fontFamily="font"in d?d.font:"";d.keyLabels=b._ActiveKeyboard&&"undefined"!=typeof b._ActiveKeyboard.KDU&&b._ActiveKeyboard.KDU;c=a.deviceDependentLayout(d,i.formFactor);a.ddOSK=!0;a.keyMap=c;e.appendChild(c);a._DivVKbdHelp=a._DivVKbd=e;a._Box.className=i.formFactor+" "+i.OS.toLowerCase()+" kmw-osk-frame";e.className=i.formFactor+" kmw-osk-inner-frame";"desktop"==i.formFactor&&a._Box.appendChild(a.controlBar());a._Box.appendChild(e);
"desktop"==i.formFactor?a._Box.appendChild(a.resizeBar()):a.adjustHeights()};b.BuildVisualKeyboard=b.buildOSK=function(c,e,d,f){var g=b._ActiveKeyboard,e=null,h="undefined"==typeof d?"desktop":d,f="undefined"==typeof f?"default":f;if(null!=c){e=c.toLowerCase().replace("keyboard_","");for(d=0;d<b._Keyboards.length;d++)if(e==b._Keyboards[d].KI.toLowerCase().replace("keyboard_","")){g=b._Keyboards[d];break}}if(!g)return null;e=g.KVKL;c=null;d=g.KV;"object"==typeof e&&("object"==typeof e[h]&&null!=e[h]?
c=e[h]:"phone"==h&&"object"==typeof e.tablet&&null!=e.tablet?c=e.tablet:"tablet"==h&&"object"==typeof e.phone&&null!=e.phone?c=e.phone:"object"==typeof e.desktop&&null!=e.desktop&&(c=e.desktop));null==c&&null!=d&&(c=a.buildDefaultLayout(d,h));null!=c&&(c.keyLabels="undefined"!=typeof g.KDU&&g.KDU);e=a.deviceDependentLayout(c,h);e.className=h+"-static kmw-osk-inner-frame";if(null!=c)for(var j,i,l,d=0;d<c.layer.length;d++){g=e.childNodes[d];for(i=0;i<g.childNodes.length;i++){h=g.childNodes[i];for(l=
0;l<h.childNodes.length;l++)j=h.childNodes[l],j.style.height="100%"}g.style.display="number"==typeof f?d==f&&0<=f?"block":"none":"string"==typeof f?c.layer[d].id==f?"block":"none":0==d?"block":"none"}else e.innerHTML="<p style='color:#c40; font-size:0.5em;margin:10px;'>No "+h+" layout is defined for "+g.KN+".</p>";e.style.border="1px solid #ccc";return e};a.adjustHeights=function(){if(a._Box&&a._Box.firstChild&&a._Box.firstChild.firstChild&&a._Box.firstChild.firstChild.childNodes){var b=a._Box.firstChild.firstChild.childNodes,
e=b[0].childNodes.length,d=a.getHeight(),f=Math.floor(d/e),g,j,n,o,l,p,q,w,t,s;g=1;"Android"==i.OS&&"devicePixelRatio"in window&&(f/=window.devicePixelRatio);d=e*f;s=a._Box;j=s.style;j.height=j.maxHeight=d+3+"px";s=s.firstChild.firstChild;j=s.style;j.height=j.maxHeight=d+3+"px";"phone"==i.formFactor&&(g=0.6);s=Math.round(0.15*f);"iOS"==i.OS&&(g/=h.getViewportScale());j.fontSize=g+"em";var r="iOS"==i.OS&&"phone"==i.formFactor&&h.landscapeView();for(g=0;g<b.length;g++){b[g].style.height=d+3+"px";for(j=
0;j<e;j++){n=b[g].childNodes[j].style;n.bottom=(e-j-1)*f+1+"px";n.maxHeight=n.height=f+"px";o=b[g].childNodes[j].childNodes;l=o.length;for(p=0;p<l;p++){q=o[p];for(t=0;t<q.childNodes.length&&!a.hasClass(q.childNodes[t],"kmw-key");t++);w=q.childNodes[t].style;w.bottom=n.bottom;w.height=w.minHeight=f-s+"px";r&&0<t&&(q.childNodes[0].style.fontSize="6px")}}}}};a.controlBar=function(){var c=h._CreateElement("DIV"),e="";c.id="keymanweb_title_bar";c.className="kmw-title-bar";c.onmousedown=a._VMoveMouseDown;
b._ActiveKeyboard&&(e=b._ActiveKeyboard.KN);var d=h._CreateElement("SPAN");d.className="kmw-title-bar-caption";d.innerHTML=e;c.appendChild(d);e=a.closeButton=h._CreateElement("DIV");e.id="kmw-close-button";e.className="kmw-title-bar-image";e.onmousedown=a._CancelMouse;e.onclick=function(){a._Hide(!0)};c.appendChild(e);e=a.helpImg=h._CreateElement("DIV");e.id="kmw-help-image";e.className="kmw-title-bar-image";e.title="KeymanWeb Help";e.onclick=function(){h.callEvent("osk.helpclick",{});window.event&&
(window.event.returnValue=!1);return!1};e.onmousedown=a._CancelMouse;c.appendChild(e);e=a.configImg=h._CreateElement("DIV");e.id="kmw-config-image";e.className="kmw-title-bar-image";e.title="KeymanWeb Configuration Options";e.onclick=function(){h.callEvent("osk.configclick",{});window.event&&(window.event.returnValue=!1);return!1};e.onmousedown=a._CancelMouse;c.appendChild(e);e=a.pinImg=h._CreateElement("DIV");e.id="kmw-pin-image";e.className="kmw-title-bar-image";e.title="Pin the On Screen Keyboard to its default location on the active text box";
e.onclick=function(){a.loadCookie();a.userPositioned=!1;a.saveCookie();a._Show();a.doResizeMove();a.pinImg&&(a.pinImg.style.display="none");window.event&&(window.event.returnValue=!1);return!1};e.onmousedown=a._CancelMouse;c.appendChild(e);return c};a.showBuild=function(){h.alert("KeymanWeb Build "+b.build+'<br /><br /><span style="font-size:0.8em">Copyright &copy; 2013 Tavultesoft Pty Ltd</span>')};a.resizeBar=function(){var b=h._CreateElement("DIV");b.className="kmw-footer";b.onmousedown=a._CancelMouse;
var e=h._CreateElement("DIV");e.className="kmw-footer-caption";e.innerHTML="Keyboard &copy; 2013 Tavultesoft Pty Ltd";e.id="keymanweb-osk-footer-caption";h.attachDOMEvent(e,"dblclick",function(b){b&&b.shiftKey&&a.showBuild()},!1);"onselectstart"in e&&(e.onselectstart=h.selectStartHandler);b.appendChild(e);e=h._CreateElement("DIV");e.className="kmw-footer-resize";e.onmousedown=a._VResizeMouseDown;e.onmouseover=e.onmouseout=a._VResizeMouseOut;b.appendChild(e);a.resizeIcon=e;return b};a._VKbdMouseOver=
function(){b._IsActivatingKeymanWebUI=1};a._VKbdMouseOut=function(){b._IsActivatingKeymanWebUI=0};a._VResizeMouseOver=a._VResizeMouseOut=function(c){c=b._GetEventObject(c);if(!c)return!1;c&&c.preventDefault&&c.preventDefault();var e=a.getRect();a.width=e.width;a.height=e.height;c.cancelBubble=!0;return!1};a._VResizeMouseDown=function(c){b._JustActivatedKeymanWebUI=1;c=b._GetEventObject(c);if(!c)return!0;a.resizing=1;var e,d;c.pageX?(e=c.pageX,d=c.pageY):c.clientX&&(e=c.clientX+document.body.scrollLeft,
d=c.clientY+document.body.scrollTop);a._ResizeMouseX=e;a._ResizeMouseY=d;document.onmousemove!=a._VResizeMouseMove&&document.onmousemove!=a._VMoveMouseMove&&(a._VPreviousMouseMove=document.onmousemove,a._VPreviousMouseUp=document.onmouseup);a._VPreviousCursor=document.body.style.cursor;a._VPreviousMouseButton="undefined"==typeof c.which?c.button:c.which;a._VOriginalWidth=a._DivVKbd.offsetWidth;a._VOriginalHeight=a._DivVKbd.offsetHeight;document.onmousemove=a._VResizeMouseMove;document.onmouseup=a._VResizeMoveMouseUp;
document.body.style.cursor&&(document.body.style.cursor="se-resize");c&&c.preventDefault&&c.preventDefault();c.cancelBubble=!0;return!1};a._VResizeMouseMove=function(c){var e,d,c=b._GetEventObject(c);if(!c)return!0;a.resizing=1;if(a._VPreviousMouseButton!=("undefined"==typeof c.which?c.button:c.which))return a._VResizeMoveMouseUp(c);c.pageX?(e=c.pageX,d=c.pageY):c.clientX&&(e=c.clientX+document.body.scrollLeft,d=c.clientY+document.body.scrollTop);e=a._VOriginalWidth+e-a._ResizeMouseX;d=a._VOriginalHeight+
d-a._ResizeMouseY;e<0.2*screen.width&&(e=0.2*screen.width);d<0.1*screen.height&&(d=0.1*screen.height);e>0.9*screen.width&&(e=0.9*screen.width);d>0.5*screen.height&&(e=0.5*screen.height);a._DivVKbd.style.width=e+"px";a._DivVKbd.style.height=d+"px";a._DivVKbd.style.fontSize=d/8+"px";h.showShim(a._DivVKbd,a.shim,a._DivVKbdHelp);c&&c.preventDefault&&c.preventDefault();c.cancelBubble=!0;return!1};a._VMoveMouseDown=function(c){var e,d;b._JustActivatedKeymanWebUI=1;c=b._GetEventObject(c);if(!c)return!0;
a.resizing=1;c.pageX?(e=c.pageX,d=c.pageY):c.clientX&&(e=c.clientX+document.body.scrollLeft,d=c.clientY+document.body.scrollTop);document.onmousemove!=a._VResizeMouseMove&&document.onmousemove!=a._VMoveMouseMove&&(a._VPreviousMouseMove=document.onmousemove,a._VPreviousMouseUp=document.onmouseup);a._VPreviousCursor=document.body.style.cursor;a._VPreviousMouseButton="undefined"==typeof c.which?c.button:c.which;a._VMoveX=e-a._Box.offsetLeft;a._VMoveY=d-a._Box.offsetTop;b.isCJK()&&(a.pinImg.style.left=
"15px");document.onmousemove=a._VMoveMouseMove;document.onmouseup=a._VResizeMoveMouseUp;document.body.style.cursor&&(document.body.style.cursor="move");c&&c.preventDefault&&c.preventDefault();c.cancelBubble=!0;return!1};a._VMoveMouseMove=function(c){var e,d,c=b._GetEventObject(c);if(!c||a.noDrag)return!0;a.resizing=1;a.userPositioned=!0;a.pinImg.style.display="block";if(a._VPreviousMouseButton!=("undefined"==typeof c.which?c.button:c.which))return a._VResizeMoveMouseUp(c);c.pageX?(e=c.pageX,d=c.pageY):
c.clientX&&(e=c.clientX+document.body.scrollLeft,d=c.clientY+document.body.scrollTop);a._Box.style.left=e-a._VMoveX+"px";a._Box.style.top=d-a._VMoveY+"px";a._DivVKbd?h.showShim(a._DivVKbd,a.shim,a._DivVKbdHelp):h.showShim(a._Box,a.shim);c&&c.preventDefault&&c.preventDefault();e=a.getRect();a.width=e.width;a.height=e.height;c.cancelBubble=!0;return!1};a._VResizeMoveMouseUp=function(c){c=b._GetEventObject(c);if(!c)return!0;a.resizing=0;a.currentKey=null;document.onmousemove=a._VPreviousMouseMove;document.onmouseup=
a._VPreviousMouseUp;document.body.style.cursor&&(document.body.style.cursor=a._VPreviousCursor);b._FocusLastActiveElement();c&&c.preventDefault&&c.preventDefault();b._JustActivatedKeymanWebUI=0;b._IsActivatingKeymanWebUI=0;a._DivVKbd&&(a._VOriginalWidth=a._DivVKbd.offsetWidth,a._VOriginalHeight=a._DivVKbd.offsetHeight);a.doResizeMove();c.cancelBubble=!0;a.saveCookie();return!1};a.userLocated=function(){return a.userPositioned};a.show=function(b){0<arguments.length?(a._Enabled=b)?a._Show():a._Hide(!0):
a._Visible?a._Hide(!0):a._Show()};a.doShow=function(a){return h.callEvent("osk.show",a)};a.doHide=function(a){return h.callEvent("osk.hide",a)};a.doResizeMove=function(a){return h.callEvent("osk.resizemove",a)};a._Show=function(c,e){if(!(null==a._Box||null==b._ActiveElement))if(i.touchable||null!=b._ActiveKeyboard&&a._Enabled){var d=a._Box.style;i.touchable&&""==d.bottom&&(d.visibility="hidden");if(a.ddOSK){var f,g=-1,j=a._DivVKbd.childNodes[0].childNodes;for(f=0;f<j.length;f++)j[f].layer==a.layerId?
(j[f].style.display="block",a.nextLayer=a.layerId,a.layerIndex=g=f,"string"==typeof a.layers[f].nextlayer&&(a.nextLayer=a.layers[f].nextlayer)):j[f].style.display="none";i.touchable&&(d.position="fixed",d.left=d.bottom="0px",d.height=d.maxHeight=a._Box.firstChild.firstChild.style.height,d.border="none",d.borderTop="1px solid gray",a._Enabled=1,a._Visible=1,a._DivVKbd.style.fontSize="phone"==i.formFactor?"120%":"Android"==i.OS&&"tablet"==i.formFactor&&300>parseInt(d.height,10)?"120%":"200%",a.lgKey=
a.getSpecialKey(g,"K_LOPT"),a.hkKey=a.getSpecialKey(g,"K_ROPT"),"iOS"==i.OS&&"phone"==i.formFactor&&a.adjustHeights());a.spaceBar=a.getSpecialKey(g,"K_SPACE")}d.display="block";a.showLanguage();if("desktop"==i.formFactor&&(d.position="absolute",d.display="block",d.left="0px",a.loadCookie(),0<=c?(d.left=c+"px",d.top=e+"px"):a.userPositioned?(d.left=a.x+"px",d.top=a.y+"px"):(f=b._ActiveElement,""!=a.dfltX?d.left=a.dfltX:"undefined"!=typeof f&&null!=f&&(d.left=h._GetAbsoluteX(f)+"px"),""!=a.dfltY)?d.top=
a.dfltY:"undefined"!=typeof f&&null!=f&&(d.top=h._GetAbsoluteY(f)+f.offsetHeight+"px"),a._Enabled=1,a._Visible=1,a._DivVKbd&&(a.width=a._DivVKbd.offsetWidth,a.height=a._DivVKbd.offsetHeight),a.saveCookie(),f=a.pinImg,"undefined"!=typeof f&&null!=f))f.style.display=a.userPositioned?"block":"none";"hidden"==d.visibility&&window.setTimeout(function(){a._Box.style.visibility="visible"},0);i.touchable||(d={},d.x=a._Box.offsetLeft,d.y=a._Box.offsetTop,d.userLocated=a.userPositioned,a.doShow(d))}};a.adjustRowLengths=
function(b){if(!(0<=b)){var e,d=a._DivVKbd.childNodes[0].childNodes;if(!(0>b||b>=d.length||d[b].aligned)&&"block"==d[b].style.display){e=a._DivVKbd.childNodes[0].offsetWidth-6;"Windows"==i.OS&&(e-=h.landscapeView()?4:40);var f,g=d[b].childNodes,j,n,o;for(f=0;f<g.length;f++)j=g[f].childNodes,n=j.length,o=j[n-2].offsetLeft+j[n-2].offsetWidth,j=j[n-1],j.style.width=e-o+"px";d[b].aligned=!0}}};a.resetRowLengths=function(){var b,e=a._DivVKbd.childNodes[0].childNodes,d=-1;for(b=0;b<e.length;b++)"block"==
e[b].style.display&&(d=b),e[b].aligned=!1;return d};a.getSpecialKey=function(b,e){var d,f;d=a._DivVKbd.childNodes[0].childNodes;if(0<=b&&b<d.length){d=d[b].childNodes;f=d[d.length-1].childNodes;for(d=0;d<f.length;d++)if(f[d].keyId==e)return f[d]}return null};a.hide=function(){a._Enabled=0;a._Hide(!0)};a._Hide=function(c){a._Box&&("block"==a._Box.style.display&&a._DivVKbd)&&(a.width=a._DivVKbd.offsetWidth,a.height=a._DivVKbd.offsetHeight);if(c)a._Enabled=b.isCJK()||i.touchable?1:0,a.saveCookie();else if("desktop"==
i.formFactor&&0<=document.body.className.indexOf("osk-always-visible"))return;a._Visible=0;if(a._Box&&i.touchable&&0<a._Box.offsetHeight){var e=a._Box.style;e.transition="string"==typeof e.MozBoxSizing?"opacity 0.8s linear":e.msTransition=e.WebkitTransition="opacity 0.5s linear 0";window.setTimeout(function(){var b=a._Box.style;if(a._Visible)b.transition=b.msTransition=b.MozTransition=b.WebkitTransition="";else{b.opacity="0";a._Box.addEventListener("transitionend",a.hideNow,false);a._Box.addEventListener("webkitTransitionEnd",
a.hideNow,false)}},200)}else a._Box&&(a._Box.style.display="none"),h.hideShim(a.shim);e={};e.HiddenByUser=c;a.doHide(e);c&&b._FocusLastActiveElement()};a.hideNow=function(){a._Box.removeEventListener("transitionend",a.hideNow,!1);a._Box.removeEventListener("webkitTransitionEnd",a.hideNow,!1);var b=a._Box.style;b.display="none";b.opacity="1";a._Visible=0;b.transition=b.msTransition=b.mozTransition=b.WebkitTransition="";a.hkKey&&"undefined"!=typeof a.hkKey&&a.highlightKey(a.hkKey.firstChild,!1)};a.prepare=
function(){b.initialized?(a.ready||(a._Box=h._CreateElement("DIV"),document.body.appendChild(a._Box),h.linkStyleSheet(b.getStyleSheetPath("kmwosk.css")),h.attachDOMEvent(a._Box,"mousedown",function(){b._IsActivatingKeymanWebUI=1}),i.touchable&&(h.attachDOMEvent(a._Box,"touchstart",function(a){b._IsActivatingKeymanWebUI=1;a.preventDefault();a.stopPropagation()}),h.attachDOMEvent(a._Box,"touchend",function(a){a.preventDefault();a.stopPropagation()}),h.attachDOMEvent(a._Box,"touchmove",function(a){a.preventDefault();
a.stopPropagation()}),h.attachDOMEvent(a._Box,"touchcancel",function(a){a.preventDefault();a.stopPropagation()}),a.vpScale=h.getViewportScale())),a.loadCookie(),a.ready=!0):window.setTimeout(a.prepare,200)};a._Load=function(){if(null==a._Box)99<=a.loadRetry||(window.setTimeout(a._Load,100),a.loadRetry++);else{a.loadRetry=0;b._TitleElement&&(b._TitleElement.innerHTML="Tavultesoft KeymanWeb");a._Visible=0;a.layerId="default";var c=a._Box.style;c.zIndex="9999";c.display="none";c.width="auto";c.position=
"desktop"==i.formFactor?"absolute":"fixed";"phone"==i.formFactor&&(c.fontSize="1.6em");a._DivVKbd=a._DivVKbdHelp=null;a._Box.innerHTML="";a._Box.onmouseover=a._VKbdMouseOver;a._Box.onmouseout=a._VKbdMouseOut;if(null==b._ActiveKeyboard&&!i.touchable){var e=h._CreateElement("DIV");e.className="kmw-title-bar";e.appendChild(a._TitleBarInterior());e.onmousedown=a._VMoveMouseDown;a._Box.appendChild(e);e=h._CreateElement("DIV");e.className="kmw-osk-none";a._Box.appendChild(e)}else{var d=e=null,f=null,c=
"";a._Box.className="";if(null!=b._ActiveKeyboard&&(e=b._ActiveKeyboard.KV,c=b._ActiveKeyboard.KH,d=b._ActiveKeyboard.KVKL,"undefined"!=typeof d&&null!=d&&(f=d[i.formFactor],"undefined"==typeof f||null==f)))if("phone"==i.formFactor?f=d.tablet:"tablet"==i.formFactor&&(f=d.phone),"undefined"==typeof f||null==f)f=d.desktop;if(null!=e&&null!=e.BK){for(var d=e.BK,g=!0,j=0;j<d.length;j++)if(0<d[j].length){g=!1;break}g&&(e=null)}null!=e||""==c||i.touchable?(null==e&&(e={F:"Tahoma",BK:"`1234567890-=\u00a7~~qwertyuiop[]\\~~~asdfghjkl;'~~~~~?zxcvbnm,./~~~~~ ~!@#$%^&*()_+\u00a7~~QWERTYUIOP{}\\~~~ASDFGHJKL:\"~~~~~?ZXCVBNM<>?~~~~~ "}),
a._GenerateVisualKeyboard(e,c,f)):(a.ddOSK=!1,e=h._CreateElement("DIV"),e.className="kmw-title-bar",e.appendChild(a._TitleBarInterior()),e.onmousedown=a._VMoveMouseDown,a._Box.appendChild(e),e=h._CreateElement("DIV"),e.className="kmw-osk-static",e.innerHTML=c,a._Box.appendChild(e),b._ActiveKeyboard.KHF&&b._ActiveKeyboard.KHF(a._Box));b._TitleElement&&(b._TitleElement.innerHTML="<span style='font-weight:bold'>"+b._ActiveKeyboard.KN+"</span> - "+b._TitleElement.innerHTML,b._TitleElement.className="",
b._TitleElement.style.color="#fff")}a.createKeyTip();c=a._Box.firstChild;e=" kmw-keyboard-"+(b._ActiveKeyboard?b._ActiveKeyboard.KI.replace("Keyboard_",""):"");"keymanweb_title_bar"==c.id&&(c=c.nextSibling);c.className="kmw-osk-inner-frame"+e;a.appendStyleSheet();a._Enabled&&a._Show()}};a.appendStyleSheet=function(){if(null!=b._ActiveStub){a.styleSheet&&h.removeStyleSheet(a.styleSheet);var c=b._ActiveStub,e=c.KFont,c=c.KOskFont;h.addFontFaceStyleSheet(e);h.addFontFaceStyleSheet(c);b.alignInputs(!1);
var d=a.addFontStyle(e,c);null!=b._ActiveKeyboard&&"string"==typeof b._ActiveKeyboard.KCSS&&(d+=b._ActiveKeyboard.KCSS);a.styleSheet=h.addStyleSheet(d);a.waitForFonts(e,c)&&b.alignInputs(!0)}};a.addFontStyle=function(a,e){var d=b.baseFont;"undefined"!=typeof a&&"undefined"!=typeof a.family&&(d=a.family);var d=d.replace(/\u0022/g,""),f=RegExp("s?"+d+",?"),g=b.appliedFont.replace(/\u0022/g,""),g=g.replace(f,""),g=g.replace(/,$/,""),g='"'+(""==g?d:d+","+g).replace(/\,\s?/g,'","')+'"',d=".keymanweb-font{\nfont-family:"+
g+" !important;\n}\n";"undefined"!=typeof e?d=d+'.kmw-key-text{\nfont-family:"'+e.family.replace(/\u0022/g,"").replace(/,/g,'","')+'";\n}\n':"undefined"!=typeof a&&(d=d+'.kmw-key-text{\nfont-family:"'+a.family.replace(/\u0022/g,"").replace(/,/g,'","')+'";\n}\n');b.appliedFont=g;return d};a._Unload=function(){a._VShift=a._DivVKbd=a._VKeySpans=a._Box=0};a.saveCookie=function(){var b=h.loadCookie("KeymanWeb_OnScreenKeyboard"),e=a.getPos();b.visible=a._Enabled?1:0;b.userSet=a.userPositioned?1:0;b.left=
e.left;b.top=e.top;a._DivVKbd&&(b.width=a.width,b.height=a.height);h.saveCookie("KeymanWeb_OnScreenKeyboard",b)};a.loadCookie=function(){var b=h.loadCookie("KeymanWeb_OnScreenKeyboard");if("undefined"==typeof b||null==b)return a.userPositioned=!1;a._Enabled=h.toNumber(b.visible,!0);a.userPositioned=h.toNumber(b.userSet,!1);a.x=h.toNumber(b.left,-1);a.y=h.toNumber(b.top,-1);var e=h.toNumber(b.width,0.3*screen.width),b=h.toNumber(b.height,0.15*screen.height);e<0.2*screen.width&&(e=0.2*screen.width);
b<0.1*screen.height&&(b=0.1*screen.height);e>0.9*screen.width&&(e=0.9*screen.width);b>0.5*screen.height&&(e=0.5*screen.height);a._DivVKbd&&(a._DivVKbd.style.width=e+"px",a._DivVKbd.style.height=b+"px",a._DivVKbd.style.fontSize=b/8+"px");if(-1==a.x||-1==a.y||!a._Box)a.userPositioned=!1;a.x<window.pageXOffset-0.8*e&&(a.x=window.pageXOffset-0.8*e);0>a.y&&(a.x=-1,a.y=-1,a.userPositioned=!1);a.userPositioned&&a._Box&&a.setPos({left:a.x,top:a.y});return!0}})();(function(){var b=window.tavultesoft.keymanweb,a=b.osk,h=b.util,i=h.device;b.fullInitialization=!0;b.setDefaultDeviceOptions=function(a){""==a.attachType&&(a.attachType=i.touchable?"manual":"auto")};h.wait=function(a){var g=b.waiting;if(!("undefined"==typeof g||null==g||b.warned)){var c=g.firstChild.childNodes;a?(g.pending=!0,window.setTimeout(function(){g.pending&&(window.scrollTo(0,0),c[0].style.display="none",c[1].className="kmw-wait-text",c[1].innerHTML=a,c[2].style.display="block",g.style.display=
"block")},1E3)):g.pending&&(c[1].innerHTML="",g.pending=!1,g.style.display="none")}};b.getStyleSheetPath=function(a){return h.getOption("resources")+"osk/"+a};b.getKeyboardPath=function(a){return(/^(([.]\/)|([.][.]\/)|(\/))|(:)/.test(a)?"":b.options.keyboards)+a};b.keyboardUnavailable=function(a){return window.setTimeout(function(){h.wait(!1);var g=b._KeyboardStubs[a],c=g.KN,g=g.KL,c=c.replace(/\s*keyboard\s*/i,"");h.alert("Sorry, the "+c+" keyboard for "+g+" is not currently available!",b.setDfltKeyboard);
0<a&&(g=b._KeyboardStubs[0],b._SetActiveKeyboard(g.KI,g.KLC,!0))},1E4)};b.KC_=function(a,g,c){var e,d="",f=c.body?c:c.ownerDocument;if(i.touchable)d=b.getTextBeforeCaret(c);else if(b.legacy)d=c.value;else if(f&&(e=f.defaultView)&&e.getSelection&&("on"==f.designMode.toLowerCase()||"true"==c.contentEditable||"plaintext-only"==c.contentEditable||""===c.contentEditable))c=e.getSelection(),3==c.focusNode.nodeType&&(d=c.focusNode.substringData(0,c.focusOffset));else if(c.setSelectionRange){if(c._KeymanWebSelectionStart)d=
c._KeymanWebSelectionStart;else{if(null===b._CachedSelectionStart||c.selectionStart!==b._LastCachedSelection)b._LastCachedSelection=c.selectionStart,b._CachedSelectionStart=c.value._kmwCodeUnitToCodePoint(c.selectionStart),b._CachedSelectionEnd=c.value._kmwCodeUnitToCodePoint(c.selectionEnd);d=b._CachedSelectionStart}d=c.value._kmwSubstr(0,d)}else if(f&&(e=f.selection))c=e.createRange(),c.moveStart("character",-2*a),d=c.text;d._kmwLength()<a&&(d=Array(a-d._kmwLength()+1).join("\ufffe")+d);return d._kmwSubstr(-a)._kmwSubstr(0,
g)};b.alignInputs=function(a){if(i.touchable)for(var g=0;g<b.inputList.length;g++)a?(b.updateInput(b.inputList[g]),b.inputList[g].style.visibility="visible",0<b.inputList[g].base.textContent.length&&(b.inputList[g].base.style.visibility="hidden")):(b.inputList[g].style.visibility="hidden",b.inputList[g].base.style.visibility="visible")};a.highlightSubKeys=function(b,g,c){if(!(null==b||null==b.subKeys)){var e,d,f,i,k,n,o,l=document.getElementById("kmw-popup-keys");5<a.touchY-c&&null==l&&(a.subkeyDelayTimer&&
window.clearTimeout(a.subkeyDelayTimer),a.showSubKeys(b),l=document.getElementById("kmw-popup-keys"));for(e=0;e<b.subKeys.length;e++)try{d=l.childNodes[e].firstChild,f=h._GetAbsoluteX(d),i=h._GetAbsoluteY(d),k=f+d.offsetWidth,n=i+d.offsetHeight,o=g>f&&g<k&&c>i&&c<n,a.highlightKey(d,o),o&&a.highlightKey(b,!1)}catch(p){}}};a.optionKey=function(h,g,c){c&&(0<=g.indexOf("K_LOPT")?a.showLanguageMenu():0<=g.indexOf("K_ROPT")&&(b._IsActivatingKeymanWebUI=0,a._Hide(!0),b.hideCaret(),b._LastActiveElement=0))};
a.createKeyTip=function(){"phone"==i.formFactor&&(null==a.keytip&&(a.keytip=h._CreateElement("DIV"),a.keytip.className="kmw-keytip",a.keytip.id="kmw-keytip",a.keytip.style.pointerEvents="none",a.keytip.appendChild(h._CreateElement("CANVAS")),a.keytip.appendChild(h._CreateElement("SPAN")),a.keytip.key=null,a.keytip.state=!1),a._Box.appendChild(a.keytip))};a.showKeyTip=function(b,g){var c=a.keytip;if(!(null==c||b==c.key&&g==c.state)){var e=document.getElementById("kmw-popup-keys"),e=e&&"visible"==e.style.visibility;
if(g&&!e){for(var d=h._GetAbsoluteY(a._Box),f=a._Box.offsetHeight,e=h._GetAbsoluteX(b),i=h._GetAbsoluteY(b),k=b.offsetWidth,n=b.offsetHeight,o=b.firstChild,l=c.style,p=c.childNodes[1],q=p.style,w=0,t=c.firstChild,s=0;s<b.childNodes.length&&!(o=b.childNodes[s],a.hasClass(o,"kmw-key-text"));s++);t.width=1.6*k;t.height=2.3*n;l.top="auto";l.bottom=d+f-i-n+"px";l.textAlign="center";l.overflow="visible";l.fontFamily=h.getStyleValue(o,"font-family");l.width=t.width+"px";l.height=t.height+"px";d=h.getStyleInt(o,
"font-size");0!=d&&(l.fontSize=1.8*d+"px");p.textContent=o.textContent;q.display="block";q.position="absolute";q.textAlign="center";q.width="100%";q.top="2%";q.bottom="auto";o=(t.width-k)/2;e<o?(w=-1,e+=o):e>window.innerWidth-k-o&&(w=1,e-=o);a.drawPreview(t,k,n,w);l.left=e-o+"px";l.display="block"}else c.style.display="none";c.key=b;c.state=g}};a.drawPreview=function(a,b,c,e){var c=a.getContext("2d"),d=(a.width-b)/2,f=a.height,h=0,k=d,n=b+d,b=b+2*d,o=0.5*f,l=0.6*f,p=8;"Android"==i.OS&&(p=3);switch(e){case -1:k-=
d;n-=d;b-=d;break;case 1:h+=d,k+=d,n+=d}c.clearRect(0,0,a.width,a.height);"Android"==i.OS?(k=n=(k+n)/2,c.fillStyle="#999"):c.fillStyle="#ffffff";c.lineWidth="1";c.strokeStyle="#cccccc";c.save();c.beginPath();c.moveTo(h+p,0);c.arcTo(b,0,b,p,p);"Android"==i.OS?(c.arcTo(b,o,n,l,p),c.arcTo(n,l,k,l,p)):(c.arcTo(b,o,n,l,p),c.arcTo(n,l,n-p,f,p),c.arcTo(n,f,k,f,p),c.arcTo(k,f,k,l-p,p));c.arcTo(k,l,h,o-p,p);c.arcTo(h,o,h,p,p);c.arcTo(h,0,h+p,0,p);c.fill();c.stroke();c.restore()};a.addCallout=function(b){if("phone"!=
i.formFactor||"iOS"!=i.OS)return null;var g=h._CreateElement("DIV"),c=g.style;g.id="kmw-popup-callout";a._Box.appendChild(g);var e=b.offsetLeft,d=b.offsetWidth,f=b.offsetHeight;c.top=b.offsetTop-6+"px";c.left=e+"px";c.width=d+"px";c.height=f+6+"px";return g};a.touchHold=function(b){a.subkeyDelayTimer&&(window.clearTimeout(a.subkeyDelayTimer),a.subkeyDelayTimer=null);"undefined"!=typeof b.subKeys&&null!=b.subKeys&&(a.subkeyDelayTimer=window.setTimeout(function(){a.clearPopup();a.showSubKeys(b)},a.popupDelay))};
b.handleRotationEvents=function(){"iOS"==i.OS&&h.attachDOMEvent(window,"orientationchange",b.rotateDevice);"Android"==i.OS&&(a.wasVisible=a.isVisible,"onmozorientationchange"in screen?h.attachDOMEvent(screen,"mozorientationchange",a.hideNow):h.attachDOMEvent(window,"orientationchange",a.hideNow),h.attachDOMEvent(window,"resize",function(){b.alignInputs(!0);a.hideLanguageList();a._Load();a.wasVisible&&a._Show()}))};b.rotateDevice=function(){a.hideLanguageList();a._Visible&&(a.adjustHeights(),"phone"==
i.formFactor&&"Android"==i.OS&&window.setTimeout(function(){window.scrollTo(0,1)},1E3))};a.waitForFonts=function(a,g){if("undefined"==typeof a&&"undefined"==typeof g||"undefined"==typeof a.files&&"undefined"==typeof g.files)return!0;var c=h.checkFontDescriptor(a),e=h.checkFontDescriptor(g);if(c&&e)return!0;b.fontCheckTimer=window.setInterval(function(){h.checkFontDescriptor(a)&&h.checkFontDescriptor(g)&&(window.clearInterval(b.fontCheckTimer),b.fontCheckTimer=null,b.alignInputs(!0))},100);window.setTimeout(function(){b.fontCheckTimer&&
(window.clearInterval(b.fontCheckTimer),b.fontCheckTimer=null,b.alignInputs(!0))},5E3);return!1}})();(function(){var b=window.tavultesoft.keymanweb,a=b.util,h=b.osk,i=a.device;b.TSS_LAYER=33;b.TSS_PLATFORM=31;b._BeepObjects=[];b._BeepTimeout=0;b.KSF=b.KSF=function(){b._IgnoreNextSelChange=1};b.KT=b.KT=function(a,g){b.cachedContext.reset();var c=b._LastActiveElement,e,d,f;e=!1;null!=c&&(e=c._KeymanWebSelectionStart,d=c._KeymanWebSelectionEnd,f=b._Selection,b._IsActivatingKeymanWebUI=1,b._IgnoreNextSelChange=100,b._FocusLastActiveElement(),b._IsMozillaEditableIframe(c,0)&&(c=c.documentElement),document.selection&&
null!=f&&f.select(),c._KeymanWebSelectionStart=e,c._KeymanWebSelectionEnd=d,b._IgnoreNextSelChange=0,null!=a&&b.KO(0,c,a),"undefined"!=typeof g&&b.KDO(0,c,g),c._KeymanWebSelectionStart=null,c._KeymanWebSelectionEnd=null,e=!0);return e};b.KR=b.KR=function(j){b.loadTimer&&j.KI==b._LoadingInternalName&&(window.clearTimeout(b.loadTimer),b.loadTimer=null);if(b.initialized){var g,c=b._ActiveStub;if(!c||!("KI"in c)||c.KI!=j.KI)for(g=0;g<b._KeyboardStubs.length;g++){c=b._KeyboardStubs[g];if(j.KI==c.KI)break;
c=null}null==b._ActiveStub&&null!=c&&(b._ActiveStub=c);for(g=0;g<b._Keyboards.length;g++)if(j.KI==b._Keyboards[g].KI)return;b._Keyboards=b._push(b._Keyboards,j);b._LoadingInternalName==j.KI&&(b.doBeforeKeyboardChange(j.KI,c.KLC),b._ActiveKeyboard=j,null!=b._LastActiveElement&&(b._JustActivatedKeymanWebUI=1,b._SetTargDir(b._LastActiveElement)),b._LoadingInternalName=null,j.KL="undefined"!=typeof c.KL?c.KL:"",j.KLC="undefined"!=typeof c.KLC?c.KLC:"",j.KR="undefined"!=typeof c.KR?c.KR:"",j.KRC="undefined"!=
typeof c.KRC?c.KRC:"",j.KC="undefined"!=typeof c.KC?c.KC:"",j.KCC="undefined"!=typeof c.KCC?c.KCC:"",j.KD="undefined"!=typeof c.KD?c.KD:"",j.KS="undefined"!=typeof c.KS?c.KS:0,String.kmwEnableSupplementaryPlane(c&&(c.KS&&1==c.KS||"Hieroglyphic"==j.KN)),b.saveCurrentKeyboard(j.KI,c.KLC),h._Load(),"function"==typeof a.wait&&a.wait(!1));b.doKeyboardLoaded(j.KI)}else b.deferredKR.push(j)};b.KRS=b.KRS=function(a){var g;if(b.initialized){null==b.dfltStub&&(b.dfltStub=a);"undefined"==typeof a.KLC&&(a.KLC=
"");"undefined"==typeof a.KL&&(a.KL="undefined");for(g=0;g<b._KeyboardStubs.length;g++)if(b._KeyboardStubs[g].KI==a.KI&&(""==a.KLC||b._KeyboardStubs[g].KLC==a.KLC))return 1;b._KeyboardStubs=b._push(b._KeyboardStubs,a);b.doKeyboardRegistered(a.KI,a.KL,a.KN,a.KLC)}else b.deferredKRS.push(a)};b.KC=b.KC=function(a,g,c){var e=b.cachedContext.get(a,g);if(null!==e)return e;c=b.KC_(a,g,c);b.cachedContext.set(a,g,c);return c};b.KN=b.KN=function(a,b){var c=this.KC(a+1,1,b);return!1===c?!0:"\ufffe"===c};b.KCM=
b.KCM=function(a,b,c,e){a=this.KC(a,e,b);if(!1!==a&&a===c)return!0;this._DeadkeyResetMatched();return!1};b.KIK=b.KIK=function(a){return b._ActiveKeyboard.KM?!a.LisVirtualKey:b._USKeyCodeToCharCode(a)?!0:!1};b.KKM=b.KKM=function(a,b,c){var e=0,d=173==a.Lcode?189:a.Lcode;255<a.vkCode&&(d=a.vkCode);if(a.LisVirtualKey||255<d){if(16384==(b&16384)||255<d)e=c==d&&(b&127)==a.Lmodifiers}else 0==(b&16384)&&(e=d==c);e||this._DeadkeyResetMatched();return e};b.KKI=b.KKI=function(a){var b={};b.vk=a.LisVirtualKey;
b.code=a.Lcode;b.modifiers=a.Lmodifiers;return b};b.KDM=b.KDM=function(a,g,c){if(0==b._DeadKeys.length)return!1;a=b._SelPos(g)-a;for(g=0;g<b._DeadKeys.length;g++)if(b._DeadKeys[g].p==a&&b._DeadKeys[g].d==c)return b._DeadKeys[g].matched=1;this._DeadkeyResetMatched();return!1};b.KBR=b.KBR=function(){b.cachedContext.reset();var a;for(a=b._BeepTimeout=0;a<b._BeepObjects.length;a++)b._BeepObjects[a].e.style.backgroundColor=b._BeepObjects[a].c;b._BeepObjects=[]};b.KB=b.KB=function(a){b.cachedContext.reset();
a.body&&(a=a.body);if(a.style&&"undefined"!=typeof a.style.backgroundColor){for(var g=0;g<b._BeepObjects.length;g++)if(b._BeepObjects[g].e==a)return;b._BeepObjects=b._push(b._BeepObjects,{e:a,c:a.style.backgroundColor});a.style.backgroundColor="#000000";0==b._BeepTimeout&&(b._BeepTimeout=1,window.setTimeout(b.KBR,50))}};b.KA=b.KA=function(a,g,c){if(""==g)return 0;g=c._kmwIndexOf(g);b._AnyIndices[a]=g;return 0<=g};b.KO=b.KO=function(a,g,c){b.cachedContext.reset();if("oninserttext"in b)b.oninserttext(a,
c);var e=g.body?g:g.ownerDocument,d;if(0<=g.className.indexOf("keymanweb-input")){var f=b.getTextBeforeCaret(g),f=0<a?f._kmwSubstr(0,f._kmwLength()-a)+c:f+c;b.setTextBeforeCaret(g,f)}else{if(b.legacy)g.value=0<a?g.value._kmwSubstr(0,g.value._kmwLength()-a)+c:g.value+c;else if(e&&(d=e.defaultView)&&d.getSelection&&("on"==e.designMode.toLowerCase()||"true"==g.contentEditable||"plaintext-only"==g.contentEditable||""===g.contentEditable)){var h="on"==e.designMode.toLowerCase();if(h)var i=b._CacheCommands(e);
d=d.getSelection();f=d.focusNode.nodeValue?d.focusNode.substringData(0,d.focusOffset)._kmwLength():0;d.isCollapsed||d.deleteFromDocument();var n=d.getRangeAt(0);0<a&&(n.setStart(d.focusNode,d.focusOffset-d.focusNode.nodeValue.substr(0,d.focusOffset)._kmwSubstr(-a).length),n.deleteContents());if(0<c._kmwLength())if(3==d.focusNode.nodeType){n=d.focusOffset;d.focusNode.insertData(d.focusOffset,c);try{d.extend(d.focusNode,n+c.length)}catch(o){d.focusNode.parentNode.scrollIntoView(),d.extend(d.focusNode,
n+c.length)}}else{var l=e.createTextNode(c);n.insertNode(l);d.extend(l,c.length)}h&&b._CacheCommandsReset(e,i,null);d.collapseToEnd();0<=a&&(b._DeadkeyDeleteMatched(),b._DeadkeyAdjustPos(f,-a+c._kmwLength()))}else if(e&&(d=e.selection)){if(e.body.isContentEditable||"on"==e.designMode.toLowerCase())i=b._CacheCommands(e);n=d.createRange();""!=n.text?(d.clear(),a=0):n.collapse(!0);0<a?(n.moveStart("character",-2*a),h=n.text._kmwSubstr(-a),n.collapse(!1),n.moveStart("character",-h.length)):a=0;n.text=
c;if(e.body.isContentEditable||"on"==e.designMode.toLowerCase())n.moveStart("character",-c.length),b._CacheCommandsReset(e,i,n.select),n.moveStart("character",c.length),n.select();0<=a&&(b._DeadkeyDeleteMatched(),b._DeadkeyAdjustPos(f,-a+c._kmwLength()));b._Selection=d.createRange();b._Selection.select();b._Selection.scrollIntoView()}else g.setSelectionRange&&(null!=g._KeymanWebSelectionStart?(f=g._KeymanWebSelectionStart,e=g._KeymanWebSelectionEnd):(f=g.value._kmwCodeUnitToCodePoint(g.selectionStart),
e=g.value._kmwCodeUnitToCodePoint(g.selectionEnd)),"textarea"==g.type.toLowerCase()&&"undefined"!=typeof g.scrollTop&&(h=g.scrollTop,n=g.scrollLeft),0>a?(g.value=g.value._kmwSubstring(0,f)+c+g.value._kmwSubstring(e),a=0):g.value=f<a?c+g.value._kmwSubstring(e):g.value._kmwSubstring(0,f-a)+c+g.value._kmwSubstring(e),0<=a&&(b._DeadkeyDeleteMatched(),b._DeadkeyAdjustPos(f,-a+c._kmwLength())),"undefined"!=typeof h&&(g.scrollTop=h,g.scrollLeft=n),a=f-a+c._kmwLength(),a=g.value._kmwCodePointToCodeUnit(a),
g.setSelectionRange(a,a),g._KeymanWebSelectionStart=null,g._KeymanWebSelectionEnd=null);"function"==typeof b.refreshElementContent&&b.refreshElementContent(g)}};b.KDO=b.KDO=function(a,g,c){b.cachedContext.reset();var e={};0<=a&&b.KO(a,g,"");e.p=b._SelPos(g);e.d=c;b._DeadKeys=b._push(b._DeadKeys,e)};b.KIO=b.KIO=function(a,g,c,e){b.cachedContext.reset();b._AnyIndices[c-1]<g._kmwLength()&&b.KO(a,e,g._kmwCharAt(b._AnyIndices[c-1]))};b._CacheCommands=function(a){var g=[["backcolor",1],["fontname",1],["fontsize",
1],["forecolor",1],["bold",0],["italic",0],["strikethrough",0],["subscript",0],["superscript",0],["underline",0]];a.defaultView&&b._push(g,["hilitecolor",1]);for(var c=0;c<g.length;c++)b._push(g[c],g[c][1]?a.queryCommandValue(g[c][0]):a.queryCommandState(g[c][0]));return g};b._CacheCommandsReset=function(a,b,c){for(var e=0;e<b.length;e++)b[e][1]?a.queryCommandValue(b[e][0])!=b[e][2]&&(c&&c(),a.execCommand(b[e][0],!1,b[e][2])):a.queryCommandState(b[e][0])!=b[e][2]&&(c&&c(),a.execCommand(b[e][0],!1,
null))};b.KIFS=b.KIFS=function(a,g){var c=!0;if(a==b.TSS_LAYER)c=h.layerId===g;else if(a==b.TSS_PLATFORM){var e,d,f=g.split(" ");for(e=0;e<f.length;e++){d=f[e].toLowerCase();switch(d){case "touch":case "hardware":i.touchable!=("touch"==d)&&(c=!1)}switch(d){case "windows":case "android":case "ios":case "macosx":case "linux":i.OS.toLowerCase()!=d&&(c=!1)}switch(d){case "tablet":case "phone":case "desktop":i.formFactor!=d&&(c=!1)}switch(d){case "native":case "web":case "ie":case "chrome":case "firefox":case "safari":case "opera":i.browser!=
d&&(c=!1)}}}return c};b.KSETS=function(a,g){b.cachedContext.reset();return a==b.TSS_LAYER?h.showLayer(g):!1};b.KLOAD=function(h,g,c){b.cachedContext.reset();h=a.loadCookie("KeymanWeb_"+h+"_Option_"+g);return"undefined"!=typeof h[g]?unescape(h[g]):c};b.KSAVE=function(h,g){b.cachedContext.reset();var c=b._ActiveKeyboard;if(!c||"undefined"==typeof c.KI||""==c.KI)return!1;var c="KeymanWeb_"+c.KI+"_Option_"+h,e=escape(g);a.saveCookie(c,e);return!0};b.GetLastActiveElement=function(){return b._LastActiveElement};
b.FocusLastActiveElement=function(){b._FocusLastActiveElement()};b.HideHelp=function(){h._Hide(!0)};b.ShowHelp=function(a,b){h._Show(a,b)};b.ShowPinnedHelp=function(){h.userPositioned=!0;h._Show(-1,-1)};b.cachedContext={_cache:[],reset:function(){this._cache=[]},get:function(a,b){return"undefined"==typeof this._cache[a]||"undefined"==typeof this._cache[a][b]?null:this._cache[a][b]},set:function(a,b,c){"undefined"==typeof this._cache[a]&&(this._cache[a]=[]);this._cache[a][b]=c}}})();(function(){var b=window.tavultesoft.keymanweb,a=b._VKMap_FF_IE={};a.k61=187;a.k59=186;b._VKMap_Opera_IE={};b._VKMap_Safari_IE={};a=b._VKMap={};a.se={};a.se.k220=192;a.se.k187=189;a.se.k219=187;a.se.k221=219;a.se.k186=221;a.se.k191=220;a.se.k192=186;a.se.k189=191;a.uk={};a.uk.k223=192;a.uk.k192=222;a.uk.k222=226;a.uk.k220=220;var a={},h={};a.k192=96;a.k49=49;a.k50=50;a.k51=51;a.k52=52;a.k53=53;a.k54=54;a.k55=55;a.k56=56;a.k57=57;a.k48=48;a.k189=45;a.k187=61;a.k81=113;a.k87=119;a.k69=101;a.k82=114;
a.k84=116;a.k89=121;a.k85=117;a.k73=105;a.k79=111;a.k80=112;a.k219=91;a.k221=93;a.k220=92;a.k65=97;a.k83=115;a.k68=100;a.k70=102;a.k71=103;a.k72=104;a.k74=106;a.k75=107;a.k76=108;a.k186=59;a.k222=39;a.k90=122;a.k88=120;a.k67=99;a.k86=118;a.k66=98;a.k78=110;a.k77=109;a.k188=44;a.k190=46;a.k191=47;h.k192=126;h.k49=33;h.k50=64;h.k51=35;h.k52=36;h.k53=37;h.k54=94;h.k55=38;h.k56=42;h.k57=40;h.k48=41;h.k189=95;h.k187=43;h.k81=81;h.k87=87;h.k69=69;h.k82=82;h.k84=84;h.k89=89;h.k85=85;h.k73=73;h.k79=79;h.k80=
80;h.k219=123;h.k221=125;h.k220=124;h.k65=65;h.k83=83;h.k68=68;h.k70=70;h.k71=71;h.k72=72;h.k74=74;h.k75=75;h.k76=76;h.k186=58;h.k222=34;h.k90=90;h.k88=88;h.k67=67;h.k86=86;h.k66=66;h.k78=78;h.k77=77;h.k188=60;h.k190=62;h.k191=63;b._USCharCode=[a,h];b._USKeyCodeToCharCode=function(a){return b._USCharCode[a.Lmodifiers&16?1:0]["k"+a.Lcode]}})();window.dfltLayout={desktop:{font:"Tahoma,Helvetica",layer:[{id:"default",row:[{id:"1",key:[{id:"K_BKQUOTE"},{id:"K_1"},{id:"K_2"},{id:"K_3"},{id:"K_4"},{id:"K_5"},{id:"K_6"},{id:"K_7"},{id:"K_8"},{id:"K_9"},{id:"K_0"},{id:"K_HYPHEN"},{id:"K_EQUAL"},{id:"K_BKSP",text:"*BkSp*",sp:"1",width:"130"}]},{id:"2",key:[{id:"K_TAB",text:"*Tab*",sp:"1",width:"130"},{id:"K_Q"},{id:"K_W"},{id:"K_E"},{id:"K_R"},{id:"K_T"},{id:"K_Y"},{id:"K_U"},{id:"K_I"},{id:"K_O"},{id:"K_P"},{id:"K_LBRKT"},{id:"K_RBRKT"},{id:"K_BKSLASH"}]},
{id:"3",key:[{id:"K_CAPS",text:"*Caps*",sp:"1",width:"165"},{id:"K_A"},{id:"K_S"},{id:"K_D"},{id:"K_F"},{id:"K_G"},{id:"K_H"},{id:"K_J"},{id:"K_K"},{id:"K_L"},{id:"K_COLON"},{id:"K_QUOTE"},{id:"K_ENTER",text:"*Enter*",sp:"1",width:"165"}]},{id:"4",key:[{id:"K_SHIFT",text:"*Shift*",sp:"1",width:"130"},{id:"K_oE2"},{id:"K_Z"},{id:"K_X"},{id:"K_C"},{id:"K_V"},{id:"K_B"},{id:"K_N"},{id:"K_M"},{id:"K_COMMA"},{id:"K_PERIOD"},{id:"K_SLASH"},{id:"K_RSHIFT",text:"*Shift*",sp:"1",width:"130"}]},{id:"5",key:[{id:"K_LCONTROL",
text:"*Ctrl*",sp:"1",width:"170"},{id:"K_LALT",text:"*Alt*",sp:"1",width:"160"},{id:"K_SPACE",text:"",width:"770"},{id:"K_ALT",text:"*Alt*",sp:"1",width:"160"},{id:"K_RCONTROL",text:"*Ctrl*",sp:"1",width:"170"}]}]}]},tablet:{font:"Tahoma,Helvetica",layer:[{id:"default",row:[{id:"0",key:[{id:"K_1"},{id:"K_2"},{id:"K_3"},{id:"K_4"},{id:"K_5"},{id:"K_6"},{id:"K_7"},{id:"K_8"},{id:"K_9"},{id:"K_0"},{id:"K_HYPHEN"},{id:"K_EQUAL"},{sp:"10",width:"1"}]},{id:"1",key:[{id:"K_Q",pad:"25"},{id:"K_W"},{id:"K_E"},
{id:"K_R"},{id:"K_T"},{id:"K_Y"},{id:"K_U"},{id:"K_I"},{id:"K_O"},{id:"K_P"},{id:"K_LBRKT"},{id:"K_RBRKT"},{sp:"10",width:"1"}]},{id:"2",key:[{id:"K_A",pad:"50"},{id:"K_S"},{id:"K_D"},{id:"K_F"},{id:"K_G"},{id:"K_H"},{id:"K_J"},{id:"K_K"},{id:"K_L"},{id:"K_COLON"},{id:"K_QUOTE"},{id:"K_BKSLASH",width:"90"}]},{id:"3",key:[{id:"K_oE2",width:"90"},{id:"K_Z"},{id:"K_X"},{id:"K_C"},{id:"K_V"},{id:"K_B"},{id:"K_N"},{id:"K_M"},{id:"K_COMMA"},{id:"K_PERIOD"},{id:"K_SLASH"},{id:"K_BKQUOTE"},{sp:"10",width:"1"}]},
{id:"4",key:[{id:"K_SHIFT",text:"*Shift*",sp:"1",width:"200",sk:[{id:"K_LCONTROL",text:"*Ctrl*",sp:"1",width:"50",nextlayer:"ctrl"},{id:"K_LALT",text:"*Alt*",sp:"1",width:"50",nextlayer:"alt"},{id:"K_ALTGR",text:"*AltGr*",sp:"1",width:"50",nextlayer:"ctrlalt"}]},{id:"K_LOPT",text:"*Menu*",sp:"1",width:"150"},{id:"K_SPACE",text:"",width:"570"},{id:"K_BKSP",text:"*BkSp*",sp:"1",width:"150"},{id:"K_ENTER",text:"*Enter*",sp:"1",width:"200"}]}]}]},phone:{font:"Tahoma,Helvetica",layer:[{id:"default",row:[{id:"0",
key:[{id:"K_1"},{id:"K_2"},{id:"K_3"},{id:"K_4"},{id:"K_5"},{id:"K_6"},{id:"K_7"},{id:"K_8"},{id:"K_9"},{id:"K_0"},{id:"K_HYPHEN"},{id:"K_EQUAL"},{sp:"10",width:"1"}]},{id:"1",key:[{id:"K_Q",pad:"25"},{id:"K_W"},{id:"K_E"},{id:"K_R"},{id:"K_T"},{id:"K_Y"},{id:"K_U"},{id:"K_I"},{id:"K_O"},{id:"K_P"},{id:"K_LBRKT"},{id:"K_RBRKT"},{sp:"10",width:"1"}]},{id:"2",key:[{id:"K_A",pad:"50"},{id:"K_S"},{id:"K_D"},{id:"K_F"},{id:"K_G"},{id:"K_H"},{id:"K_J"},{id:"K_K"},{id:"K_L"},{id:"K_COLON"},{id:"K_QUOTE"},
{id:"K_BKSLASH",width:"90"}]},{id:"3",key:[{id:"K_oE2",width:"90"},{id:"K_Z"},{id:"K_X"},{id:"K_C"},{id:"K_V"},{id:"K_B"},{id:"K_N"},{id:"K_M"},{id:"K_COMMA"},{id:"K_PERIOD"},{id:"K_SLASH"},{id:"K_BKQUOTE"},{sp:"10",width:"1"}]},{id:"4",key:[{id:"K_SHIFT",text:"*Shift*",sp:"1",width:"200",sk:[{id:"K_LCONTROL",text:"*Ctrl*",sp:"1",width:"50",nextlayer:"ctrl"},{id:"K_LALT",text:"*Alt*",sp:"1",width:"50",nextlayer:"alt"},{id:"K_ALTGR",text:"*AltGr*",sp:"1",width:"50",nextlayer:"ctrlalt"}]},{id:"K_LOPT",
text:"*Menu*",width:"150",sp:"1"},{id:"K_SPACE",width:"570",text:""},{id:"K_BKSP",text:"*BkSp*",width:"150",sp:"1"},{id:"K_ENTER",text:"*Enter*",width:"200",sp:"1"}]}]}]}};(function(){var b=window.tavultesoft.keymanweb;if("complete"===document.readyState)b.init(null);else var a=window.setInterval(function(){"complete"===document.readyState&&(window.clearInterval(a),b.init(null))},10)})();