
var TTKeywordUtils=new wrzrA();

var ng0kM=null;

var nNYaN=new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$');


function loadKeywordListAsynch(wBARR){

if((wBARR==null)||(wBARR.length==0)||(typeof(TTAPI.GetProperty)=="undefined")){
return(false);
}

if(typeof(XMLHttpRequest)=="undefined"){
ng0kM=new ActiveXObject("Microsoft.XMLHTTP");
}
else{
ng0kM=new XMLHttpRequest();
}

ng0kM.open("POST",wBARR,true);
ng0kM.onreadystatechange=function(oBvwL){

if((ng0kM.readyState==4)&&(ng0kM.status==200)){

var Zxnql=ng0kM.responseText;
Zxnql=Zxnql.replace(/^\s+/,'').replace(/\s+$/,'');
if((Zxnql==null)||(Zxnql.length==0)){
return;
}

if((Zxnql.charAt(0)=="{")&&(Zxnql.charAt(Zxnql.length-1)=="}")){
var oJn7g=eval("("+ng0kM.responseText+")");
if((typeof(oJn7g)!="undefined")&&oJn7g){
TTAPI.SetProperty("keywordlist",oJn7g);
}
}
}
};
ng0kM.send(null);

return(true);
}


function lCNML(euksN,sID,bkg6b,yy3lW){
this.euksN=euksN;
this.sID=sID;
this.bkg6b=bkg6b;
this.yy3lW=yy3lW;

return(this);
}


function wrzrA(){

this.pDKBk=null;

this.mUYTO=null;

this.AG3Sy=null;
this.StoKO=null;

this.GC_LQ=new Array();

this.lOpFx=false;
this.AcZHu=false;

this.avLcR=-1;

this.vqTKi=1000;

this.wToOF=2000;
this.LK7Bs=5;
this.l6zcw=0;

this.PX4Tu=0;
if(typeof(TimerEventType)!="undefined"){
this.PX4Tu=TimerEventType["ANIMATIONS_BEFORE"];
}

this.dKPoI="";
this.KYSxk="key";
this.WYE7X="key_id";

this.qtmLJ=this.i1pUX;

return(this);
}




wrzrA.prototype.w1O60=new RegExp("\\[GLOSSARY_URI\\]","g");
wrzrA.prototype.mOQBy=new RegExp("\\[LINK_NAME\\]","g");
wrzrA.prototype.Hk7Ev=new RegExp("\\[GLOSSARY_POPUP_PARAMS\\]","g");

wrzrA.prototype.I26F8=new RegExp("[ <>\"&!#$%()\\[\\]{}*|^/\\+,.:;=?@_~]","g");

wrzrA.prototype.i1pUX="<a name=\"[LINK_NAME]\" href=\"[GLOSSARY_URI]\" onclick=\"return(!window.open('[GLOSSARY_URI]','glossary','[GLOSSARY_POPUP_PARAMS]'))\" target=\"glossary_view\" class=\"ttclassglossary_link\">";
wrzrA.prototype.lkTLu="</a>";

wrzrA.prototype.hYHpX="width=900,height=700,resizable=yes";

wrzrA.prototype.olaLM="page_singleton";






wrzrA.prototype.JyoPm=function(Yc_Gb,mkf9j){

if(this.AcZHu||!mkf9j||(typeof(Yc_Gb)=="undefined")){
return(false);
}

this.pDKBk=Yc_Gb;

this.AG3Sy=null;
this.StoKO=null;
this.l6zcw=0;

this.pC8Dr=null;

this.mUYTO=mkf9j;

this.GC_LQ=new Array();

this.lOpFx=false;
this.AcZHu=false;

var ANIxP=this.pDKBk.GetProperty("glossarylinkingmode");
if(ANIxP&&(ANIxP.length>0)){
this.olaLM=ANIxP;
}

if(!this.nBlVX(this.olaLM)){return(false);}

var h_6we=this.pDKBk.GetProperty("glossarypopupparams");
if(h_6we){
this.hYHpX=h_6we;
}

this.asynchKeywordObjectCheck();

return(true);
};

