
var tp_FONTLIST=[["Jomolhari",160,160,-15,80,false,false,"PC",false],["Microsoft Himalaya",195,140,10,60,false,true,"PC",false],["TCRC Youtso Unicode",160,160,-15,30,false,true,"PC",true],["Tibetan Machine Uni",160,160,-15,50,false,false,"PC",false],["Tib-US Unicode",222,107,-15,85,false,true,"PC",true],["Uchen_05",280,100,-25,70,false,true,"PC",false],["Wangdi29",360,75,-40,10,false,true,"PC",false],["XTashi",220,100,-20,40,false,true,"PC",false],["Kailasa",152,150,-7,120,false,false,"Mac",false],["Kokonor",155,160,-15,110,false,false,"Mac",false],["XenoType Tibetan New",171,144,-19,90,false,false,"Mac",false],["XenoType TB dBuMed",220,150,-18,100,false,false,"Mac",false],["XenoType TB Woodblock",222,150,-20,105,false,false,"Mac",false],["XenoType TB sPungsChen",200,130,-15,105,false,false,"Mac",false],["XenoType TB Horyig Modern",200,166,-23,120,false,false,"Mac",false]];var tp_FONTNAME=0;var tp_FONTSIZE=1;var tp_LINEHEIGHT=2;var tp_VERTICALALIGN=3;var tp_PRIORITY=4;var tp_USERHAS=5;var tp_EMBEDDABLE=6;var tp_OS=7;var tp_NOUSPGOOD=8;var tp_knowIfXPorLower=false;if(navigator.userAgent.indexOf("Windows NT 5")>-1){tp_knowIfXPorLower=true;};if(tp_knowIfXPorLower){for(var i=0;i<tp_FONTLIST.length;i++){if(!(tp_FONTLIST[i][tp_NOUSPGOOD])){tp_FONTLIST[i][tp_EMBEDDABLE]=false;}}};var tp_myCookie;var tp_currentFont=null;var tp_noBold=true;var tp_bcorrectForTibetanFormInput=true;var tp_embedFonts=false;var tp_fontMultiplier=1;var tp_bReadjust=true;var tp_nReadjust=0;var tp_bFineTune=false;var tp_aFineTuneSpans=[];var tp_cookieDomain="";var com;if(!com){com={};}else if(typeof com!="object"){throw new Error("com already exists and is not an object");};if(!com.tp){com.tp={};}else if(typeof com.tp!="object"){throw new Error("com.tp already exists and is not an object");};function tp_addFontSelectContainerForMediaWiki(){var d=document;var exist=d.getElementById('p-navigation');if(exist){var o=d.createElement("div");o.className="portlet";o.id="com_tp_fontSelectContainer";var h5=d.createElement("h5");h5.appendChild(d.createTextNode("Tibetan Font"));o.appendChild(h5);exist=d.getElementById('p-navigation');var par=exist.parentNode;par.insertBefore(o,exist);}};function tp_updateFONTLISTbyFontAvailability(){var g=com.tp.General;var fontName;for(var i=0;i<tp_FONTLIST.length;i++){fontName=tp_FONTLIST[i][tp_FONTNAME];if(g.hasFont(fontName)){tp_FONTLIST[i][tp_USERHAS]=true;}else{tp_FONTLIST[i][tp_USERHAS]=false;}}};function tp_embedFont(fontName){var d=document;var oLink=d.createElement('link');oLink.setAttribute("rel","stylesheet");var rSpaceCharacter=/\s/g;var s=fontName.replace(rSpaceCharacter,"");var u=navigator.userAgent;if((u.indexOf("compatible")>-1)&&(u.indexOf("MSIE")>-1)){s+="UCSandSpace";};s+=".css";oLink.setAttribute("href","/embeddedFonts/"+s);var oHead=d.getElementsByTagName("head")[0];oHead.appendChild(oLink);};function tp_populateFontSelectContainer(){var u=com.tp.User;var d=document;var o=d.getElementById('com_tp_fontSelectContainer');if(o){var select=d.createElement("select");select.name="com_tp_fontSelect";select.id="com_tp_fontSelect";var option,fontName;for(var i=0;i<tp_FONTLIST.length;i++){option=d.createElement("option");fontName=tp_FONTLIST[i][tp_FONTNAME];if(fontName==tp_currentFont){option.defaultSelected=true;option.selected=true;};if(!tp_FONTLIST[i][tp_USERHAS]){if(tp_embedFonts&&u.getBrowserCanEmbedFonts()&&tp_FONTLIST[i][tp_EMBEDDABLE]){fontName="+"+fontName;}else{fontName="*"+fontName;}};fontName=fontName+" ("+tp_FONTLIST[i][tp_OS]+")";var t=d.createTextNode(fontName);option.appendChild(t);select.appendChild(option);};select=o.appendChild(select);var a0="this.options[this.selectedIndex].text";select.onchange=tp_onchangeTibetanStyleByFont;select.style.width="180px";var op=select.options;for(i=0;i<op.length;i++){if(op[i].text.indexOf("*")>-1){op[i].style.color="#C0C0C0";};if(op[i].text.indexOf("help")>-1){op[i].style.fontWeight="bold";}};return true;};return false;};function tp_checkUsersTibetanFonts(){var font,fontPriority;var currentPriority=-10;for(var i=0;i<tp_FONTLIST.length;i++){if(tp_FONTLIST[i][tp_USERHAS]){fontPriority=tp_FONTLIST[i][tp_PRIORITY];if(fontPriority>currentPriority){font=tp_FONTLIST[i][tp_FONTNAME];currentPriority=fontPriority;}}};if(font){return font;};return false;};function tp_indexOfTibetanFont(fontName){for(var i=0;i<tp_FONTLIST.length;i++){if(tp_FONTLIST[i][tp_FONTNAME]==fontName){return i;}};return false;};function tp_createCSStextByFontName(fontName){var index=tp_indexOfTibetanFont(fontName);var cssRule="";if(index!==false){cssRule='font-family: "'+tp_FONTLIST[index][tp_FONTNAME]+'"; ';if(tp_bReadjust){cssRule+='font-size: '+(tp_FONTLIST[index][tp_FONTSIZE]*tp_fontMultiplier)+'%; ';cssRule+='line-height: '+tp_FONTLIST[index][tp_LINEHEIGHT]+'%; ';cssRule+='vertical-align: '+tp_FONTLIST[index][tp_VERTICALALIGN]+'%; ';}};if(tp_noBold){cssRule+='font-weight: normal; ';};var u=com.tp.User;if(u.getBrowserBreaksUCStibetanJustification()){cssRule+='text-align: left; ';};cssRule+='letter-spacing: normal; ';cssRule+='font-variant: normal; ';return cssRule;};function tp_createTibetanStyleSheet(){var General=com.tp.General;General.createStyleSheetByTitle('com_tp_bo_stylesheet');};function tp_appendTibetanStyleByFont(fontName){var cssSelector=".com-tp-bo";var cssRule=tp_createCSStextByFontName(fontName);var sStyleSheet='com_tp_bo_stylesheet';var g=com.tp.General;g.appendStyleSheetByTitle(cssSelector,cssRule,sStyleSheet);};function tp_replaceTibetanStyleByFont(fontName){var cssSelector=".com-tp-bo";var cssRule=tp_createCSStextByFontName(fontName);var sStyleSheet='com_tp_bo_stylesheet';var g=com.tp.General;g.replaceStyleSheetByTitle(cssSelector,cssRule,sStyleSheet);};function tp_correctForTibetanFormInput(){if(!tp_currentFont){return;};var d=document;var aTags;var nIndex;var aElements=["textarea","input"];for(var i=0;i<aElements.length;i++){aTags=d.getElementsByTagName(aElements[i]);for(var i2=0;i2<aTags.length;i2++){nIndex=tp_indexOfTibetanFont(tp_currentFont);var font=tp_FONTLIST[nIndex][tp_FONTNAME];var size=(tp_FONTLIST[nIndex][tp_FONTSIZE]*0.9)+"%";aTags[i2].onfocus=function(){this.style.fontFamily=font;this.style.fontSize=size;};aTags[i2].onblur=function(){};}}};tp_onchangeTibetanStyleByFont=function(e){var d=document;var g=com.tp.General;if(!e){e=window.event;};var o=(e.srcElement)?(e.srcElement):(e.target);var fontName=o.options[o.selectedIndex].text;if(fontName.indexOf("(")>-1){fontName=fontName.replace(/\s\(.*\)/,"");};if(fontName.indexOf("+")>-1){fontName=fontName.replace(/\+/g,"");tp_embedFont(fontName);};if(fontName.indexOf("*")>-1){fontName=fontName.replace(/\*/g,"");var s="The %fn font is either not installed\non your system or is unavailable\nfor embedding in this browser.\n\nIf you just installed %fn,\nplease quit and restart your browser.\nYou can then try to select this font again.";s=s.replace(/\%fn/g,fontName);alert(s);for(var i=0;i<tp_FONTLIST.length;i++){s=tp_FONTLIST[i][tp_FONTNAME];if(s===tp_currentFont){o.options[i].defaultSelected=true;o.options[i].selected=true;}};return;}else{if(!g.getStyleSheetByTitle('com_tp_bo_stylesheet')){return false;}else{tp_replaceTibetanStyleByFont(fontName);tp_myCookie.font=fontName;tp_currentFont=fontName;tp_myCookie.store(365,"/",tp_cookieDomain);};var cf="tpf-"+tp_currentFont.replace(/\s/g,"");if(d.body.className.match(/tpf-/)){d.body.className=d.body.className.replace(/tpf-.*/,cf);}else{d.body.className+=" "+cf;};tp_correctForTibetanFormInput();if(tp_bFineTune){for(var i=0;i<tp_aFineTuneSpans.length;i++){tp_aFineTuneSpans[i].className=cf;}}}};function tp_tibetanSpansAndLineBreaks(node){var User=com.tp.User;var myNodes=[];var i,i2;if(!node){node=document.body;};var d=document;var clonedNode=node.cloneNode(true);var s=navigator.userAgent;if((s.indexOf("compatible")>-1)&&(s.indexOf("MSIE")>-1)){var aElements=clonedNode.all;var rSlash=/\//g;for(i=0;i<aElements.length;i++){if(aElements[i].nodeType==1){if(aElements[i].nodeName!="TEXTAREA"&&aElements[i].nodeName!="INPUT"&&aElements[i].nodeName!="EMBED"&&aElements[i].nodeName!="OBJECT"&&!rSlash.test(aElements[i].nodeName)){myNodes.push(aElements[i]);}}}}else{var filter={};filter.acceptNode=function(oNode){if(oNode.nodeName=="TEXTAREA"||oNode.nodeName=="INPUT"){return NodeFilter.FILTER_REJECT;};var cn=oNode.className;if(cn&&(cn.indexOf("com-tp-doNotProcess")>-1)){return NodeFilter.FILTER_REJECT;};return NodeFilter.FILTER_ACCEPT;};var walker=new com.tp.General.TreeWalker(clonedNode,NodeFilter.SHOW_ELEMENT,filter,false);var fAddSpans,intoWBR,buggyBrowser;var oNode=walker.nextNode();while(oNode){if(oNode.nodeType!=1){oNode=walker.nextNode();continue;};myNodes.push(oNode);oNode=walker.nextNode();}};try{var sRegExp="((?: *(?:\u0f00";for(i=3841;i<4096;i++){sRegExp+="|"+String.fromCharCode(i);};sRegExp+=")+ *)+)";var reSPAN=new RegExp(sRegExp,'g');var withSPAN='~@~span class="com-tp-bo" ';withSPAN+='lang="bo" xml:lang="bo"~#~$1~@~\/span~#~';if(tp_bFineTune){var cf=tp_currentFont.replace(/\s/g,"");cf="tpf-"+cf;withSPAN='~@~span class="'+cf+'"~#~'+withSPAN;withSPAN+='~@~\/span~#~';};fAddSpans=function(sText){return sText.replace(reSPAN,withSPAN);};buggyBrowser=false;intoWBR="";}catch(exception){fAddSpans=tp_buggyBrowserReplace;intoWBR='\u200b';buggyBrowser=true;};var reWBR=/(\u0f0b)(?=[^\u0f0d])/g;var withWBR='\u0f0b~@~wbr~#~'+intoWBR+'~@~/wbr~#~';var sText="";var child={};for(i=0;i<myNodes.length;i++){if(myNodes[i].hasChildNodes()){for(i2=0;i2<myNodes[i].childNodes.length;i2++){child=myNodes[i].childNodes[i2];if(child.nodeType==Node.TEXT_NODE){sText=fAddSpans(child.nodeValue);if(!User.getBrowserKnowsToBreakAtTsheg()){sText=sText.replace(reWBR,withWBR);};child.nodeValue=sText;}}}};var sINNER="";try{sINNER=clonedNode.innerHTML;}catch(err){var o;for(i=0;i<aElements.length;i++){o=aElements[i];if(o.nodeType===1){if(o.nodeName==="EMBED"){s="~@~EMBED";s+=" width="+o.width;s+=" height="+o.height;s+=" src="+o.src;s+="/~#~";o.outerHTML=s;}}};sINNER=clonedNode.innerHTML;};var sLT="~@~";var reLT=new RegExp(sLT,"g");sINNER=sINNER.replace(reLT,"<");var sGT="~#~";var reGT=new RegExp(sGT,"g");sINNER=sINNER.replace(reGT,">");node.innerHTML=sINNER;if(tp_bFineTune){var cn;var spans=node.getElementsByTagName('span');for(i=0;i<spans.length;i++){cn=spans[i].className;if(cn.indexOf("tpf-")>-1){tp_aFineTuneSpans.push(spans[i]);}}}};/*function tp_buggyBrowserReplace(sText){var spanStatus=false;var rangeLower=3840;var rangeUpper=4095;var newStr="";for(i=0;i<sText.length;i++){if((sText.charCodeAt(i)>=rangeLower)&&(sText.charCodeAt(i)<=rangeUpper)){if(!spanStatus){newStr+='~@~span class="com-tp-bo" lang="bo" xml:lang="bo"~#~';spanStatus=true;};newStr+=sText.charAt(i);var checkAgainstMe=sText.length-1;if(i==checkAgainstMe){newStr+='~@~/span~#~';continue;}}else{if(spanStatus){newStr+='~@~/span~#~';spanStatus=false;};newStr+=sText.charAt(i);}};newStr=newStr.replace(/(\s+)(~@~span class\=\"com\-tp\-bo\" lang\=\"bo\" xml\:lang\=\"bo\"~#~)/g,'$2$1');newStr=newStr.replace(/(~@~\/span~#~)(\s+)/g,'$2$1');return newStr;};*/function tp_fullAutomatic(correctForms,embedFonts,sCookieDomain,bReadjust,nReadjust){tp_currentHash=window.location.hash;var isOpera=false;tp_bReadjust=bReadjust;if(nReadjust){for(var i=0;i<tp_FONTLIST.length;i++){tp_FONTLIST[i][tp_FONTSIZE]=(tp_FONTLIST[i][tp_FONTSIZE])*nReadjust;}};if(embedFonts){tp_embedFonts=true;};if(correctForms){tp_bcorrectForTibetanFormInput=true;};if(sCookieDomain){tp_cookieDomain=sCookieDomain;};if((tp_cookieDomain.indexOf('port')===-1)&&(tp_cookieDomain.indexOf('khab')===-1)){return;};var d=document;var u=com.tp.User;var font;var Cookie=com.tp.Cookie;tp_myCookie=new Cookie("com_tp_cookie");tp_addFontSelectContainerForMediaWiki();tp_updateFONTLISTbyFontAvailability();if(isOpera){tp_tibetanSpansAndLineBreaks(document.body);};tp_createTibetanStyleSheet();if(tp_myCookie.font!==undefined){font=tp_myCookie.font;var nIndex=tp_indexOfTibetanFont(font);if(nIndex){if(tp_embedFonts&&u.getBrowserCanEmbedFonts()&&tp_FONTLIST[nIndex][tp_EMBEDDABLE]){tp_embedFont(font);}}}else{font=tp_checkUsersTibetanFonts();if(tp_embedFonts&&!font&&u.getBrowserCanEmbedFonts()){font="Tib-US Unicode";tp_embedFont(font);}};if(font){if(tp_myCookie.font!==font){tp_myCookie.font=font;tp_myCookie.store(365,"/",tp_cookieDomain);};tp_currentFont=font;tp_appendTibetanStyleByFont(font);};if(!isOpera){tp_tibetanSpansAndLineBreaks(document.body);};tp_populateFontSelectContainer();if(tp_bcorrectForTibetanFormInput){tp_correctForTibetanFormInput();};var jsOn=d.getElementById("com_tp_usingJavascript");if(jsOn){jsOn.style.display="none";};var cf="tpf-"+tp_currentFont.replace(/\s/g,"");if(d.body.className.match(/tpf-/)){d.body.className=d.body.className.replace(/tpf-.*/,cf);}else{d.body.className+=" "+cf;};if(tp_currentHash){window.location.hash=tp_currentHash;};if(window.tp_onComplete){tp_onComplete();}};function tp_fullChrisAutomatic(){var hn=window.location.hostname;hn=hn.replace(/(www\.)?(.*)/,"$2");tp_fullAutomatic(false,true,hn,true,0);};function tp_fullSuperAutomatic(){var reAd;if(!window.tp_nReadjustME){reAd=0;}else{reAd=tp_nReadjustME;};var hn=window.location.hostname;hn=hn.replace(/(www\.)?(.*)/,"$2");tp_fullAutomatic(false,true,hn,true,reAd);};if(!window.Node){window.Node={};Node.ELEMENT_NODE=1;Node.ATTRIBUTE_NODE=2;Node.TEXT_NODE=3;Node.CDATA_SECTION_NODE=4;Node.ENTITY_REFERENCE_NODE=5;Node.ENTITY_NODE=6;Node.PROCESSING_INSTRUCTION_NODE=7;Node.COMMENT_NODE=8;Node.DOCUMENT_NODE=9;Node.DOCUMENT_TYPE_NODE=10;Node.DOCUMENT_FRAGMENT_NODE=11;Node.NOTATION_NODE=12;};if(!document.createTreeWalker){var NodeFilter={FILTER_ACCEPT:1,FILTER_REJECT:2,FILTER_SKIP:3,SHOW_ALL:0xFFFFFFFF,SHOW_ELEMENT:0x00000001,SHOW_ATTRIBUTE:0x00000002,SHOW_TEXT:0x00000004,SHOW_CDATA_SECTION:0x00000008,SHOW_ENTITY_REFERENCE:0x00000010,SHOW_ENTITY:0x00000020,SHOW_PROCESSING_INSTRUCTIONS:0x00000040,SHOW_COMMENT:0x00000080,SHOW_DOCUMENT:0x00000100,SHOW_DOCUMENT_TYPE:0x00000200,SHOW_DOCUMENT_FRAGMENT:0x00000400,SHOW_NOTATION:0x00000800};};com.tp.General={};com.tp.General.hasFont=function(sFont){var ns="com_tp_";var d=document;var b=d.body;var o;var eWriteDiv=d.getElementById(ns+'fillFont');if(!eWriteDiv){o=d.createElement('div');o.setAttribute('id',ns+'fillFont');eWriteDiv=b.appendChild(o);};var oSpan=[];var sMacControlFont="Kokonor, Kailasa, STFangsong";if(sFont=="Kokonor"){sMacControlFont="Kailasa, STFangsong";};if(sFont=="Kailasa"){sMacControlFont="Kokonor, STFangsong";};var aFontFamilies=[sMacControlFont+', Courier',(sFont+", "+sMacControlFont+", Courier")];var aFontIds=[ns+'fontControl',ns+'fontTest'];var testString='\u0F4C\u0F66\u0F90\u0F4E\u0F54\u0F55\u0F56\u0F58\u0F5Babcdefghijklmnopqrstuvwxyz';var sCssText;for(var i=0;i<aFontFamilies.length;i++){o=d.getElementById(aFontIds[i]);if(!o){o=d.createElement('span');o.id=aFontIds[i];o.style.left='-200px';o.style.top='-'+((i+1)*(200))+'px';o.style.backgroundColor=((i===0)?'red':'green');o.style.fontSize='24pt';o.style.display='block';o.style.position='absolute';eWriteDiv.appendChild(o);}else{o.innerHTML='';o.style.display='block';o.style.position='absolute';};o.style.fontFamily=aFontFamilies[i];o.appendChild(d.createTextNode(testString));};var nWidthControl=d.getElementById(ns+'fontControl').offsetWidth;var nWidthTest=d.getElementById(ns+'fontTest').offsetWidth;return(nWidthControl!=nWidthTest);};com.tp.General.createStyleSheetByTitle=function(sTitle,cssText){var g=com.tp.General;var d=document;var oSS={};if(cssText===undefined){cssText="";};if(d.createStyleSheet){oSS=d.createStyleSheet();oSS.title=sTitle;oSS.owningElement.type="text/css";}else{oSS=d.createElement("style");oSS.type="text/css";oSS.disabled=false;var text=cssText;var tStyle=d.createTextNode(text);oSS.appendChild(tStyle);var h=d.getElementsByTagName("head")[0];h.appendChild(oSS);h.lastChild.title=sTitle;};g.enableStyleSheetByTitle(sTitle);};com.tp.General.getStyleSheetByTitle=function(sTitle){var d=document;var s=d.styleSheets;for(var i=0;i<s.length;i++){if(s[i].title==sTitle){return s[i];};if(s[i].ownerNode){if(s[i].ownerNode.title==sTitle){return s[i];}}};return false;};com.tp.General.appendStyleSheetByTitle=function(sCSSselector,sCSSrule,sTitle){var d=document;var g=com.tp.General;var u=com.tp.User;var ss=g.getStyleSheetByTitle(sTitle);var sText=sCSSselector+" {"+sCSSrule+"}; ";if(ss.cssText!==undefined){ss.addRule(sCSSselector,sCSSrule);}else if(u._checkBrowersDoesDOMStylesheets()){ss.insertRule(sText,ss.cssRules.length);g._refreshAfterStyleSheetChange();}else{var o=ss.ownerNode;var h=d.getElementsByTagName("head")[0];var cssText=o.innerHTML+" "+sText;h.removeChild(o);g.createStyleSheetByTitle(sTitle,cssText);};g.enableStyleSheetByTitle(sTitle);};com.tp.General.replaceStyleSheetByTitle=function(sCSSselector,sCSSrule,sTitle){var d=document;var h=d.getElementsByTagName("head")[0];var g=com.tp.General;var cssText=sCSSselector+" {"+sCSSrule+"}; ";var u=com.tp.User;var ss=g.getStyleSheetByTitle(sTitle);if(ss.cssText!==undefined){if(ss.rules.length){ss.removeRule(0);};ss.addRule(sCSSselector,sCSSrule);}else if(u._checkBrowersDoesDOMStylesheets()){if(ss.cssRules.length){ss.deleteRule(0);};ss.insertRule(cssText,ss.cssRules.length);g._refreshAfterStyleSheetChange();}else{var o=ss.ownerNode;h.removeChild(o);g.createStyleSheetByTitle(sTitle,cssText);};g.enableStyleSheetByTitle(sTitle);};com.tp.General.toggleStyleSheetByTitle=function(s){var g=com.tp.General;var o=g.getStyleSheetByTitle(s);o.disabled=!o.disabled;return o.disabled;};com.tp.General.enableStyleSheetByTitle=function(sTitle){var d=document;var General=com.tp.General;var oSheet=General.getStyleSheetByTitle(sTitle);oSheet.disabled=false;return oSheet.disabled;};com.tp.General.disableStyleSheetByTitle=function(sTitle){var d=document;var General=com.tp.General;var oSheet=General.getStyleSheetByTitle(sTitle);oSheet.disabled=true;return oSheet.disabled;};com.tp.General.removeStyleSheetByTitle=function(sTitle){var d=document;var General=com.tp.General;var oSheet=General.getStyleSheetByTitle(sTitle);if(oSheet.owningElement){oSheet.owningElement.parentNode.removeChild(oSheet.owningElement);var body=d.getElementsByTagName("body")[0];body.innerHTML=body.innerHTML;}else{oSheet.ownerNode.parentNode.removeChild(oSheet.ownerNode);}};com.tp.General._refreshAfterStyleSheetChange=function(){var d=document;var walker=d.createTreeWalker(d.body,NodeFilter.SHOW_TEXT,null,false);var oNode=walker.nextNode();var myNodes=[];while(oNode){myNodes.push(oNode);oNode=walker.nextNode();};for(var i=0;i<myNodes.length;i++){myNodes[i].nodeValue=myNodes[i].nodeValue;}};function TreeWalker(root,whatToShow,filter,expandEntityReferences){this.root=root;this.whatToShow=whatToShow;this.filter=filter;this.expandEntityReferences=expandEntityReferences;this.currentNode=root;};TreeWalker.prototype.parentNode=function(){var testNode=currentNode;do{if(testNode.parentNode!=this.root&&testNode.parentNode!=null){testNode=testNode.parentNode;}else{return null;}}while(this._getFilteredStatus(testNode)!=NodeFilter.FILTER_ACCEPT);return testNode;};TreeWalker.prototype.firstChild=function(){var childNodes=currentNode.childNodes;for(var childIndex=0;childIndex<childNodes.length;childIndex++){var testNode=childNodes[childIndex];if(this._getFilteredStatus(testNode)!=NodeFilter.FILTER_ACCEPT){this.currentNode=testNode;return testNode;}};return null;};TreeWalker.prototype.lastChild=function(){var childNodes=currentNode.childNodes;for(var childIndex=childNodes.length-1;childIndex>=0;childIndex--){var testNode=childNodes[childIndex];if(this._getFilteredStatus(testNode)!=NodeFilter.FILTER_ACCEPT){this.currentNode=testNode;return testNode;}};return null;};TreeWalker.prototype.nextNode=function(){var testNode=this.currentNode;while(testNode!=null){if(testNode.childNodes.length!=0&&this._getFilteredStatus(testNode)!=NodeFilter.FILTER_REJECT){testNode=testNode.firstChild;}else if(testNode.nextSibling!=null){testNode=testNode.nextSibling;}else{do{if(testNode.parentNode!=this.root&&testNode.parentNode!=null){if(testNode.parentNode.nextSibling!=null){testNode=testNode.parentNode.nextSibling;break;}else{testNode=testNode.parentNode;}}else{testNode=null;}}while(testNode!=null);};if(testNode!=null&&this._getFilteredStatus(testNode)==NodeFilter.FILTER_ACCEPT){var s1="this.whatToShow: "+this.whatToShow+"\n";var s2="testNode.nodeType: "+testNode.nodeType+"\n";break;}};if(testNode!=null){this.currentNode=testNode;};return testNode;};TreeWalker.prototype.previousNode=function(){var testNode=this.currentNode;while(testNode!=null){if(testNode!=currentNode&&testNode.childNodes.length!=0&&this._getFilteredStatus(testNode)!=NodeFilter.FILTER_REJECT){testNode=testNode.lastChild;}else if(testNode.previousSibling!=null){testNode=testNode.previousSibling;}else{do{if(testNode.parentNode!=this.root&&testNode.parentNode!=null){if(testNode.parentNode.previousSibling!=null){testNode=testNode.parentNode.previousSibling;break;}else{testNode=testNode.parentNode;}}else{testNode=null;}}while(testNode!=null);};if(testNode!=null&&this._getFilteredStatus(testNode)==NodeFilter.FILTER_ACCEPT){break;}};if(testNode!=null){this.currentNode=testNode;};return testNode;};TreeWalker.prototype.nextSibling=function(){var testNode=currentNode;do{if(currentNode.nextSibling!=null){testNode=currentNode.nextSibling;}else{return null;}}while(this._getFilteredStatus(testNode)!=NodeFilter.FILTER_ACCEPT);return testNode;};TreeWalker.prototype.previousSibling=function(){var testNode=currentNode;do{if(currentNode.previousSibling!=null){testNode=currentNode.previousSibling;}else{return null;}}while(this._getFilteredStatus(testNode)!=NodeFilter.FILTER_ACCEPT);return testNode;};document.createTreeWalker2=function(root,whatToShow,filter,expandEntityReferences){return new TreeWalker(root,whatToShow,filter,expandEntityReferences);};TreeWalker.prototype._getFilteredStatus=function(node){if((node.nodeType==Node.ELEMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_ELEMENT==0x0))||(node.nodeType==Node.ATTRIBUTE_NODE&&(this.whatToShow&NodeFilter.SHOW_ATTRIBUTE==0x0))||(node.nodeType==Node.TEXT_NODE&&(this.whatToShow&NodeFilter.SHOW_TEXT==0x0))||(node.nodeType==Node.CDATA_SECTION_NODE&&(this.whatToShow&NodeFilter.SHOW_CDATA_SECTION==0x0))||(node.nodeType==Node.ENTITY_REFERENCE_NODE&&(this.whatToShow&NodeFilter.SHOW_ENTITY_REFERENCE==0x0))||(node.nodeType==Node.ENTITY_NODE&&(this.whatToShow&NodeFilter.SHOW_ENTITY==0x0))||(node.nodeType==Node.PROCESSING_INSTRUCTION_NODE&&(this.whatToShow&NodeFilter.SHOW_PROCESSING_INSTRUCTION==0x0))||(node.nodeType==Node.COMMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_COMMENT==0x0))||(node.nodeType==Node.DOCUMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_DOCUMENT==0x0))||(node.nodeType==Node.DOCUMENT_TYPE_NODE&&(this.whatToShow&NodeFilter.SHOW_DOCUMENT_TYPE==0x0))||(node.nodeType==Node.DOCUMENT_FRAGMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_DOCUMENT_FRAGMENT==0x0))||(node.nodeType==Node.NOTATION_NODE&&(this.whatToShow&NodeFilter.SHOW_NOTATION==0x0))){return NodeFilter.FILTER_SKIP;};if(this.filter!=null&&this.filter.acceptNode!=null){return this.filter.acceptNode(node);}else{return NodeFilter.FILTER_ACCEPT;}};com.tp.General.TreeWalker=function(root,whatToShow,filter,expandEntityReferences){this.root=root;this.whatToShow=whatToShow;this.filter=filter;this.expandEntityReferences=expandEntityReferences;this.currentNode=root;};com.tp.General.TreeWalker.prototype.parentNode=function(){var testNode=this.currentNode;do{if(testNode.parentNode!==this.root&&testNode.parentNode!==null){testNode=testNode.parentNode;}else{return null;}}while(this._getFilteredStatus(testNode)!==NodeFilter.FILTER_ACCEPT);return testNode;};com.tp.General.TreeWalker.prototype.firstChild=function(){var childNodes=this.currentNode.childNodes;for(var childIndex=0;childIndex<childNodes.length;childIndex++){var testNode=childNodes[childIndex];if(this._getFilteredStatus(testNode)!==NodeFilter.FILTER_ACCEPT){this.currentNode=testNode;return testNode;}};return null;};com.tp.General.TreeWalker.prototype.lastChild=function(){var childNodes=this.currentNode.childNodes;for(var childIndex=childNodes.length-1;childIndex>=0;childIndex--){var testNode=childNodes[childIndex];if(this._getFilteredStatus(testNode)!==NodeFilter.FILTER_ACCEPT){this.currentNode=testNode;return testNode;}};return null;};com.tp.General.TreeWalker.prototype.nextNode=function(){var testNode=this.currentNode;while(testNode!==null){if(testNode.childNodes.length!==0&&this._getFilteredStatus(testNode)!==NodeFilter.FILTER_REJECT){testNode=testNode.firstChild;}else if(testNode.nextSibling!==null){testNode=testNode.nextSibling;}else{do{if((testNode.parentNode!==this.root)&&(testNode.parentNode!==null)){if(testNode.parentNode.nextSibling!==null){testNode=testNode.parentNode.nextSibling;break;}else{testNode=testNode.parentNode;}}else{testNode=null;}}while(testNode!==null);};if(testNode!==null&&(this._getFilteredStatus(testNode)===NodeFilter.FILTER_ACCEPT)){break;}};if(testNode!==null){this.currentNode=testNode;};return testNode;};com.tp.General.TreeWalker.prototype.previousNode=function(){var testNode=this.currentNode;while(testNode!==null){if(testNode!==this.currentNode&&testNode.childNodes.length!==0&&this._getFilteredStatus(testNode)!==NodeFilter.FILTER_REJECT){testNode=testNode.lastChild;}else if(testNode.previousSibling!==null){testNode=testNode.previousSibling;}else{do{if(testNode.parentNode!==this.root&&testNode.parentNode!==null){if(testNode.parentNode.previousSibling!==null){testNode=testNode.parentNode.previousSibling;break;}else{testNode=testNode.parentNode;}}else{testNode=null;}}while(testNode!==null);};if(testNode!==null&&this._getFilteredStatus(testNode)===NodeFilter.FILTER_ACCEPT){break;}};if(testNode!==null){this.currentNode=testNode;};return testNode;};com.tp.General.TreeWalker.prototype.nextSibling=function(){var testNode=this.currentNode;do{if(this.currentNode.nextSibling!==null){testNode=this.currentNode.nextSibling;}else{return null;}}while(this._getFilteredStatus(testNode)!==NodeFilter.FILTER_ACCEPT);return testNode;};com.tp.General.TreeWalker.prototype.previousSibling=function(){var testNode=this.currentNode;do{if(this.currentNode.previousSibling!==null){testNode=this.currentNode.previousSibling;}else{return null;}}while(this._getFilteredStatus(testNode)!==NodeFilter.FILTER_ACCEPT);return testNode;};com.tp.General.TreeWalker.prototype._getFilteredStatus=function(node){if((node.nodeType===Node.ELEMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_ELEMENT===0x0))||(node.nodeType===Node.ATTRIBUTE_NODE&&(this.whatToShow&NodeFilter.SHOW_ATTRIBUTE===0x0))||(node.nodeType===Node.TEXT_NODE&&(this.whatToShow&NodeFilter.SHOW_TEXT===0x0))||(node.nodeType===Node.CDATA_SECTION_NODE&&(this.whatToShow&NodeFilter.SHOW_CDATA_SECTION===0x0))||(node.nodeType===Node.ENTITY_REFERENCE_NODE&&(this.whatToShow&NodeFilter.SHOW_ENTITY_REFERENCE===0x0))||(node.nodeType===Node.ENTITY_NODE&&(this.whatToShow&NodeFilter.SHOW_ENTITY===0x0))||(node.nodeType===Node.PROCESSING_INSTRUCTION_NODE&&(this.whatToShow&NodeFilter.SHOW_PROCESSING_INSTRUCTION===0x0))||(node.nodeType===Node.COMMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_COMMENT===0x0))||(node.nodeType===Node.DOCUMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_DOCUMENT===0x0))||(node.nodeType===Node.DOCUMENT_TYPE_NODE&&(this.whatToShow&NodeFilter.SHOW_DOCUMENT_TYPE===0x0))||(node.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&(this.whatToShow&NodeFilter.SHOW_DOCUMENT_FRAGMENT===0x0))||(node.nodeType===Node.NOTATION_NODE&&(this.whatToShow&NodeFilter.SHOW_NOTATION===0x0))){return NodeFilter.FILTER_SKIP;};if(this.filter!==null&&this.filter.acceptNode!==null){return this.filter.acceptNode(node);}else{return NodeFilter.FILTER_ACCEPT;}};com.tp.User={};com.tp.User.getBrowserKnowsToBreakAtTsheg=function(){var User=com.tp.User;if(User._browserKnowsToBreakAtTsheg===undefined){User._browserKnowsToBreakAtTsheg=User._checkBrowserKnowsToBreakAtTsheg();};return User._browserKnowsToBreakAtTsheg;};com.tp.User.getBrowserBreaksUCStibetanJustification=function(){var User=com.tp.User;if(User._browserBreaksUCStibetanJustification===undefined){User._browserBreaksUCStibetanJustification=User._checkBrowserBreaksUCStibetanJustification();};return User._browserBreaksUCStibetanJustification;};com.tp.User.getBrowserCanEmbedFonts=function(){var User=com.tp.User;if(User._browserCanEmbedFonts===undefined){User._browserCanEmbedFonts=User._checkBrowserCanEmbedFonts();};return User._browserCanEmbedFonts;};com.tp.User._checkBrowserCanEmbedFonts=function(){var sUserAgent=navigator.userAgent;if((sUserAgent.indexOf("compatible")>-1)&&(sUserAgent.indexOf("MSIE")>-1)){return true;};return false;};com.tp.User._checkBrowserKnowsToBreakAtTsheg=function(){if(!document.getElementById('tp_tshegCheck')){var oDiv=document.createElement('div');oDiv.setAttribute('id','tp_tshegCheck');document.body.appendChild(oDiv);};var eWriteDiv=document.getElementById('tp_tshegCheck');var oSpan=[];var aTshegIds=['tp_tshegCheckControl','tp_tshegCheckTest'];var tshegChar="\u0f40\u0f0b";for(var i=0;i<aTshegIds.length;i++){oSpan[i]=document.createElement('span');oSpan[i].id=aTshegIds[i];oSpan[i].lang='bo';oSpan[i].style.fontSize='24pt';oSpan[i].style.display='block';oSpan[i].style.position='absolute';oSpan[i].style.width='190px';oSpan[i].style.left='-200px';oSpan[i].style.top='-'+((i+1)*(200))+'px';oSpan[i].style.backgroundColor=((i===0)?'red':'green');if(aTshegIds[i]=='tp_tshegCheckTest'){for(var i2=0;i2<50;i2++){tshegChar+="\u0f40\u0f0b";}};oSpan[i].appendChild(document.createTextNode(tshegChar));if(document.getElementById(aTshegIds[i])){eWriteDiv.replaceChild(oSpan[i],document.getElementById(aTshegIds[i]));}else{eWriteDiv.appendChild(oSpan[i]);}};var nHeightControl=document.getElementById('tp_tshegCheckControl').offsetHeight;var nHeightTest=document.getElementById('tp_tshegCheckTest').offsetHeight;var twiceSize=(2*nHeightControl);var result=(nHeightTest>=twiceSize);return result;};com.tp.User._checkBrowserBreaksUCStibetanJustification=function(){var sUserAgent=navigator.userAgent;var isKHTML=sUserAgent.indexOf("KHTML")>-1||sUserAgent.indexOf("Konqueror")>-1||sUserAgent.indexOf("AppleWebKit")>-1;var isMoz=sUserAgent.indexOf("Gecko")>-1&&!isKHTML;if(isMoz){return true;};return false;};com.tp.User._checkBrowersDoesDOMStylesheets=function(){var s=navigator.userAgent;var isKHTML=s.indexOf("KHTML")>-1||s.indexOf("Konqueror")>-1||s.indexOf("AppleWebKit")>-1;var isMoz=s.indexOf("Gecko")>-1&&!isKHTML;if(isMoz){return true;};return false;};com.tp.Cookie=function(n){var i;this.$name=n;var a=document.cookie;a=a.replace(/\s/g,"");if(a===""){return;};var C=a.split(';');var c=null;for(i=0;i<C.length;i++){if(C[i].substring(0,n.length+1)==(n+"=")){c=C[i];break;}};if(c===null){return;};var l=c.substring(n.length+1);a=l.split('&');for(i=0;i<a.length;i++){a[i]=a[i].split(':');};for(i=0;i<a.length;i++){this[a[i][0]]=decodeURIComponent(a[i][1]);}};com.tp.Cookie.prototype.store=function(v,p,m,s){var l="";for(var r in this){if((r.charAt(0)=='$')||((typeof this[r])=='function')){continue;};if(l!==""){l+='&';};l+=r+':'+encodeURIComponent(this[r]);};var c=this.$name+'='+l;/*if(v||v==0){c+="; max-age="+(v*24*60*60);};*/if(v||v===0){var dExpires=new Date((new Date()).getTime()+(v*24*3600000));c+='; expires='+dExpires.toGMTString();};if(p){c+="; path="+p;};if(m){c+="; domain="+m;};if(s){c+="; secure";};document.cookie=c;};com.tp.Cookie.prototype.remove=function(path,domain,secure){for(var prop in this){if(prop.charAt(0)!='$'&&typeof this[prop]!='function'){delete this[prop];}};this.store(0,path,domain,secure);};com.tp.Cookie.prototype.toString=function(){var sText="";for(var r in this){if((typeof this[r])=='function'){continue;};sText+=r+"=\"" + this[r] + "\"\n";};return sText;};


