var Service_Url="https://gateway-officials.eci.gov.in/CDAC-EnhanceTransliterationAPI/",Service_Url_Arr=["https://gateway-officials.eci.gov.in/CDAC-EnhanceTransliterationAPI/","https://gateway-officials.eci.gov.in/CDAC-EnhanceTransliterationAPI/"],jsFolderPath="/Packages/transliteration/js",cssFolderPath=jsFolderPath+"/css",imageFolderPath=jsFolderPath+"/images",glocale="",languageName="",maxTypingLength=15,$=("undefined"!=typeof jQuery||window.jQuery?"undefined"==typeof jQuery&&window.jQuery?jQuery=window.jQuery:"undefined"==typeof jQuery||window.jQuery||(window.jQuery=jQuery):document.write("<script type='text/javascript' src='"+jsFolderPath+"/jquery.min.js'><\/script>"),document.write("<script type='text/javascript' src='"+jsFolderPath+"/jquery.caret.js'><\/script>"),document.write("<link href='"+cssFolderPath+"/CDAC-Typing-Script-Style.min.css' rel='stylesheet' type='text/css' />"),document.write("<script type='text/javascript' src='"+jsFolderPath+"/KeyboardScript.min.js'><\/script>"),jQuery.noConflict()),typingLayout="transliteration",suggestionsPerPage=5,totalTopPos=27,totalLeftPos=2,totalRightPos=3,element_Id="",content_Id="",popbox_Id="",suggestion_Id="",container_Id="",pagingdiv_Id="",imageDiv_Id="",currentElementId="",targetID="",behavior="",storePreviousID="",originalText="",beforeText="",afterText="",storeResult="",engContainSpace=!0,selectionFlag=0,multiTypingEnabled=!1,caretPos=0,tempLength=0,arrSugg=new Array,browserName="",suggestions="",selectedText="",selectedTextStart=-1,selectedTextEnd=-1,totalSuggestionsCount=0,totalPageCount=0,currentSelectedIndex=0,currentPosition=0,suggestionsToShow=0,currentPageCounter=1,firstLimit=0,lastLimit=0,previousFont="",uniqueSymbols=["#~1#","#~2#","#~3#","#~4#","#~5#","#~6#","#~7#","#~8#","#~9#","#~10#","#~11#","#~12#"],serverCounter=-1,enableOnBlurTransliteration=!0,addressIDs=new Array,nameIDs=new Array,sourceAddressIDs=new Array,targetAddressIDs=new Array,sourceNameIDs=new Array,targetNameIDs=new Array,revFlag=!1,hashtableHI_IN=new Hashtable,hashtableGJ_IN=new Hashtable,hashtableMR_IN=new Hashtable,hashtablePN_IN=new Hashtable,hashtableML_IN=new Hashtable,hashtableBN_IN=new Hashtable,hashtableTM_IN=new Hashtable,hashtableTL_IN=new Hashtable,hashtableKN_IN=new Hashtable,hashtableOR_IN=new Hashtable,hashtableUR_IN=new Hashtable,hashtableEN_IN=new Hashtable,hashTableName=hashtableHI_IN,hashTableForDblClick=new Hashtable,hashTableAddress=new Hashtable,supportedLangCode1=new Array("hin","mar","guj","ben","pan","mal","tam","tel","kan","ori","urd","asm","kok","mni","eng"),supportedLangCode2=new Array("hi_in","mr_in","gj_in","bn_in","pn_in","ml_in","tm_in","tl_in","kn_in","or_in","ur_in","as_in","ko_in","mn_in","en_in"),supportedLangCode3=new Array("hindi","marathi","gujarati","bengali","punjabi","malayalam","tamil","telugu","kannada","oriya","urdu","assamese","konkani","manipuri","english");function enableTyping(e,t,n,r,a,s){try{revTrans=a,void 0!==s&&(enableOnBlurTransliteration=s),glocale!=r&&(setLanguage(r),setHashTableName()),null===t||null==typeof t?typingOnSameTextbox(e,n,glocale):(null!=e||0<e.length||null!=typeof e&&null!=t||0<t.length||null!=typeof t)&&typingOnMultiTextbox(e,t,n,glocale),browserName=getBrowserName()}catch(e){}}function setTypingLayout(e){try{0<$.trim(e).length&&(typingLayout=$.trim(e),g_EnableTypingOnlyOnKBDOpen="inscript"==typingLayout.toLowerCase()?0:1),browserName=getBrowserName()}catch(e){}}function setLanguage(e){try{var t=checkLanguageSupport(e=e.toLowerCase());-1!=t?e=supportedLangCode2[t]:"en_in"==e&&(e="eng"),e!=glocale&&(glocale=e,hashTableName.clear(),hashTableAddress.clear()),languageName=-1!=t?supportedLangCode3[t]:"eng"==e?"english":glocale,totalTopPos="pn_in"==glocale?43:"ml_in"==glocale?35:27,"english"==languageName?closeKeyboard():changeKeyboardLanguage(languageName)}catch(e){}}function provideTransliteration(e,t){try{if(!enableOnBlurTransliteration&&"eng"!=glocale&&-1<checkLanguageSupport(glocale)){$("#"+e).focus();var n=!1;if(void 0!==t&&n!=t&&(n=t),"transliteration"==typingLayout&&(-1<jQuery.inArray(e,sourceNameIDs)||-1<jQuery.inArray(e,sourceAddressIDs)||n)&&multiTypingEnabled){var r,a="#"+(currentElementId=e);if("name"===behavior){if(sourceNameIDs.length!=targetNameIDs.length)return void alert("Error in defining the Source ID or its Target ID for Name Translations");if(-1<(r=jQuery.inArray(currentElementId,sourceNameIDs)))targetID=targetNameIDs[r];else{if(!n)return;-1<(r=jQuery.inArray(currentElementId,targetNameIDs))&&(targetID=sourceNameIDs[r])}}else if("address"===behavior){if(sourceAddressIDs.length!=targetAddressIDs.length)return void alert("Error in defining the Source ID or its Target ID for Address Translations");if(-1<(r=jQuery.inArray(currentElementId,sourceAddressIDs)))targetID=targetAddressIDs[r];else{if(!n)return;-1<(r=jQuery.inArray(currentElementId,targetAddressIDs))&&(targetID=sourceAddressIDs[r])}}var s=$.trim($(a).val());$("#"+targetID).text="",$("#"+targetID).val(""),0<s.length&&(resetValues(),iSuggest(a,"#"+targetID,s,n))}}else resetValues(),removePreviousContainers()}catch(e){}}function nextPage(){try{if(suggestionsPerPage<totalSuggestionsCount&&currentPageCounter<totalPageCount){$(suggestion_Id).html(""),currentPosition++,currentPageCounter++,$("#prev").removeAttr("disabled");var e=suggestionsPerPage,t=(totalSuggestionsCount<currentPosition+suggestionsPerPage&&(e=totalSuggestionsCount-currentPosition),suggestionsToShow=0);for(firstLimit=currentPosition;t<e;)appendSuggestion(arrSugg[currentPosition]),currentPosition++,suggestionsToShow++,t++;lastLimit=--currentPosition,selectSuggestion(firstLimit),currentSelectedIndex=firstLimit,currentPosition==totalSuggestionsCount-1&&$("#next").attr("disabled","disabled")}}catch(e){}}function prevPage(){try{if(suggestionsPerPage<totalSuggestionsCount&&1<currentPageCounter){$(suggestion_Id).html(""),1<currentPageCounter&&currentPageCounter--,$("#next").removeAttr("disabled");for(var e=suggestionsPerPage,t=(1<currentPageCounter?currentPosition=currentPosition-suggestionsToShow-suggestionsPerPage+1:1==currentPageCounter&&(currentPosition=0),firstLimit=currentPosition,suggestionsToShow=0);t<e;)appendSuggestion(arrSugg[currentPosition]),currentPosition++,suggestionsToShow++,t++;lastLimit=--currentPosition,selectSuggestion(firstLimit),currentSelectedIndex=firstLimit,currentPosition-suggestionsPerPage<=0&&$("#prev").attr("disabled","disabled")}}catch(e){}}function typingOnSameTextbox(e,t){try{"ADDRESS"==t?addressIDs=e:"NAME"==t&&(nameIDs=e),storePreviousID=""}catch(e){}}function typingOnMultiTextbox(e,t,n){try{"ADDRESS"==n?(sourceAddressIDs=e,targetAddressIDs=t):"NAME"==n&&(sourceNameIDs=e,targetNameIDs=t),storePreviousID=""}catch(e){}}function checkLanguageSupport(e){var t=-1;try{var n=jQuery.inArray(e,supportedLangCode1);-1==n&&-1==(n=jQuery.inArray(e,supportedLangCode2))&&-1!=(n=jQuery.inArray(e,supportedLangCode3))||(t=n)}catch(e){}return t}function formatSuggestion(e){e=e.replace(/-/gi,"-#~1#-").replace(/\{/gi,"{#~2#{").replace(/\}/gi,"}#~3#}").replace(/\(/gi,"(#~4#(").replace(/\)/gi,")#~5#)").replace(/\[/gi,"[#~6#[").replace(/\]/gi,"]#~7#]").replace(/_/gi,"_#~8#_").replace(/\&/gi,"&#~9#&").replace(/,/gi,",#~10#,").replace(/\"/gi,'"#~11#"').replace(/'/gi,"#~12#");var t="";try{for(var n=e.split(/[\s\{\}\(\)\[\]\-_\&,'"]/gi),r=0;r<n.length;r++){var a=n[r],s=(-1==jQuery.inArray(a,uniqueSymbols)&&(a+=" "),n[r].split(";$;"));1<s.length&&(a=s[0]+" ",hashTableAddress.put(s[0],s)),t+=a}return t=(t=t.replace(/#~1#/gi,"-").replace(/#~2#/gi,"{").replace(/#~3#/gi,"}").replace(/#~4#/gi,"(").replace(/#~5#/gi,")").replace(/#~6#/gi,"[").replace(/#~7#/gi,"]").replace(/#~8#/gi,"_").replace(/#~9#/gi,"&").replace(/#~10#/gi,",").replace(/#~11#/gi,'"').replace(/#~12#/gi,"'")).replace(/\s-/gi,"-").replace(/\s\{/gi,"{").replace(/\s\}/gi,"}").replace(/\(/gi,"(").replace(/\s\)/gi,")").replace(/\s\[/gi,"[").replace(/\s\]/gi,"]").replace(/\s_/gi,"_").replace(/\s\&/gi,"&").replace(/\s,/gi,",").replace(/\s"/gi,'"').replace(/\s'/gi,"'")}catch(e){}return t}function removePreviousContainers(){try{var e=$(".element").contents();$(".element").replaceWith(e),resetValues()}catch(e){}}function executeAfterClickOnTextBox(e){try{$(popbox_Id).remove(),element_Id="#"+e,popbox_Id="#popupBox_"+e,content_Id="#PopUpInputBox_"+e,suggestion_Id="#Suggestions_"+e,container_Id="#democontainer_"+e,pagingdiv_Id="#page_"+e,imageDiv_Id="#cdacImage_"+e;var t,n,r,a,s,i="page_"+e;null==document.getElementById("popupBox_"+e)&&(t=$("<div class='Gist_Typing_Popup_MainBX' id='popupBox_"+e+"'></div>"),n=$("<div id='PopUpInputBox_"+e+"' class='Gist_Typing_Popup_PopupTypingBox'></div>"),r=$("<div id='Suggestions_"+e+"' class='Gist_Typing_Popup_SuggestnBox'></div>"),a=$("<div id='"+i+"' class='Gist_Typing_Popup_PagingDiv'><input type='button' value='<' id='prev' class='Gist_Typing_Popup_PagingBtn' style='float:left;' onclick='prevPage()'/><input type='button' value='>' id='next' class='Gist_Typing_Popup_PagingBtn' style='float:right;' onclick='nextPage()'/></div>"),s=$("<div id='imageDiv_Id' class='Gist_Typing_Popup_CdacImgDiv'><img src='"+imageFolderPath+"/CDAC-GIST.bmp' alt='CDAC Gist' class='Gist_Typing_Popup_CdacImg'/></div>"),$(t).append(n),$(t).append(r),$(t).append(a),$(t).append(s),$(container_Id).append($(t))),resetValues(),$(element_Id).attr("autocomplete","off")}catch(e){}}function setFont(e){previousFont=$(e).css("font-family"),$(e).css("font-family","gist_"+languageName+"_font")}function checkIDS(e){try{var t="";if(multiTypingEnabled){if(null!=sourceNameIDs.length)if(-1<jQuery.inArray(e,sourceNameIDs))return t="NAME";if(null!=sourceAddressIDs.length)if(-1<jQuery.inArray(e,sourceAddressIDs))return t="ADDRESS";if(null!=targetNameIDs.length)if(-1<jQuery.inArray(e,targetNameIDs))return t="NAME";if(null!=targetAddressIDs.length)if(-1<jQuery.inArray(e,targetAddressIDs))return t="ADDRESS"}else{if(null!=nameIDs.length)if(-1<jQuery.inArray(e,nameIDs))return t="NAME";if(null!=addressIDs.length)if(-1<jQuery.inArray(e,addressIDs))return t="ADDRESS"}return t}catch(e){}}function setPopupBox(){try{currentSelectedIndex=0,gettypingCaretPositionForPopup();var e=$(element_Id).caret("offset"),t=e.left+totalLeftPos,n=e.top+totalTopPos,r=e.left+totalRightPos;"ur_in"===glocale?($(".Gist_Typing_Popup_MainBX").css("right",r+"px"),$(".Gist_Typing_Popup_MainBX").css("top",n+"px"),$(".Gist_Typing_Popup_MainBX").css("z-index","100"),$(".Gist_Typing_Popup_MainBX").css("left","unset")):($(".Gist_Typing_Popup_MainBX").css("left",t+"px"),$(".Gist_Typing_Popup_MainBX").css("top",n+"px"),$(".Gist_Typing_Popup_MainBX").css("z-index","100"),$(".Gist_Typing_Popup_MainBX").css("right","unset"))}catch(e){}}function typingCaretPosition(e){try{var t=getLanguageDirection(glocale),n=(e.setAttribute("dir",t),e.value.length);if(e.createTextRange&&!isBrowserAboveIE9()){if("TEXTAREA"!=e.tagName){for(s=document.selection.createRange().duplicate();s.parentElement()==e&&1==s.move("character",1);)--n;return n==e.value.length+1?-1:n}if(null!=document.selection){if("Text"==document.selection.type){var r=document.selection.createRange(),a=caretPosExtFun(e);if(null!=a)return l=caretPos+r.text.length,selectedTextEnd=l,selectedTextStart=a;for(var s=document.selection.createRange().duplicate();s.parentElement()==e&&1==s.move("character",1);)--n;return selectedTextStart=n+1,selectedTextEnd=n+r.text.length,n+1}var i,o=(i=document.selection.createRange()).text;if(""==o){var l,u="#%~",c=(i.text=o+u,i.moveStart("character",0-o.length-u.length),e.value);for(i.text=o,n=0;n<=c.length;n++)if(c.substring(n,n+u.length)==u)return l=n-o.length}}}else if(e.selectionStart||"0"==e.selectionStart)return e.selectionStart}catch(e){}}function gettypingCaretPositionForPopup(){try{var e=(originalText=$(element_Id).val()||$(element_Id).text()).length,t=element_Id.substring(1,element_Id.length);caretPos=typingCaretPosition(document.getElementById(t)),beforeText=originalText.substring(0,caretPos),afterText=originalText.substring(caretPos,e)}catch(e){}}function resetSpan(){try{$("#widthcalc").html(""),$("#widthcalc").remove()}catch(e){}}function setSuggestionToTextbox(){try{var e;""!=$(suggestion_Id).text()&&(e="#"+arrSugg[currentSelectedIndex],putWord($(e).text()),resetValues()),resetSpan()}catch(e){}}function putWord(e){try{var t,n,r;""!=e&&(n="",selectedTextStart!=selectedTextEnd&&0!=selectionFlag?(t=$(element_Id).val(),n=engContainSpace?t.slice(0,selectedTextStart)+e+" "+t.slice(selectedTextEnd):t.slice(0,selectedTextStart)+e+t.slice(selectedTextEnd),selectedTextEnd=selectedTextStart=-1,caretPos+=e.length):(0==beforeText.length&&0==afterText.length?n=e+" ":0==afterText.length&&0!=beforeText.length?n=beforeText.lastIndexOf(" ")<=beforeText.length-1?beforeText+e+" ":beforeText+" "+e+" ":0!=afterText.length&&0==beforeText.length?n=0==afterText.indexOf(" ")?e+afterText:e+" "+afterText:0!=afterText.length&&0!=beforeText.length&&(n=beforeText.lastIndexOf(" ")<=beforeText.length-1?beforeText+e:beforeText+" "+e,0==afterText.indexOf(" ")?n+=afterText:n+=" "+afterText),caretPos=caretPos+e.length+1),$(element_Id).val(n),"name"===behavior?changeSuggestionSequence(e):"address"===behavior&&"undefined"!=(r=hashTableAddress.get($.trim(selectedText)))&&null!=r&&(hashTableAddress.remove($.trim(selectedText)),hashTableAddress.put($.trim(e),r)),setCursorToPosition(caretPos)),selectionFlag=0}catch(e){}}function changeSuggestionSequence(e){try{e=$.trim(e);var t,n,r,a=$.trim($(content_Id).html());a!=e&&(r=(n=e+"^"+(t="^"===(t=hashTableName.get(a))[t.length-1]?t:t+"^").replace(e+"^","")).split("^").length-1,t==n&&1!=r||(hashTableName.remove(a),hashTableName.put(a,n))),hashTableForDblClick.put(e,a)}catch(e){}}function putSingleChar(e){try{var t;gettypingCaretPositionForPopup(),""!=e&&(t=beforeText+e+afterText,$(element_Id).val(t),setCursorToPosition(caretPos=caretPos+e.length+1))}catch(e){}}function setCursorToPosition(e){try{var t;$(element_Id).get(0).setSelectionRange?$(element_Id).get(0).setSelectionRange(e,e):$(element_Id).get(0).createTextRange&&((t=$(element_Id).get(0).createTextRange()).collapse(!0),t.moveEnd("character",e),t.moveStart("character",e),t.select())}catch(e){}}function selectSuggestion(e){try{var t="#"+arrSugg[e];$(t).attr("class","Gist_Typing_Popup_SelectedText")}catch(e){}}function unSelectSuggestion(e){try{var t="#"+arrSugg[e];$(t).attr("class","Gist_Typing_Popup_UnSelectedText")}catch(e){}}function getBrowserName(){try{var e="",t=navigator.userAgent.toLowerCase();return-1!=t.indexOf("opera")?e="opera":-1!=t.indexOf("msie")?e="msie":-1!=t.indexOf("safari")?e="safari":-1!=t.indexOf("mozilla")&&(e=-1!=t.indexOf("firefox")?"firefox":"mozilla"),e}catch(e){}}function isBrowserAboveIE9(){try{navigator.appVersion;return parseInt(navigator.appVersion)<=4?!1:!0}catch(e){}}function getSuggestionsForSelectedText(e){try{var t,n,r,a,s,i,o,l,u,c=document.getElementById(e);document.selection?(t=document.selection.createRange().getBookmark(),r=(n=c.createTextRange()).duplicate(),n.moveToBookmark(t),r.setEndPoint("EndToStart",n),selectedTextStart=r.text.length,selectedTextEnd=selectedTextStart+n.text.length,selectedText=n.text):null!=c.selectionStart&&(a=c.selectionStart,selectedTextStart=a,s=c.selectionEnd,selectedTextEnd=s,selectedText=c.value.substring(a,s)),null==$.trim(selectedText)||null==$.trim(selectedText)||""==$.trim(selectedText)?resetValues():(i=selectedText.split(" "),engContainSpace=1<i.length,"name"==behavior?null!=(o=hashTableForDblClick.get($.trim(selectedText)))&&""!=o&&(setPopupBox(),resetValues(),l=hashTableName.get($.trim(o)),0<$.trim(l).length?showSuggestions(l):iSuggest("#"+e,null,$.trim(o),!1),$(content_Id).html(o)):"address"==behavior&&(null!=(u=hashTableAddress.get($.trim(selectedText)))&&""!=u&&0<$.trim(u).length?(setPopupBox(),resetValues(),showSuggestions(u)):iSuggest("#"+e,null,$.trim(selectedText),!0)))}catch(e){}}function iSuggest(t,n,e,r=!1){try{if(r="number"!=typeof r&&r,0<$.trim(e).length){var a,s=$.trim(e),i=(e=encodeURIComponent(e),""),o="",l=0;if("name"===behavior)if(i=Service_Url+"Transliteration.aspx?itext="+e+"&transliteration=NAME&locale="+glocale+"&transRev="+r,o=hashTableName.get(s),multiTypingEnabled||0!=$.trim(n).length||0==$.trim(t).length){if(multiTypingEnabled&&0!=$.trim(t).length&&0!=$.trim(n).length){if(0!=$.trim(o).length)return void setResultInTarget(n,s,o);l=3}}else{if(0!=$.trim(o).length)return void showSuggestions(o);l=1}else if("address"===behavior)if(i=Service_Url+"Transliteration.aspx?itext="+e+"&transliteration=ADDRESS&locale="+glocale+"&transRev="+r,o=hashTableAddress.get(s),multiTypingEnabled||0!=$.trim(n).length||0==$.trim(t).length){if(multiTypingEnabled&&0!=$.trim(t).length&&0!=$.trim(n).length){if(0!=$.trim(o).length)return $(n).val(o),a=new Event("change"),void document.querySelector(n).dispatchEvent(a);l=4}}else{if(0!=$.trim(o).length)return void $(t).val(o);l=2}try{if(-1!=navigator.appVersion.indexOf("MSIE 7.")||-1!=navigator.appVersion.indexOf("MSIE 8.")||-1!=navigator.appVersion.indexOf("MSIE 9.")||-1!=navigator.appVersion.indexOf("MSIE 10.")||navigator.userAgent.match(/Trident\/7\./)){var u=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP");if(u)try{u.onreadystatechange=function(){4==u.readyState&&200==u.status&&(storeResult=formatSuggestion(decodeURIComponent(u.responseText)),processSuggestions(t,n,s,l))},u.open("GET",i,!0),u.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=UTF-8"),u.send()}catch(e){XDomainRequest&&((u=new XDomainRequest).onload=function(){storeResult=decodeURIComponent(formatSuggestion(u.responseText)),processSuggestions(t,n,s,l)},u.open("GET",i),u.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=UTF-8"),u.send())}else alert("Cannot create an XMLHTTP instance")}else"en_in"===glocale?(storeResult=decodeURIComponent(e),processSuggestions(t,n,s,l)):(storeResult="",$.ajax({type:"GET",url:i,contentType:"application/x-www-form-urlencoded;charset=UTF-8",dataType:"text",async:!0,success:function(e){storeResult=formatSuggestion(decodeURIComponent(JSON.parse(`"${e}"`)))},complete:function(){processSuggestions(t,n,s,l)}}))}catch(e){}}}catch(e){}}function processSuggestions(e,t,n,r){try{var a;storeResult=$.trim(storeResult),n=$.trim(n),"Empty Value."===$.trim(storeResult)||""===$.trim(storeResult)?serverCounter<Service_Url_Arr.length?Service_Url_Arr[++serverCounter]?(Service_Url=Service_Url_Arr[serverCounter],iSuggest(e,t,n,r)):serverCounter=-1:resetValues():1==r?(hashTableName.put(n,storeResult),showSuggestions(storeResult)):2==r?$(e).val(storeResult):3==r?setResultInTarget(t,n,storeResult):4==r?($(t).val(storeResult),a=new Event("change"),document.querySelector(t).dispatchEvent(a)):5==r&&(hashTableAddress.put(n,storeResult),showSuggestions(storeResult))}catch(e){}}function setResultInTarget(e,t,n){try{var r,a="",s="",i=(n.length-1==n.lastIndexOf(";")&&0,t.split(" ")),o=(n=n.replace(/;$/,"")+"^").split(" ");if(1<i.length)for(var l,u=0;u<i.length;u++)hashTableName.containsKey(i[u])&&o[u]!=(l=hashTableName.get(i[u]))&&(o[u]=l);if(1<i.length&&1<o.length&&i.length==o.length)for(var c=0;c<i.length;c++){var g=$.trim(i[c]);a+=(d=-1<(s=$.trim(o[c])).indexOf("^")?s.substring(0,s.indexOf("^")):s)+" ",hashTableName.containsKey(g)||hashTableName.put(g,s),hashTableForDblClick.put(d,g)}else{var d,h=(s=n).indexOf("^");a+=(d=-1===h?s:s.substring(0,h))+" ",hashTableName.containsKey(t)||hashTableName.put(t,s),hashTableForDblClick.put(d,t)}a&&($(e).val(""),r=new Event("change"),$(e).val($.trim(a)),document.querySelector(e).dispatchEvent(r)),document.getElementById(targetID).select()}catch(e){}}function showSuggestions(e){try{if(totalSuggestionsCount=0,e){$(suggestion_Id).html(""),1<e.split(";").length?(t=e.split(";"),(arrSugg=t[0].split("^")).push(t[1])):arrSugg=e.split("^"),arrSugg=$.grep(arrSugg,function(e){return""!=e}),totalSuggestionsCount=arrSugg.length,1==(totalPageCount=Math.ceil(totalSuggestionsCount/suggestionsPerPage))?($("#prev").css("cursor","default"),$("#next").css("cursor","default"),$("#next").attr("disabled","disabled"),$("#prev").attr("disabled","disabled")):($("#prev").css("cursor","pointer"),$("#next").css("cursor","pointer"),$("#prev").attr("disabled","disabled"),$("#next").removeAttr("disabled")),currentPageCounter=1;var t,n=currentPosition=0;for(firstLimit=0;n<totalSuggestionsCount&&(appendSuggestion(arrSugg[currentPosition]),currentPosition++,suggestionsToShow++,++n!=suggestionsPerPage););lastLimit=--currentPosition,currentSelectedIndex=firstLimit,selectSuggestion(0),$(suggestion_Id).show(),$(content_Id).show(),$(imageDiv_Id).show(),$(popbox_Id).show(),1==totalPageCount?$(pagingdiv_Id).hide():$(pagingdiv_Id).show()}}catch(e){}}function appendSuggestion(e){try{var t=$("<div id='"+e+"' class='Gist_Typing_Popup_UnSelectedText'></div>");$(t).html("<p style='color:black;margin:0em;' class='optional-suggestion'>"+e+"</p>"),$(t).css("margin","2px 0px 2px 0px"),$(t).css("font-family","gist_"+languageName+"_font"),$(suggestion_Id).append(t)}catch(e){}}function funClick(e){try{$(element_Id).focus(),putWord(e),resetValues()}catch(e){}}function resetValues(){try{$(suggestion_Id).html(""),$(suggestion_Id).hide(),$(content_Id).text(""),$(content_Id).hide(),$(pagingdiv_Id).hide(),$(imageDiv_Id).hide(),$(popbox_Id).hide(),storeResult=suggestions=null,serverCounter=-1}catch(e){}}function caretPosExtFun(e){try{var t=e.value.length;if(e.createTextRange&&!isBrowserAboveIE9()){if("TEXTAREA"!=e.tagName){for(var n=document.selection.createRange().duplicate();n.parentElement()==e&&1==n.move("character",1);)--t;return t==e.value.length+1?-1:t}var r=document.selection.createRange(),a=r.text;if(""==a){var s="#%~",i=(r.text=a+s,r.moveStart("character",0-a.length-s.length),e.value);for(r.text=a,t=0;t<=i.length;t++)if(i.substring(t,t+s.length)==s)return t-a.length}}else if(e.selectionStart||"0"==e.selectionStart)return e.selectionStart}catch(e){}}function setHashTableName(){try{"hi_in"==glocale?hashTableName=hashtableHI_IN:"gj_in"==glocale?hashTableName=hashtableGJ_IN:"mr_in"==glocale?hashTableName=hashtableMR_IN:"pn_in"==glocale?hashTableName=hashtablePN_IN:"ml_in"==glocale?hashTableName=hashtableML_IN:"bn_in"==glocale?hashTableName=hashtableBN_IN:"tm_in"==glocale?hashTableName=hashtableTM_IN:"tl_in"==glocale?hashTableName=hashtableTL_IN:"kn_in"==glocale?hashTableName=hashtableKN_IN:"or_in"==glocale?hashTableName=hashtableOR_IN:"ur_in"==glocale?hashTableName=hashtableUR_IN:"en_in"==glocale&&(hashTableName=hashtableEN_IN)}catch(e){}}function Hashtable(){this.clear=hashtable_clear,this.containsKey=hashtable_containsKey,this.containsValue=hashtable_containsValue,this.get=hashtable_get,this.isEmpty=hashtable_isEmpty,this.keys=hashtable_keys,this.put=hashtable_put,this.remove=hashtable_remove,this.size=hashtable_size,this.toString=hashtable_toString,this.values=hashtable_values,this.hashtable=new Array}function hashtable_clear(){this.hashtable=new Array}function hashtable_containsKey(e){var t,n=!1;for(t in this.hashtable)if(t==e&&null!=this.hashtable[t]){n=!0;break}return n}function hashtable_containsValue(e){var t=!1;if(null!=e)for(var n in this.hashtable)if(this.hashtable[n]==e){t=!0;break}return t}function hashtable_get(e){return this.hashtable[e]}function hashtable_isEmpty(){return 0==parseInt(this.size())}function hashtable_keys(){var e,t=new Array;for(e in this.hashtable)null!=this.hashtable[e]&&t.push(e);return t}function hashtable_put(e,t){this.hashtable[e]=t}function hashtable_size(){var e,t=0;for(e in this.hashtable)null!=this.hashtable[e]&&t++;return t}function hashtable_toString(){var e,t="";for(e in this.hashtable)null!=this.hashtable[e]&&(t+="{"+e+"},{"+this.hashtable[e]+"}\n");return t}function hashtable_values(){var e,t=new Array;for(e in this.hashtable)null!=this.hashtable[e]&&t.push(this.hashtable[e]);return t}function hashtable_remove(e){var t=this.hashtable[e];return this.hashtable[e]=null,t}function getLanguageDirection(e){switch(e){case"ur_in":case"ks_in":case"sd_in":return"rtl";default:return"ltr"}}$(document).ready(function(){var r="";$("input[type='text'], textarea").focus(function(e){try{-1<checkLanguageSupport(glocale)?(currentElementId=this.id,-1<jQuery.inArray(currentElementId,nameIDs)||-1<jQuery.inArray(currentElementId,addressIDs)?multiTypingEnabled=!1:(-1<jQuery.inArray(currentElementId,sourceNameIDs)||-1<jQuery.inArray(currentElementId,sourceAddressIDs)||-1<jQuery.inArray(currentElementId,targetNameIDs)||-1<jQuery.inArray(currentElementId,targetAddressIDs))&&(multiTypingEnabled=!0),behavior=checkIDS(currentElementId).toLowerCase(),storePreviousID!=currentElementId?(removePreviousContainers(),-1==jQuery.inArray(currentElementId,sourceNameIDs)&&-1==jQuery.inArray(currentElementId,sourceAddressIDs)&&""!=behavior?(-1!=navigator.appVersion.indexOf("MSIE 8.")||"Microsoft Internet Explorer"==navigator.appName&&-1==navigator.appVersion.indexOf("Trident/7.0")&&-1==navigator.appVersion.indexOf("MSIE 10")&&-1==navigator.appVersion.indexOf("MSIE 9")&&-1==navigator.appVersion.indexOf("Chrome")?$("body").wrap("<span id='democontainer_"+currentElementId+"' class='element'></span>"):$("body").prepend("<elem id='democontainer_"+currentElementId+"' class='element'></elem>"),executeAfterClickOnTextBox(currentElementId),storePreviousID=currentElementId,setFont(element_Id)):storePreviousID=currentElementId,$(e.target).focus()):setFont(element_Id)):(resetValues(),removePreviousContainers())}catch(e){}}),$("input[type='text'], textarea").blur(function(e){try{if(-1<checkLanguageSupport(glocale)){if("transliteration"==typingLayout&&(-1<jQuery.inArray(this.id,nameIDs)||-1<jQuery.inArray(this.id,addressIDs)||-1<jQuery.inArray(this.id,sourceNameIDs)||-1<jQuery.inArray(this.id,sourceAddressIDs)))if(multiTypingEnabled||"address"!==behavior){if(enableOnBlurTransliteration&&multiTypingEnabled){var t,n="#"+(currentElementId=this.id);if("name"===behavior){if(sourceNameIDs.length!=targetNameIDs.length)return void alert("Error in defining the Source ID or its Target ID for Name Translations");if(!(-1<(t=jQuery.inArray(currentElementId,sourceNameIDs))))return;targetID=targetNameIDs[t]}else if("address"===behavior){if(sourceAddressIDs.length!=targetAddressIDs.length)return void alert("Error in defining the Source ID or its Target ID for Address Translations");if(!(-1<(t=jQuery.inArray(currentElementId,sourceAddressIDs))))return;targetID=targetAddressIDs[t]}var r=$.trim($(n).val());$("#"+targetID).text="",$("#"+targetID).val(""),0<r.length&&(resetValues(),iSuggest(n,"#"+targetID,r,revTrans))}}else-1<jQuery.inArray(currentElementId,addressIDs)&&iSuggest(n="#"+currentElementId,null,$.trim($("#"+currentElementId).val()),revTrans)}else resetValues(),removePreviousContainers()}catch(e){}}),$("input[type='text'], textarea").select(function(e){try{"eng"!=glocale&&-1<checkLanguageSupport(glocale)?(currentElementId=e.target.id,behavior=checkIDS(currentElementId).toLowerCase(),$(popbox_Id).is(":visible")&&resetValues(),multiTypingEnabled&&(-1<jQuery.inArray(currentElementId,sourceNameIDs)||-1<jQuery.inArray(currentElementId,sourceAddressIDs))?resetValues():(-1<jQuery.inArray(currentElementId,nameIDs)||-1<jQuery.inArray(currentElementId,targetNameIDs))&&"name"===behavior&&!$(popbox_Id).is(":visible")?(selectionFlag=1,getSuggestionsForSelectedText($(this).attr("id"))):(selectionFlag=0,resetValues())):(resetValues(),removePreviousContainers())}catch(e){}}),$(document).on("mousedown","*",function(e){try{"eng"!=glocale&&-1<checkLanguageSupport(glocale)?($(popbox_Id).is(":visible")&&0==$(e.target).hasClass("Gist_Typing_Popup_PagingBtn")&&0==$(e.target).hasClass("optional-suggestion")&&(putWord(""),resetValues()),1==g_EnableTypingOnlyOnKBDOpen&&isKBDOpen&&multiTypingEnabled&&(-1<jQuery.inArray(e.target.id,sourceNameIDs)||-1<jQuery.inArray(e.target.id,sourceAddressIDs))&&closeKeyboard()):(resetValues(),removePreviousContainers())}catch(e){}}),$(document).on("click",".Gist_Typing_Popup_PopupTypingBox",function(){try{"eng"!=glocale&&-1<checkLanguageSupport(glocale)?(resetValues(),$(element_Id).focus(),setCursorToPosition(caretPos)):(resetValues(),removePreviousContainers())}catch(e){}}),$(document).off("click",".optional-suggestion"),$(document).on("click",".optional-suggestion",function(e){"eng"!=glocale&&-1<checkLanguageSupport(glocale)?funClick($(this).text()):(resetValues(),removePreviousContainers())}),$(document).on("keydown",element_Id,function(e){try{if("eng"!=glocale&&-1<checkLanguageSupport(glocale)){if(e.ctrlKey){if(e.ctrlKey)return 89==e.keyCode&&(null==document.getElementById("keyBrd")&&$("body").append('<div id="keyBrd"> </div>'),openKeyboard(languageName),hashtable_clear(),$(element_Id).focus()),void resetValues()}else{if("transliteration"==typingLayout&&!isKBDOpen&&!multiTypingEnabled&&"name"===behavior&&(suggestions="",64<e.keyCode)&&e.keyCode<91){if(e.preventDefault(),r=String.fromCharCode(e.keyCode),e.shiftKey?r=r.toUpperCase():e.shiftKey||(r=r.toLowerCase()),!($(content_Id).text().length<maxTypingLength))return;$(content_Id).html($(content_Id).html()+r),tempLength=(void 0===$(content_Id).html()?$(content_Id).text():$(content_Id).html()).length}"inscript"==typingLayout&&resetValues()}var t,n;$(popbox_Id).is(":visible")&&(""==$(content_Id).text()&&8==e.keyCode?(e.preventDefault(),resetValues()):32!=e.keyCode&&13!=e.keyCode||""==$(suggestion_Id).html()?8==e.keyCode?multiTypingEnabled?resetValues():(e.preventDefault(),t=(n=$(content_Id).html()).length,n=n.substr(0,t-1),$(content_Id).html(n)):27==e.keyCode?resetValues():37==e.keyCode?(e.preventDefault(),prevPage()):39==e.keyCode?(e.preventDefault(),nextPage()):38==e.keyCode?(e.preventDefault(),unSelectSuggestion(currentSelectedIndex),firstLimit<currentSelectedIndex&&currentSelectedIndex--,selectSuggestion(currentSelectedIndex)):40==e.keyCode?(e.preventDefault(),unSelectSuggestion(currentSelectedIndex),currentSelectedIndex<lastLimit&&currentSelectedIndex++,selectSuggestion(currentSelectedIndex)):46==e.keyCode?resetValues():(47<e.keyCode&&e.keyCode<58||185<e.keyCode&&e.keyCode<193||218<e.keyCode&&e.keyCode<223||109<=e.keyCode&&e.keyCode<=111&&(106==e.keyCode||107==e.keyCode))&&16!=e.keyCode&&(setSuggestionToTextbox(),resetValues()):(e.preventDefault(),setSuggestionToTextbox()))}else resetValues(),removePreviousContainers()}catch(e){}}),$(document).on("keyup",element_Id,function(e){try{if("eng"!=glocale&&-1<checkLanguageSupport(glocale)){if(!e.ctrlKey&&!isKBDOpen&&"transliteration"==typingLayout&&!multiTypingEnabled&&"name"==behavior)if(64<e.keyCode&&e.keyCode<91)$(suggestion_Id).html(""),setPopupBox(),iSuggest(content_Id,null,$.trim($(content_Id).text()),!1),tempLength<maxTypingLength&&(tempLength=0);else if($(popbox_Id).is(":visible")){if(8==e.keyCode){if(""==$(content_Id).text())return void resetValues();setPopupBox(),$(suggestion_Id).html(""),iSuggest(content_Id,null,$.trim($(content_Id).text()),!1)}var t;(47<e.keyCode&&e.keyCode<58||185<e.keyCode&&e.keyCode<193||218<e.keyCode&&e.keyCode<223||109<=e.keyCode&&e.keyCode<=111&&(106==e.keyCode||107==e.keyCode))&&16==e.keyCode&&(t=String.fromCharCode(e.keyCode),e.preventDefault(),putSingleChar(t))}}else resetValues(),removePreviousContainers()}catch(e){}}),$(document).on("mouseenter",".Gist_Typing_Popup_SuggestnBox",function(){unSelectSuggestion(currentSelectedIndex)}).on("mouseleave",".Gist_Typing_Popup_SuggestnBox",function(){selectSuggestion(currentSelectedIndex)})}),window.onresize&&(window.onresize=function(){resetValues()});