wrzrA.prototype.nBlVX=function(IsBQH){

if(IsBQH=="none"){return(false);}

if(!this.pDKBk){return(false);}

var VoG2a=this.pDKBk.GetProperty("glossarylinking");
if(!VoG2a||(VoG2a.length!=2)){
VoG2a="01";
}

var TMo_L=parseInt(this.pDKBk.GetProperty("wbtmode"),2);
if(isNaN(TMo_L)){return(true);}

if(TMo_L==WBTMode["Learning"].value){
if(VoG2a.charAt(1)=='0'){return(false);}
}
else if(TMo_L==WBTMode["Assessment"].value){
if(VoG2a.charAt(0)=='0'){return(false);}
}

return(true);
};


wrzrA.prototype.w5vP7=function(){

if(this.lOpFx||this.AcZHu||(this.AG3Sy==null)){
return(false);
}

if(this.GC_LQ&&(this.GC_LQ.length>0)){
this.eZQcs();
return(true);
}

return(false);
};


wrzrA.prototype.StopKeywordHighlighting=function(){

if(this.avLcR!=-1){
window.clearTimeout(this.avLcR);
this.avLcR=-1;
}

this.AcZHu=false;

return(true);
};






wrzrA.prototype.asynchKeywordObjectCheck=function(){

if(this.AcZHu||(typeof(this.pDKBk.GetProperty)=="undefined")){
return;
}

this.avLcR=-1;

try{

var oJn7g=this.pDKBk.GetProperty("keywordlist");
if(oJn7g&&(typeof(oJn7g)!="undefined")){

var O1X2i=TTAPI.GetProperty("guid");
if((O1X2i!=null)&&(O1X2i.length>null)&&(typeof(oJn7g[O1X2i])!="undefined")){
var o0rED=oJn7g[O1X2i];
if((typeof(o0rED["keywords"])!="undefined")&&this.UPiTm(o0rED)){
window.setTimeout("TTKeywordUtils.startHighlightProcess()",50);
}
}
}
else{

if(this.l6zcw<this.LK7Bs){
this.l6zcw++;
this.avLcR=window.setTimeout("try{TTKeywordUtils.asynchKeywordObjectCheck();}catch(e){}",this.wToOF);
}
}
}
catch(mEXRa){}
};


wrzrA.prototype.UPiTm=function(oJn7g){

if(this.AcZHu||(oJn7g==null)){
return(false);
}

if((typeof(oJn7g["glossary"])=="undefined")||(typeof(oJn7g["keywords"])=="undefined")){
return(false);
}

if(typeof(oJn7g["glossary"]["uri"]!="undefined")){

this.dKPoI=oJn7g["glossary"]["uri"];

if(this.dKPoI.indexOf("../")==0){
this.dKPoI=TTAPI.GetProperty("sequencepath")+this.dKPoI;
}

TTAPI.SetPropertyString("glossaryuri",this.dKPoI);
TTAPI.FireEvent(TTEventType["GlossaryFound"],{"uri":encodeURI(this.dKPoI)},true);
}


if(typeof(oJn7g["glossary"]["keyword_param"]!="undefined")){
this.KYSxk=oJn7g["glossary"]["keyword_param"];
}

if(typeof(oJn7g["keywords"]!="undefined")){
this.AG3Sy=oJn7g["keywords"];
}

if((this.dKPoI==null)||(this.dKPoI.length==0)||(this.KYSxk==null)||(this.KYSxk.length==0)||(this.AG3Sy==null)){
this.AG3Sy=null;
this.StoKO=null;
this.dKPoI="";
this.KYSxk="key";
this.WYE7X="key_id";
this.pC8Dr=null;

return(false);
}

if(typeof(oJn7g["resources"])!="undefined"){
var tFaXj=oJn7g["resources"];
if(tFaXj.length>0){
this.pC8Dr=new Object();
for(var kyHGZ=0;kyHGZ<tFaXj.length;kyHGZ++){
var sID=tFaXj[kyHGZ];
if((sID==null)||(sID.length==0)){
continue;
}
this.pC8Dr[sID]=true;
}
}
}

if(typeof(oJn7g["glossary"]["statID_param"]!="undefined")){
this.WYE7X=oJn7g["glossary"]["statID_param"];
}

if(typeof(oJn7g["statify_index"]!="undefined")){
this.StoKO=oJn7g["statify_index"];
}

return(true);
};



wrzrA.prototype.startHighlightProcess=function(){

if(this.AcZHu||!this.AG3Sy||!this.mUYTO){
return(false);
}

var oJn7g=new Object();

this.AcZHu=true;

for(var lLl2p in this.mUYTO){

var _5sO0=this.mUYTO[lLl2p];
if(!_5sO0){continue;}

var yCMPK=_5sO0.getElementsByTagName("span");
for(var kyHGZ=0;kyHGZ<yCMPK.length;kyHGZ++){

if((yCMPK[kyHGZ].style.display=="none")||(yCMPK[kyHGZ].style.visibility=="hidden")){continue;}

var sID=yCMPK[kyHGZ].id;
if(!sID||(sID.length==0)){continue;}
if((sID.indexOf("comment")==0)&&(lLl2p!="comment")){continue;}

var sID=this.kyxyL(sID);


var EiJDB=yCMPK[kyHGZ].innerHTML;
if((EiJDB==null)||(EiJDB.length==0)){continue;}

if(this.pC8Dr==null){


if(typeof(this.AG3Sy[sID])=="undefined"){continue;}

var jGvk0=this.AG3Sy[sID];
if((jGvk0==null)&&(jGvk0.length==0)){continue;}

for(var baYUz=0;baYUz<jGvk0.length;baYUz++){
var bkg6b=jGvk0[baYUz];
var les9A=bkg6b.toLowerCase();
if((this.olaLM=="page_singleton")&&(typeof(oJn7g[les9A])!="undefined")){continue;}
oJn7g[les9A]=true;
this.GC_LQ.push(new lCNML(_5sO0,yCMPK[kyHGZ].id,bkg6b,bkg6b));
}
}
else{



if((typeof(this.pC8Dr[sID])=="undefined")||!this.pC8Dr[sID]){
continue;
}

var _jBS3=EiJDB.toLowerCase();
for(var bkg6b in this.AG3Sy){
var les9A=bkg6b.toLowerCase();
if((this.olaLM=="page_singleton")&&(typeof(oJn7g[les9A])!="undefined")){continue;}
if(_jBS3.indexOf(les9A)>-1){
oJn7g[les9A]=true;
this.GC_LQ.push(new lCNML(_5sO0,yCMPK[kyHGZ].id,bkg6b,this.AG3Sy[bkg6b]));
}
}

}
}
}

if(this.GC_LQ.length>0){
this.lOpFx=false;
this.eZQcs();
return(true);
}

return(false);
};


wrzrA.prototype.kyxyL=function(sID){
var ylqwi=sID.lastIndexOf("I");
if((ylqwi>=0)&&(ylqwi<(sID.length-1))){
sID=sID.substr(ylqwi);
}

return(sID);
};


wrzrA.prototype.eZQcs=function(){
if(!this.GC_LQ||(this.GC_LQ.length==0)){
return(false);
}

this.avLcR=window.setTimeout("try{TTKeywordUtils.asynchProcessCall();}catch(e){}",20);

return(true);
};


wrzrA.prototype.MWZZQ=function(){
if(!this.AcZHu){
return(false);
}

if(!this.eZQcs()){
this.lOpFx=true;
this.StopKeywordHighlighting();
}

return(true);
};



wrzrA.prototype.PRkO0=function(sID){
if(this.AG3Sy==null){
return(null);
}

sID=this.kyxyL(sID);

if((typeof(this.AG3Sy[sID])!="undefined")&&(typeof(this.AG3Sy[sID])!="unknown")){
var px7Hk=this.AG3Sy[sID];
if(px7Hk.length>0){
return(px7Hk);
}
}

return(null);
};



wrzrA.prototype.BIeke=function(FJPFB,bkg6b,yy3lW){

var LkR8n=this.dKPoI;

var RUgAY="?";
if(LkR8n.indexOf("?")>=0){
RUgAY="&";
}

if((this.KYSxk!=null)&&(this.KYSxk.length>0)){
LkR8n+=RUgAY+this.KYSxk+"="+escape(yy3lW);
RUgAY="&";
}

if(typeof(this.StoKO&&this.StoKO[bkg6b]!="undefined")){
if((this.WYE7X!=null)&&(this.WYE7X.length>0)){
LkR8n+=RUgAY+this.WYE7X+"="+escape(this.StoKO[bkg6b]);
RUgAY="&";
}
}


var GojrM=this.i1pUX;
GojrM=GojrM.replace(this.mOQBy,FJPFB);
GojrM=GojrM.replace(this.w1O60,LkR8n);
GojrM=GojrM.replace(this.Hk7Ev,this.hYHpX);

return(GojrM);
};



wrzrA.prototype.Ant9M=function(cRIkx,bkg6b,yy3lW,FJPFB){

var GojrM=this.BIeke(FJPFB,bkg6b,yy3lW);

var QmB0F="";
var kyHGZ=-1;
var GnJ50=bkg6b.toLowerCase();
var ajam3=cRIkx.toLowerCase();

while(cRIkx.length>0){

kyHGZ=ajam3.indexOf(GnJ50,kyHGZ+1);

if(kyHGZ<0){
QmB0F+=cRIkx;
cRIkx="";
break;
}
else{
if(cRIkx.lastIndexOf("<",kyHGZ)>cRIkx.lastIndexOf(">",kyHGZ)){
continue;
}

if(ajam3.lastIndexOf("<a",kyHGZ)>ajam3.lastIndexOf("/a>",kyHGZ)){
continue;
}

if(ajam3.lastIndexOf("<script",kyHGZ)>ajam3.lastIndexOf("/script>",kyHGZ)){
continue;
}

if(kyHGZ>0){
var NjM7j=cRIkx.charAt(kyHGZ-1);
this.I26F8.lastIndex=0;
if(this.I26F8.test(NjM7j)==false){
continue;
}
}
if((kyHGZ+bkg6b.length)<cRIkx.length){
var zxd2T=cRIkx.charAt(kyHGZ+bkg6b.length);
this.I26F8.lastIndex=0;
if(this.I26F8.test(zxd2T)==false){
continue;
}
}

QmB0F+=cRIkx.substring(0,kyHGZ)+GojrM+cRIkx.substr(kyHGZ,bkg6b.length)+this.lkTLu;

cRIkx=cRIkx.substr(kyHGZ+bkg6b.length);

if(this.olaLM!="all"){
QmB0F+=cRIkx;
break;
}

ajam3=cRIkx.toLowerCase();
kyHGZ=-1;
}
}

return(QmB0F);
};


wrzrA.prototype.Q3MD7=function(euksN,sID,bkg6b,yy3lW){

if(euksN==null){
return(false);
}

if((sID==null)||(sID.length==0)){
return(false);
}

if((bkg6b==null)||(bkg6b.length==0)){
return(false);
}

if((yy3lW==null)||(yy3lW.length==0)){
return(false);
}

var Og0XZ=euksN.getElementById(sID);
if(Og0XZ==null){
return(false);
}

var FJPFB="keyword_"+bkg6b+"_"+sID;

if(this.olaLM!="all"){
var VW2LY=euksN.getElementsByName(FJPFB);
if(VW2LY&&(VW2LY.length>0)){return(false);}
}

var EiJDB=Og0XZ.innerHTML;
EiJDB=this.Ant9M(EiJDB,bkg6b,yy3lW,FJPFB);
Og0XZ.innerHTML=EiJDB;


var AN27m=euksN.getElementsByName(FJPFB);
for(var kyHGZ=0;kyHGZ<AN27m.length;kyHGZ++){

var qW4zb="";
var onumD=AN27m[kyHGZ].parentNode;
if(onumD){

if(window.getComputedStyle){
qW4zb=window.getComputedStyle(onumD,null).color;
}
else if(onumD.currentStyle){
qW4zb=onumD.currentStyle.color;
}
}

if(qW4zb!=""){
AN27m[kyHGZ].style.color=qW4zb;
}
}

return(true);
};


wrzrA.prototype.asynchProcessCall=function(){

this.avLcR=-1;

if((typeof(this.pDKBk.objTimerControl)!="undefined")&&(typeof(this.pDKBk.objTimerControl.cxDNV)!="undefined")&&(this.pDKBk.objTimerControl.cxDNV(this.PX4Tu)>0)){
this.avLcR=window.setTimeout("try{TTKeywordUtils.asynchProcessCall();}catch(e){}",this.vqTKi);
}
else{
if(!this.GC_LQ||(this.GC_LQ.length==0)){
return;
}

var JPtLH=this.GC_LQ.shift();
if(JPtLH){
this.Q3MD7(JPtLH.euksN,JPtLH.sID,JPtLH.bkg6b,JPtLH.yy3lW);
}

this.MWZZQ();
}
};

