
(function(base,win){if('object'!=typeof base.linker)
base.linker={};var linker=base.linker;linker.base=base;linker.win=win;linker.extend=function(dst,src,force,deep,map){if((null===dst)||(('object'!==typeof dst)&&('function'!==typeof dst)))
dst={};if((null===src)||(('object'!==typeof src)&&('function'!==typeof src)))
return dst;force=force||false;deep=deep||false;map=map||false;for(var name in src){if(deep||src.hasOwnProperty(name)){if(force||('undefined'===typeof dst[name]))
dst[name]=map?map(src[name],name,dst):src[name];}}
return dst;};linker.extend(linker,{NAME:"Linker Base",VERSION:"1.1"});linker.extend(linker,{modules:{},processDocument:null,processWindow:null,url:null,is_button:false,is_plugin:false,application:"",version:"",siteid:"",ERIK:false,oldEvent:null,base_url:"",nphflags:"000000A",xmlhttp:null,lastIndex:0,useChecksum:true,IndexingReady:false,indexed:false});linker.extend(linker,{getModuleScript:function(name){name=name.split('.',2)[0];return"wikifier_"+name+".js";},loadModuleScript:function(name){var script=base.document.createElement("script");script.type="text/javascript";script.src=linker.getModuleScript(name);base.document.getElementsByTagName("head")[0].appendChild(script);return true;},hasModule:function(name){return!!linker.modules[name];}});linker.extend(linker,(function(){var timeout=null;var loading={};var loaded={};return{checkModules:function(){inner:for(var name in loaded){var deps=loaded[name].deps;for(var i=0,n=deps.length;i<n;++i){if(!linker.modules[deps[i]]){linker.loadModule(deps[i]);continue inner;}}
module=name.split('.',2)[0];if("object"!==typeof linker[module])
linker[module]={};loaded[name].init.call(linker[module],linker,linker[module]);linker.modules[name]=true;delete loaded[name];arguments.callee();}},isLoaded:function(){for(var name in loading){if(!loading.hasOwnProperty(name))
continue;return false;}
for(var name in loaded){if(!loaded.hasOwnProperty(name))
continue;return false;}
return true;},loadModule:function(name){if(loaded[name]||loading[name]||linker.modules[name])
return true;if(!linker.loadModuleScript(name))
return false;loading[name]=true;return true;},addModule:function(name,deps,init){if(loaded[name]||linker.modules[name])
return;if(!init&&"function"===typeof deps){init=deps;deps=[];}else if(deps&&!(deps instanceof Array)){deps=[deps];}
loaded[name]={deps:deps,init:init};if(loading[name])
delete loading[name];if(!timeout){linker.win.setTimeout(function(){timeout=null;linker.checkModules();},0);}}};})());linker.extend(linker,{init:function(context){linker.processWindow=context;linker.processDocument=context.document;linker.url=context.location.href;linker.utils.fireLinkerEvent("linkerInit");},initpage:function(context,version,application){linker.version=version||"";linker.application=application||"";linker.is_plugin=/^plugin/.test(linker.version);linker.is_button=/^button/.test(linker.version);linker.siteid=(linker.application||(linker.is_button?"ANY":""))+"_"+linker.version;linker.init(context);linker.utils.fireLinkerEvent("linkerPageInit");},wikify:function(){return!linker.is_plugin;},wikifyplugin:function(){return linker.is_plugin;},wikifybutton:function(){return linker.is_button;},wikifyany:function(){return linker.is_plugin||linker.state.options.parsing.other;},wikifypath:function(url){if(linker.is_plugin)
return Wikify.pluginURI(url);else
return HOST.replace(/\/$/,"")+"/"+url.replace(/^\//,"");},getNavigationWindow:function(){if(linker.is_button)
return linker.win;else if(linker.is_plugin)
return Wikify;else
return linker.win.frames["navigationframe"]||linker.win;},getNavigationDocument:function(){if(linker.is_button)
return linker.win.document;else if(linker.is_plugin)
return Wikify.getDocument();else
return linker.win.frames["navigationframe"]&&linker.win.frames["navigationframe"].document||linker.win.document;}});})(this['global']||this,window);function GetServerName(url){if(linker&&linker.utils)
return linker.utils.getServerName(url);}
function GetPathName(url){if(linker&&linker.utils)
return linker.utils.getPathName(url);}
function GetIndexOffset(el){if(linker&&linker.parsing)
return linker.parsing.getIndexOffset(el);}
function getTextValue(node,include,offset,clear,index,ahref){if(!node)
return"";if(clear)
linker.parsing.init();if(index)
linker.parsing.indexNode(node);return linker.parsing.getText(node);}
function StoreIndexRequest(text,offset){if(linker&&linker.indexing)
linker.indexing.indexText(text,null,offset);}
function getElementsById(processDocument,idName){if(linker&&linker.utils)
return linker.utils.getElementsById(idName,processDocument);}
function RemoveProxyInfo(url){if(linker&&linker.parsing)
linker.parsing.removeProxyInfo(url);}
function openRelatedAuthors(){if(linker&&linker.ui)
linker.ui.openRelatedAuthors();}
function openRelatedPublications(){if(linker&&linker.ui)
linker.ui.openRelatedPublications();}
function openHelp(){if(linker&&linker.ui)
linker.ui.openHelp();}
function initpage(aContentWindow,plugin){if(linker)
linker.initpage(aContentWindow,plugin);}
function changeHighlight(){if(linker&&linker.highlighting)
linker.highlighting.changeHighlight();}
function SiteSpecificHandling(aWindow){if(linker&&linker.parsing)
linker.parsing.SiteSpecificHandling(aWindow);}
function WriteDebugLine(aText,e){if(linker&&linker.log)
linker.log.debug(aText,e);}
function showPB(msg){if(linker&&linker.log)
linker.log.progress(msg);}
function hidePB(){if(linker&&linker.log)
linker.log.progress();}
var nphflags="000000A";var NrRequests=0;function IsGooglePatentsPage(url){return url.indexOf("www.google.com/patents")!=-1;}
function IsGooglePage(url){return GetServerName(url).indexOf("www.google")!=-1;}
function IsGoogleScholarPage(url){var serverURL=GetServerName(url);return serverURL.indexOf("scholar.google")!=-1;}
function IsYahooPage(url){return GetServerName(url).indexOf("search.yahoo")!=-1;}
function IsYahooDir(url){return GetServerName(url).indexOf("dir.yahoo")!=-1;}
function IsNIHGrant(url){return(url.indexOf("http://grants.nih.gov/grants/guide/rfa-files")!=-1)||(url.indexOf("http://grants.nih.gov/grants/guide/pa-files")!=-1);}
function IsCRISP(url){return(url.indexOf("http://report.nih.gov/CRISP.aspx")!=-1)||(url.indexOf("http://crisp.cit.nih.gov/crisp/CRISP_LIB.getdoc")!=-1);}
function IsPortalPage(url){metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="Knewco Inc"){return true;}}}
return false;}
function IsPloSOnePage(url){metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="PLOSONE"){return true;}}}
return(url.match(/www.plosone.org/)!==null);}
function IsTestPage(url){return(url.match(/www.minednow.com\/bmc/)!==null);}
function IsWikiProtein(url){return((url.match(/test.wikiprofessional.org\/proteins/)!==null)||(url.match(/proteins.wikiprofessional.org/)!==null)||(url.match(/proteins.wikiprofessional-staging.org/)!==null)||(url.match(/knewcoweb6.inetu.net/)!==null)||(url.match(/www.wikiproteins.org/)!==null));}
function IsDuchenneCommunity(url){metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="Duchenne"){return true;}}}
var res=url.match(/duchenne-community/);return(res!==null);}
function IsCiteULike(url){return((url.match(/www.citeulike.org/)!==null)||(url.match(/www.minednow.com\/citeulike/)!==null));}
function IsScienceDirect(url){if(url.match(/sciencedirect\.com/))
return true;if(linker.processDocument.title.match(/\s*ScienceDirect/))
return true;return false;}
function ProcessScienceDirect(processDocument,text){var items=[],$=linker.jQuery;items=items.concat($('.articleTitle',processDocument).get());items=items.concat($('.articleText > p',processDocument).get());for(var i=0,n=items.length;i<n;++i)
linker.parsing.indexNode(items[i]);}
function IsSpringerLink(url){if(url.match(/springerlink.com/))
return true;if(linker.processDocument.title.match(/\s*SpringerLink/))
return true;if(linker.jQuery('meta[name=dc.publisher][content^=Springer]',linker.processDocument).length)
return true;return false;}
function ProcessSpringerLinkJournalArticle(processDocument,text){var items=[];var $=linker.jQuery;items=items.concat($('.MPReader_Profiles_SpringerLink_Content_PrimitiveHeadingControlName',processDocument).get());items=items.concat($('.CaptCont',processDocument).get());items=items.concat($('.Abstract',processDocument).get());items=items.concat($('.Keyword',processDocument).get());items=items.concat($('.Citation',processDocument).get());for(var i=0,n=items.length;i<n;++i)
linker.parsing.indexNode(items[i]);}
function ProcessSpringerLinkJournalIssue(processDocument,text){}
function ProcessSpringerLinkJournal(processDocument,text){}
function ProcessSpringerLinkOther(processDocument,text){}
function ProcessSpringerLink(processDocument,text){var heading=processDocument.getElementById('ctl00_PageHeadingLabel');if(heading){heading=linker.utils.getText(heading);if(heading.match(/Journal\s+Article/))
return ProcessSpringerLinkJournalArticle(processDocument,text);else if(heading.match(/Journal\s+Issue/))
return ProcessSpringerLinkJournalIssue(processDocument,text);else
return ProcessSpringerLinkJournal(processDocument,text);}else{return ProcessSpringerLinkOther(processDocument,text);}}
function IsResearchCrossRoadsFunding(url){return((url.match(/button_rc/)!==null)||(url.match(/www.researchcrossroads.org/)!==null)&&(url.match(/oppty_id/)!==null));}
function IsResearchCrossRoadsGrants(url){return((url.match(/www.researchcrossroads.org/)!==null)&&(url.match(/grant_id/)!==null));}
function IsResearchCrossRoadsClinicalTrials(url){return((url.match(/www.researchcrossroads.org/)!==null)&&(url.match(/trial_id/)!==null));}
function IsResearchCrossRoadsScientists(url){return((url.match(/www.researchcrossroads.org/)!==null)&&(url.match(/user_id/)!==null));}
function IsResearchCrossRoadsOrganizations(url){return((url.match(/www.researchcrossroads.org/)!==null)&&(url.match(/lqm_org_id/)!==null));}
function IsWhoHomePage(url){metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="webit_document_name"){if(metaNodes[i].content=="EN WHO home"){return true;}}}
return false;}
function IsWhoSearchResultPage(url){return url.indexOf("search.who.int/search")!=-1;}
function CloseSearchPanel(){var w=top.document.getElementById("content");w.cols="0%,100%";}
function OpenSearchPanel(){try{var w=top.document.getElementById("content");w.cols="20%,80%";}catch(e){}}
function IsSievePage(url){OpenSearchPanel();return-1;}
function IsWhoPublicationPage(url){return(url.indexOf("www.who.int/whr")!=-1)||(url.indexOf("www.who.int/publications/en/")!=-1);}
function IsWikipediaURL(url){var pattern="http://en.wikipedia.org/wiki/";return url.slice(0,pattern.length)==pattern;}
function IsAbstractPlusPubMedURL(url){return(url.indexOf("www.ncbi.nlm.nih.gov/sites/entrez")!=-1)||(url.indexOf("www.ncbi.nlm.nih.gov/pubmed")!=-1);}
function IsBioMedCentralSearchURL(url){return url.indexOf("www.biomedcentral.com/search")>=0;}
function IsBioMedCentralURL(url){try{var isHomePage=url.indexOf("www.biomedcentral.com")>=0;metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="Biomed Central"){return true;}}}
var isJournalPage=getTextValue(linker.processDocument,true,0,true).indexOf("BioMed Central home")!=-1;return(isJournalPage);}catch(e){return false;}}
function IsWikifyURL(url){return url.indexOf("www.minednow.com/minedit/test.htm")!=-1;}
function IsSearchResultPubMedPage(url){return linker.utils.getElementsByClassName(linker.processDocument,"div","rprt").length>0;}
function IsBioMedCentralFrontPage(url){return(url=="http://www.biomedcentral.com")||(url=="http://www.biomedcentral.com/");}
function IsSwissProt(url){return(url.indexOf("pir.uniprot.org")!=-1)||(url.indexOf("www.uniprot.org")!=-1);}
function IsEurRepos(url){return url.indexOf("repub.eur.nl/publications/")!=-1;}
function IsSwissProtSearchResultPage(url){return getElementsById(linker.processDocument,"results").length>0;}
function ProcessWikipedia(processDocument,text){showPB("extraction of text");var ret=getTextValue(processDocument,false,0,false,true);}
function ProcessPortalPage(processDocument,text){var ret=getTextValue(processDocument,false,0,false,true);}
function ProcessTestPage(processDocument,text){var ret=getTextValue(processDocument,false,0,false,true);}
function ProcessBioMedCentralFrontPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","bodytext");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessBioMedCentralSearchPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"span","xcitationtitle");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessBioMedCentralJournalPage(processDocument,text){var beginPoint=-1;var endPoint=-1;var featured=false;var titleNodes=processDocument.getElementsByTagName("h1");for(var d=0;d<titleNodes.length;d++){if(titleNodes[d].hasChildNodes()){showPB("extraction of text");StoreIndexRequest(titleNodes[d].childNodes[0].nodeValue,GetIndexOffset(titleNodes[d].childNodes[0]));}}
var nodes=processDocument.getElementsByTagName("a");for(var q=0;q<nodes.length;q++){for(var x=0;x<nodes[q].attributes.length;x++){if(nodes[q].attributes[x].nodeName.toLowerCase()=='name'){if(nodes[q].attributes[x].nodeValue.toLowerCase()=="abstract"){showPB("extraction of text");beginPoint=GetIndexOffset(nodes[q]);featured=false;break;}}}}
var fnodes;if(beginPoint==-1){fnodes=processDocument.getElementsByTagName("h3");for(var w=0;w<fnodes.length;w++){if(fnodes[w].hasChildNodes()){if(fnodes[w].childNodes[0].nodeValue=="Abstract"){showPB("extraction of text");beginPoint=GetIndexOffset(fnodes[w].childNodes[0]);featured=true;break;}}}}
if(featured){fnodes=processDocument.getElementsByTagName("a");for(var r=0;r<fnodes.length;r++){for(var z=0;z<fnodes[r].attributes.length;z++){if(fnodes[r].attributes[z].nodeName.toLowerCase()=="name"){showPB("extraction of text");if(fnodes[r].attributes[z].nodeValue.toLowerCase()=="refs"){endPoint=GetIndexOffset(fnodes[r]);break;}}}
if(endPoint>-1){break;}}}
if(endPoint==-1){var bnodes=linker.utils.getElementsByClassName(processDocument,"*","bottommessage");if(bnodes.length>0){showPB("extraction of text");endPoint=GetIndexOffset(bnodes[0]);}}
if((beginPoint>-1)&&(endPoint>-1)){abstractTexts=processDocument.getElementsByTagName("p");for(var t=0;t<abstractTexts.length;t++){var abstractPos=GetIndexOffset(abstractTexts[t]);if((abstractPos>beginPoint)&&(abstractPos<endPoint)){if(abstractTexts[t].hasChildNodes()){showPB("extraction of text");try{for(var c=0;c<abstractTexts[t].childNodes.length;c++){if(abstractTexts[t].childNodes[c].nodeType==3){StoreIndexRequest(abstractTexts[t].childNodes[c].nodeValue,GetIndexOffset(abstractTexts[t].childNodes[c]));}
else if(abstractTexts[t].childNodes[c].nodeType==1){var res=getTextValue(abstractTexts[t].childNodes[c],true,GetIndexOffset(abstractTexts[t].childNodes[c]),false,true);}}}catch(e){}}}}}}
function emptyPubMedCallback(responseText){url=HOST+"/however.htm?titlebar=0&text="+responseText;elt=linker.processDocument.getElementById("ViewPanel");if(elt!==null){node=linker.processDocument.createElement('iframe');node.setAttribute('src',url);node.setAttribute('width','100%');node.setAttribute('height','600px');node.setAttribute('frameBorder','0');node.className='wikihighlight';node.id="input node";elt.appendChild(node);}
var height=linker.processDocument.body.clientHeight-160;var width=linker.processDocument.body.clientWidth-160;}
function callEmptyPubMedResult(searchText){}
function ProcessPubMedAbstract(processDocument,text){if(IsEmptyResultPage(processDocument,text)){callEmptyPubMedResult(processDocument.getElementById("term").value);return false;}
if(text.indexOf(", enter one or more search terms.")!=-1){return false;}
showPB("extraction of text");getTextValue(processDocument,false,0,true);var abstractsTexts=linker.utils.getElementsByClassName(processDocument,"*","abstract");if(abstractsTexts.length>0){for(var d=0;d<abstractsTexts.length;d++){showPB("extraction of text");if(abstractsTexts[d].hasChildNodes()){for(var c=0;c<abstractsTexts[d].childNodes.length;c++){if(abstractsTexts[d].childNodes[c].nodeType==1){if(abstractsTexts[d].childNodes[c].tagName.toLowerCase()=="h2"){StoreIndexRequest(abstractsTexts[d].childNodes[c].childNodes[0].nodeValue,GetIndexOffset(abstractsTexts[d].childNodes[c].childNodes[0]));}}
else if(abstractsTexts[d].childNodes[c].nodeType==3){StoreIndexRequest(abstractsTexts[d].childNodes[c].nodeValue,GetIndexOffset(abstractsTexts[d].childNodes[c]));}}}}}
else{abstractsTexts=linker.utils.getElementsByClassName(processDocument,"dd","title");for(var i=0;i<abstractsTexts.length;i++){showPB("extraction of text");getTextValue(abstractsTexts[i],true,GetIndexOffset(abstractsTexts[i]),false,true);}}
return true;}
function ProcessEurReposPage(processDocument,text){nodes=linker.utils.getElementsByClassName(processDocument,"div","header");for(var k=0;k<nodes.length;k++){showPB("extraction of text");getTextValue(nodes[k],true,GetIndexOffset(nodes[k]),false,true);}
nodes=linker.utils.getElementsByClassName(processDocument,"div","author");for(var n=0;n<nodes.length;n++){if(nodes[n].hasChildNodes()){try{if(nodes[n].childNodes[0].nodeValue=="Abstract:"){var nextnode=getNextSibling(nodes[n]);if(nextnode!==null){var pnodes=nextnode.getElementsByTagName("p");for(var p=0;p<pnodes.length;p++){showPB("extraction of text");getTextValue(pnodes[p],true,GetIndexOffset(pnodes[p]),false,true);}}}}catch(e){}}}}
function getNextSibling(node){endBrother=node.nextSibling;while((endBrother!==null)&&(endBrother.nodeType!=1)){endBrother=endBrother.nextSibling;}
return endBrother;}
function ProcessSwissProtSearchResultPage(processDocument,text){var elts=getElementsById(processDocument,"results");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessGoogleResultPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","s");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true,false);}}
function ProcessGooglePatentPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","patent_bibdata");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i].previousSibling,true,GetIndexOffset(elts[i].previousSibling),false,true);}
elts=getElementsById(processDocument,"patent_claims");for(var k=0;k<elts.length;k++){showPB("extraction of text");getTextValue(elts[k],true,GetIndexOffset(elts[k]),false,true);}}
function ProcessGooglePatentsResultPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"td","volumetabspace");if(elts.length>0){ProcessGooglePatentPage(processDocument);}
else{elts=linker.utils.getElementsByClassName(processDocument,"a","big");for(var i=0;i<elts.length;i++){showPB("extraction of text");var node=elts[i].parentNode;for(var f=0;f<node.childNodes.length;f++){if(node.childNodes[f].nodeName=="FONT"){for(var k=0;k<node.childNodes[f].childNodes.length;k++){if(node.childNodes[f].childNodes[k].nodeName!="FONT"){getTextValue(node.childNodes[f].childNodes[k],true,GetIndexOffset(node.childNodes[f].childNodes[k]),false,true);}}}}}}}
function ProcessYahooResultPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","abstr");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessYahooDirPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","st");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessWikiProteinPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"*","text");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}
elts=linker.utils.getElementsByClassName(processDocument,"*","term");for(var k=0;k<elts.length;k++){showPB("extraction of text");getTextValue(elts[k],true,GetIndexOffset(elts[k]),false,true);}}
function ProcessGoogleScholarResultPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"p","g");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessDuchenneCommunity(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","k_1");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessWhoHomePage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"span","homepageBlurb");for(var i=0;i<elts.length;i++){showPB("extraction of text");try{getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}catch(e){WriteDebugLine("error retrieving text");}
node=elts[i].nextSibling;while(node!==null){if(node.nodeType==3){getTextValue(node,true,GetIndexOffset(node),false,true);break;}
node=node.nextSibling;}}}
function ProcessSievePage(processDocument,text){}
function ProcessCiteULike(processDocument,text){var elts=getElementsById(processDocument,"abstract-body");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessResearchCrossRoads(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","article-content");for(var i=0;i<elts.length;i++){showPB("extraction of text");try{getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}catch(e){WriteDebugLine("error retrieving text");}}}
function ProcessResearchCrossRoadsOrganizations(processDocument,text){ProcessResearchCrossRoads(processDocument,text);}
function ProcessResearchCrossRoadsScientists(processDocument,text){ProcessResearchCrossRoads(processDocument,text);}
function ProcessResearchCrossRoadsClinicalTrials(processDocument,text){ProcessResearchCrossRoads(processDocument,text);}
function ProcessResearchCrossRoadsFunding(processDocument,text){ProcessResearchCrossRoads(processDocument,text);}
function ProcessResearchCrossRoadsGrants(processDocument,text){ProcessResearchCrossRoads(processDocument,text);}
function ProcessWhoSearchResultPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"a","rtitle");for(var i=0;i<elts.length;i++){var node=elts[i];while((node!==null)&&(node.tagName.toLowerCase()!="span")){node=node.nextSibling;}
if(node!==null){showPB("extraction of text");getTextValue(node,true,GetIndexOffset(node),false,true);}}}
function ProcessWhoPublicationPage(processDocument,text){var elts=processDocument.getElementsByTagName("h5");for(var i=0;i<elts.length;i++){if(elts[i].innerHTML.toLowerCase()=="main content"){var node=elts[i].parentNode;while(node!==null){if((node.nodeType==1)&&(node.tagName.toLowerCase()=="table")){break;}
node=node.nextSibling;}
if(node!==null){showPB("extraction of text");getTextValue(node,true,GetIndexOffset(node),false,true);}
break;}}}
function ProcessWikifierPage(processDocument,text){showPB("extraction of text");getTextValue(processDocument,false,0,false,true);return linker.is_wikifyplugin;}
function ProcessSwissProtProteinPage(processDocument,text){nodes=linker.utils.getElementsByClassName(processDocument,"td","first-column");for(var d=0;d<nodes.length;d++){tdNode=nodes[d].parentNode.childNodes[1];if((tdNode!==null)&&(tdNode.hasChildNodes())){showPB("extraction of text");try{StoreIndexRequest(tdNode.childNodes[0].nodeValue,GetIndexOffset(tdNode.childNodes[0]));}catch(e){GetIndexOffset(tdNode.childNodes[0]);}
var pnodes=tdNode.getElementsByTagName("p");for(var p=0;p<pnodes.length;p++){getTextValue(pnodes[p],true,GetIndexOffset(pnodes[p]),false,true);}}}}
function IsEmptyResultPage(processDocument,text){var elt=processDocument.getElementById("pink_msg");return((elt!==null)?text.indexOf("No items found.")!=-1:false);}
function ProcessSearchResultPubMedPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","rprt");for(var i=0;i<elts.length;i++){var titles=linker.utils.getElementsByClassName(elts[i],"p","title");for(var j=0;j<titles.length;j++){showPB("extraction of text");getTextValue(titles[j],true,GetIndexOffset(titles[j]),false,true);}}}
function ProcessWikiPediaPage(processDocument,text){showPB("extraction of text");var content=processDocument.getElementById("bodyContent");getTextValue(content,true,GetIndexOffset(content),false,true);}
function ProcessCRISPPage(processDocument,text){var elts=processDocument.getElementsByTagName("p");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessNIHGrant(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"span","regulartext");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsVHLHomePage(url){var metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="VHL"){return true;}}}
return((url=="http://pesquisa.bvsalud.org/regional/index.php")||(url=="http://pesquisa.bvsalud.org/regional/")||(url=="http://pesquisa.homolog.bvs.br/regional/index.php")||(url=="http://pesquisa.homolog.bvs.br/regional/"));}
function IsVHL(url){return(url.indexOf("http://pesquisa.bvsalud.org/regional/resources/")>=0)||(url.indexOf("http://pesquisa.homolog.bvs.br/regional/resources/")>=0);}
function ProcessVHL(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessVHLHomePage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsGHLHomePage(url){return((url=="http://pesquisa.bvsalud.org/ghl/index.php")||(url=="http://pesquisa.bvsalud.org/ghl/")||(url=="http://pesquisa.homolog.bvs.br/ghl/index.php")||(url=="http://pesquisa.homolog.bvs.br/ghl/"));}
function IsGHL(url){return(url.indexOf("http://pesquisa.bvsalud.org/ghl/resources/")>=0)||(url.indexOf("http://pesquisa.homolog.bvs.br/ghl/resources/")>=0);}
function ProcessGHL(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function ProcessGHLHomePage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsEvidencePortalHomePage(url){return((url=="http://evidences.bvsalud.org/modules/dia/index.php")||(url=="http://evidences.bvsalud.org/modules/dia/")||(url=="http://evidences.homolog.bvs.br/modules/dia/index.php")||(url=="http://evidences.homolog.bvs.br/modules/dia/"));}
function ProcessEvidencePortalHomePage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsTelehealthPortalHomePage(url){return((url=="http://pesquisa.bvsalud.org/telessaude/"))||((url=="http://pesquisa.homolog.bvs.br/telessaude/"));}
function ProcessTelehealthPortalHomePage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsInfectiousDiseasesPortalHomePage(url){return((url=="http://tropika.globalhealthlibrary.net/modules/dia/index.php"));}
function ProcessInfectiousDiseasesPortalHomePage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsVirtualCampusPortalHomePage(url){return((url=="http://pesquisa.bvsalud.org/cvsp/index.php")||(url=="http://pesquisa.homolog.bvs.br/cvsp/index.php"));}
function ProcessVirtualCampusPortalHomePage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","description");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsScieloEnglishFulltext(url){WriteDebugLine("IsScieloEnglishFulltext( "+url+" )");var metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if((metaNodes[i].content=="SCIELO")||(metaNodes[i].content=="SCIELOFULL")){return true;}}}
var status=((url.indexOf("http://www.scielo.br/scielo.php?script=sci_arttext")!=-1)&&(url.indexOf("lng=en")!=-1))||((url.indexOf("http://www.homolog.scielo.br/scielo.php?script=sci_arttext")!=-1)&&(url.indexOf("lng=en")!=-1))||((url.indexOf("http://www.minednow.com/scielo")!=-1)||((url.indexOf("69.64.173.229/scielo")!=-1)));return status;}
function ProcessScieloPortugesFulltext(processDocument,text){alert("Um erro interno ocorreu e não é possível mostrar os destaques semânticos para esse artigo.");}
function ProcessPloSOnePage(processDocument,text){var elts=processDocument.getElementsByTagName("h1");for(var i=0;i<elts.length;i++){WriteDebugLine("processing elt "+i);if(elts[i].getAttribute("xpathlocation")==="noSelect"){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);break;}}
elts=processDocument.getElementsByTagName("p");for(var k=0;k<elts.length;k++){var attribute=elts[k].getAttribute("xpathlocation");if(attribute!==null){if(attribute.indexOf("/p[")!=-1){showPB("extraction of text");getTextValue(elts[k],true,GetIndexOffset(elts[k]),false,true);}}}}
function getPreviousSibling(node){var previousSibling=-1;for(var i=0;i<node.parentNode.childNodes.length;i++){if(node.parentNode.childNodes[i]===node){if(previousSibling!=-1){return node.parentNode.childNodes[previousSibling];}
else{return null;}}
if(node.parentNode.childNodes[i].nodeType==1){previousSibling=i;}}
return null;}
function ProcessScieloEnglishFulltext(processDocument,text){var foundTypeArticle=-1;WriteDebugLine("ProcessScieloEnglishFulltext()");if(foundTypeArticle==-1){elts=processDocument.getElementsByTagName("blockquote");if(elts.length>0){var prevNode=getPreviousSibling(elts[0]);if((prevNode!==null)&&(prevNode.tagName.toLowerCase()==="h4")){if(elts[0].childNodes.length>0){for(var i=0;i<elts[0].childNodes.length;i++){if(elts[0].childNodes[i].nodeType==1){var elt=elts[0].childNodes[i];showPB("extraction of text");foundTypeArticle=1;getTextValue(elt,true,GetIndexOffset(elt),false,true);break;}}}}}}
if(foundTypeArticle==-1){var elts=processDocument.getElementsByTagName("a");for(var j=0;j<elts.length;j++){if((elts[j].name==="cend")||(elts[j].name==="tx")||(elts[j].name==="topo")||(elts[j].name==="titulo")||(elts[j].name==="home")){elt=elts[j].parentNode;showPB("extraction of text");foundTypeArticle=0;getTextValue(elt,true,GetIndexOffset(elt),false,true);break;}}}
if(foundTypeArticle==-1){elts=processDocument.getElementsByTagName("h4");var startPos=-1;if(elts.length>0){for(var k=0;k<elts.length;k++){if(elts[k].id==="doi"){startPos=GetIndexOffset(elts[k]);break;}}
if(startPos!=-1){var ps=processDocument.getElementsByTagName("p");for(var l=0;l<ps.length;l++){if(GetIndexOffset(ps[l])>startPos){showPB("extraction of text");foundTypeArticle=2;getTextValue(ps[l],true,GetIndexOffset(ps[l]),false,true);break;}}}}}
WriteDebugLine("foundTypeArticle = "+foundTypeArticle);if(foundTypeArticle===0){ProcessScieloEnglishFullTextNew(processDocument,text);}
else if(foundTypeArticle==1){ProcessScieloEnglishFullTextOld(processDocument,text);}
else if(foundTypeArticle==2){ProcessScieloEnglishFullTextOldType2(processDocument,ps);}
else{alert("The structure of the article is not recognized. It is not possible to show semantic highlights for this article.");}}
function ProcessScieloEnglishFullTextOldType2(processDocument,ps){var startPos=-1;for(var i=0;i<ps.length;i++){if(ps[i].innerHTML.indexOf("RESUMO")!=-1){break;}
if(ps[i].innerHTML.indexOf("SUMMARY")!=-1){startPos=GetIndexOffset(ps[i]);}
if(startPos!=-1){if(GetIndexOffset(ps[i])>=startPos){showPB("extraction of text");getTextValue(ps[i],true,GetIndexOffset(ps[i]),false,true);}}}}
function ProcessScieloEnglishFullTextOld(processDocument,text){var elts=processDocument.getElementsByTagName("blockquote");if(elts.length>0){var pElts=elts[0].getElementsByTagName("p");for(var i=4;i<pElts.length;i++){showPB("extraction of text");getTextValue(pElts[i],true,GetIndexOffset(pElts[i]),false,true);}}}
function ProcessScieloEnglishFullTextNew(processDocument,text){var endOffset=-1;var bs=processDocument.getElementsByTagName("font");for(var i=bs.length-1;i>=0;i--){if(bs[i].innerHTML.toLowerCase()==="resumo"){endOffset=GetIndexOffset(bs[i]);break;}}
bs=processDocument.getElementsByTagName("b");if(endOffset==-1){for(var j=bs.length-1;j>=0;j--){if(bs[j].innerHTML.toLowerCase()==="resumo"){endOffset=GetIndexOffset(bs[j]);break;}}}
bs=processDocument.getElementsByTagName("p");if(endOffset==-1){for(var k=bs.length-1;k>=0;k--){if(bs[k].innerHTML.toLowerCase()==="resumo"){endOffset=GetIndexOffset(bs[k]);break;}}}
if(endOffset==-1){for(var l=bs.length-1;l>=0;l--){if(bs[l].innerHTML.toLowerCase()==="references"){endOffset=GetIndexOffset(bs[l]);break;}}}
var hrs=processDocument.getElementsByTagName("hr");WriteDebugLine("hrs = "+hrs.length);var beginOffset;var offset;var elts;if(hrs.length>0){beginOffset=GetIndexOffset(hrs[0]);elts=processDocument.getElementsByTagName("p");for(var m=0;m<elts.length;m++){offset=GetIndexOffset(elts[m]);if(offset>beginOffset){if((endOffset==-1)||(offset<endOffset)){showPB("extraction of text");getTextValue(elts[m],true,offset,false,true);}}}}
else{elts=processDocument.getElementsByTagName("p");beginOffset=-1;for(var v=0;v<elts.length;v++){if(elts[v].innerHTML.indexOf("SUMMARY")!=-1){beginOffset=GetIndexOffset(elts[v]);}
if(beginOffset!=-1){offset=GetIndexOffset(elts[v]);if(offset>=beginOffset){if((endOffset==-1)||(offset<endOffset)){showPB("extraction of text");getTextValue(elts[v],true,offset,false,true);}}}}}
return;}
function getParentTag(elt,tag){if(elt!==null){if(elt.nodeType==1){if(elt.tagName.toLowerCase()===tag){return elt;}
else{return getParentTag(elt.parentNode,tag);}}}
return null;}
function IsScieloEnglishPage(url){var metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="SCIELO"){return true;}}}
var status=((url.indexOf("http://www.scielo.br/scielo.php?script=sci_abstract")!=-1)&&(url.indexOf("lng=en")!=-1))||((url.indexOf("http://www.homolog.scielo.br/scielo.php?script=sci_abstract")!=-1)&&(url.indexOf("lng=en")!=-1));return status;}
function ProcessScieloEnglishPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","content");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsScieloPage(url){var metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="SCIELO_POR"){return true;}}}
return(url.indexOf("http://www.scielo.br/scielo.php")!=-1);}
function ProcessScieloPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","content");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsSienceblogPage(url){if(url.indexOf("http://scienceblogs.com")!==-1)
return true;var elts=linker.utils.getElementsByClassName(linker.processDocument,"div","footer");for(var i=0;i<elts.length;i++){if(getTextValue(elts[i],false,0,false,false).indexOf("ScienceBlogs")!==-1)
return true;}
return false;}
function ProcessSienceblogPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"div","blogMain");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}}
function IsConceptWebPage(url){metaNodes=linker.processDocument.getElementsByTagName("meta");for(var i=0;i<metaNodes.length;i++){if(metaNodes[i].name=="dc.publisher"){if(metaNodes[i].content=="ConceptWeb"){return true;}}}
return false;}
function ProcessConceptWebPage(processDocument,text){var elts=linker.utils.getElementsByClassName(processDocument,"span","pub-source-title-body");for(var i=0;i<elts.length;i++){showPB("extraction of text");getTextValue(elts[i],true,GetIndexOffset(elts[i]),false,true);}
elts=linker.utils.getElementsByClassName(processDocument,"span","annotation-body");for(var k=0;k<elts.length;k++){showPB("extraction of text");getTextValue(elts[k],true,GetIndexOffset(elts[k]),false,true);}}
function IsURLToEnrich(processDocument,url){for(var i=0;i<SourceInfo.length;i++){var obj=Object(SourceInfo[i]);if(("undefined"!==typeof obj.c)&&(null!==obj.c)){if("string"===typeof obj.c){var f;try{f=eval(obj.c);}catch(e){WriteDebugLine("Error while calling url check function",e);return false;}
if(f(url)){return obj.i;}}else{if(obj.c(url))
return obj.i;}}
else{if(obj.u==url){return obj.i;}}}
if(linker.wikifyany()){return-2;}else{var referrerURL=RemoveProxyInfo(processDocument.referrer);if(IsGoogleScholarPage(referrerURL)){return-2;}
else{return-1;}}}
function ProcessPage(processDocument,id){for(var i=0;i<SourceInfo.length;i++){var obj=Object(SourceInfo[i]);if((obj.i==id)&&("undefined"!==typeof obj.p)&&(null!==obj.p)){showPB("extract text from page");var text=getTextValue(processDocument,false,0,true);if("string"===typeof obj.p){var f;try{f=eval(obj.p);}catch(e){WriteDebugLine("Error finding parser function",e);}
f(processDocument,text);}else{obj.p(processDocument,text);}
break;}}
if((id==-2)||(linker.state.options.parsing.empty&&(0===linker.parsing.IndexNodeQueue.length)&&(0===linker.indexing.IndexTextQueue.length))){ProcessWikifierPage(processDocument,"");return true;}else if(id==-1){return false;}
return true;}
function modifyURL(url){return url.replace(/http:\/\//,"http/");}
function createGroups(plugin){var groups={};var order=1;var maxorder=0;var obj;for(var k=0;k<SourceInfo.length;k++){obj=Object(SourceInfo[k]);if(obj.o>maxorder)
maxorder=obj.o;}
while(order<=maxorder){for(var i=0;i<SourceInfo.length;i++){obj=Object(SourceInfo[i]);if(obj.o==order){if(obj.s!==""){var value;if(plugin)
value=obj.u;else{if(obj.i!=-1){if((obj.i==8)||(obj.i==20)||(obj.i==16)||(obj.i==41)||(obj.i==42)||(obj.i==43)||(obj.i==44)||(obj.i==46)||(obj.i==47)||(obj.i==48)||(obj.i==30)||(obj.i==31)||(obj.i==32)||(obj.i==33)||(obj.i==34)){value=linker.base_url+"nph-proxy.cgi/000000A/"+modifyURL(obj.u);}
else{value=linker.base_url+"nph-proxy.cgi/"+nphflags+"/"+modifyURL(obj.u);}}
else
value=obj.u;}
if("undefined"===typeof obj.g)
obj.g='';if("undefined"===typeof groups[obj.g]){groups[obj.g]=[];}
groups[obj.g].push({'label':obj.l,'value':value});}
break;}}
order+=1;}
return groups;}
function AddSources(adocument,elt,plugin){for(var i=elt.childNodes.length-1;i>=0;i--){elt.removeChild(elt.childNodes[i]);}
groups=createGroups(plugin);createMenuItem(adocument,elt,"Optimized websites",PORTAL,"wikifier-disabled","false");for(key in groups){if(("array"!==typeof groups[key])&&("object"!==typeof groups[key]))
continue;createMenuItem(adocument,elt,"",null,"wikifier-disabled","true");createMenuItem(adocument,elt,key,null,"wikifier-disabled","true");var obj=groups[key];for(i=0;i<groups[key].length;i++){var groupObj=obj[i];createMenuItem(adocument,elt,groupObj.label,groupObj.value,"source","false");}}}
function createMenuItem(adocument,parent,label,value,className,disabled){label=label.replace(/&#(\d+);/g,function(a,b){return String.fromCharCode(+b);});if(disabled=="true"){if(label===""){parent.options[parent.options.length]=new Option("",null);parent.options[parent.options.length-1].setAttribute("class",className);parent.options[parent.options.length-1].setAttribute("disabled","true");}
else{var menuitem=adocument.createElement("optgroup");menuitem.style.color="graytext";menuitem.setAttribute("label",label);menuitem.setAttribute("text",label);menuitem.setAttribute("value",value);menuitem.setAttribute("class",className);menuitem.setAttribute("disabled",disabled);parent.appendChild(menuitem);}}
else{parent.options[parent.options.length]=new Option(label,value);parent.options[parent.options.length-1].setAttribute("class",className);parent.options[parent.options.length-1].setAttribute("id",className);parent.options[parent.options.length-1].style.color="black";if(ie){parent.options[parent.options.length-1].setAttribute("disabled","false");}}}
var pixels;function jt_ProgressBar(adocument,aparent,x,y,width,height){if(width==undefined){width=getWidth(adocument,aparent)-x-10;}
if(height==undefined){height=18;}
pixels=width;var outerDIV=adocument.getElementById("progressBar");if(outerDIV===null){outerDIV=adocument.createElement("div");outerDIV.className="progressBar";outerDIV.id="progressBar";outerDIV.style.position="absolute";outerDIV.style.left=x+"px";outerDIV.style.top=y+"px";outerDIV.style.border="1px solid #456a59";outerDIV.style.background="#eff8f4";outerDIV.style.width=width+"px";outerDIV.style.height=height+"px";outerDIV.style.textAlign="left";aparent.appendChild(outerDIV);var fillDIV=adocument.createElement("div");fillDIV.style.textAlign="right";fillDIV.style.overflow="hidden";fillDIV.style.position="absolute";fillDIV.style.width="0px";if(linker.wikify()){if(ie){fillDIV.style.height=(height-4)+"px";}
else{fillDIV.style.height=(height-2)+"px";}}
else{fillDIV.style.height=(height-4)+"px";}
fillDIV.style.top="1px";fillDIV.style.left="1px";fillDIV.style.zIndex="1";fillDIV.style.background="#c8e8e0";fillDIV.style.borderwidth="0";fillDIV.style.color="#FFFFFF";outerDIV.appendChild(fillDIV);var label=adocument.createElement("label");label.style.position="absolute";label.style.overflow="hidden";label.id="progressLabel";label.style.width=(width-2)+"px";label.style.height=(height-4)+"px";label.style.fontWeight="normal";label.style.fontFamily="Arial";label.style.fontSize="9px";label.style.background="transparent";label.style.color="#639684";label.style.zIndex="5";label.style.textAlign="center";label.style.verticalAlign="middle";label.style.top='3px';label.value=" ";outerDIV.appendChild(label);label.appendChild(adocument.createTextNode(" "));}
return outerDIV;}
function setPercent(w,pct){var fillPixels;if(pct<1.0)
fillPixels=Math.round(pixels*pct);else{fillPixels=pixels;}
var fillDIV=w.childNodes[0];fillDIV.style.width=fillPixels+"px";}var horizontal_offset="9px";var vertical_offset="0";var ie=document.all;var ns6=document.getElementById&&!document.all;function showhint(menucontents,target,event,tipwidth){var scrollTop=0;var scrollLeft=0;if(!linker.processDocument.getElementById("hintbox")){createhintbox();}
dropmenuobj=linker.processDocument.getElementById("hintbox");var menu=dropmenuobj;menu.style.display='block';menu.innerHTML=menucontents;if(tipwidth!==""){menu.style.width=tipwidth;}
if(linker.processWindow.pageYOffset){scrollLeft=linker.processWindow.pageXOffset;scrollTop=linker.processWindow.pageYOffset;}
else if(linker.processDocument.documentElement&&linker.processDocument.documentElement.scrollTop){scrollLeft=linker.processDocument.documentElement.scrollLeft;scrollTop=linker.processDocument.documentElement.scrollTop;}
else if(linker.processDocument.body){scrollLeft=linker.processDocument.body.scrollLeft;scrollTop=linker.processDocument.body.scrollTop;}
var menuWidth=linker.ui.getWidth(linker.processDocument,menu);var menuHeight=linker.ui.getHeight(linker.processDocument,menu);var clientX;var clientY;if(event.clientX===0){var pos=linker.ui.getAbsolutePosition(target);clientX=pos.x+2+(target.offsetWidth*0.75)-scrollLeft;clientY=pos.y+(target.offsetHeight*0.5)-scrollTop;}
else{clientX=event.clientX;clientY=event.clientY;}
var X;var Y;if((clientX+menuWidth)>linker.ui.pageWidth(linker.processWindow,linker.processDocument)){X=clientX-menuWidth-2;}
else{X=clientX+2;}
if((clientY+menuHeight)>linker.ui.pageHeight(linker.processWindow,linker.processDocument)){Y=linker.ui.pageHeight(linker.processWindow,linker.processDocument)-menuHeight-28;if(Y<0){Y=0;}}
else{Y=clientY;}
if(event!==null){X+=scrollLeft;Y+=scrollTop;}
menu.style.display='none';menu.style.left=X+'px';menu.style.top=Y+'px';menu.style.visibility="visible";menu.style.display='block';menu.style.zIndex=19900;target.onmouseout=hidetip;}
function hidetip(e){dropmenuobj.style.visibility="hidden";dropmenuobj.style.left="-500px";}
function createhintbox(){var divblock=linker.processDocument.createElement("div");divblock.setAttribute("id","hintbox");linker.processDocument.body.appendChild(divblock);return divblock;}linker.addModule("browser",function(linker){linker.extend(this,{NAME:"Linker Browser Module",VERSION:"1.0"});linker.extend(this,(function(){var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS";},searchString:function(data){for(var i=0;i<data.length;i++){var dataString=data[i].string;var dataProp=data[i].prop;this.versionSearchString=data[i].versionSearch||data[i].identity;if(dataString){if(dataString.indexOf(data[i].subString)!=-1)
return data[i].identity;}else if(dataProp){return data[i].identity;}}
return null;},searchVersion:function(dataString){var index=dataString.indexOf(this.versionSearchString);if(index==-1)
return null;return parseFloat(dataString.substring(index+this.versionSearchString.length+1));},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();var browser={name:BrowserDetect.browser,version:BrowserDetect.version,os:BrowserDetect.OS,is_ie:BrowserDetect.browser==="Explorer",is_ff:BrowserDetect.browser==="Firefox",is_opera:BrowserDetect.browser==="Opera",is_safari:BrowserDetect.browser==="Safari",is_chrome:BrowserDetect.browser==="Chrome",is_konq:BrowserDetect.browser==="Konqueror"};browser.is_khtml=browser.is_safari||browser.is_chrome||browser.is_konq;browser.is_gecko=!browser.is_khtml&&navigator.product&&(navigator.product.toLowerCase()==="gecko");browser.is_ie6=browser.is_ie&&(parseInt(browser.version,10)===6);browser.is_ie7=browser.is_ie&&(parseInt(browser.version,10)===7);browser.is_ff2=browser.is_ff&&(parseInt(browser.version,10)===2);browser.is_ff3=browser.is_ff&&(parseInt(browser.version,10)===3);browser.is_mac=browser.os=="Mac";return browser;})());});linker.addModule("utils",function(linker,utils){linker.extend(this,{NAME:"Linker Utilites Module",VERSION:"1.1"});var extend=linker.extend;extend(this,{addEvent:function(element,type,listener,once,data){if(null===element)
return false;if(once)
linker.jQuery(element).one(type,data,listener);else
linker.jQuery(element).bind(type,data,listener);return true;},removeEvent:function(element,type,listener){if(null===element)
return false;linker.jQuery(element).unbind(type,listener);return true;},fireEvent:function(element,type,data){if(null===element)
return false;linker.jQuery(element).trigger(type,data);return true;}},true);extend(this,{addLinkerEvent:function(type,listener,once,data){return this.addEvent(linker.win,type,listener,once,data);},removeLinkerEvent:function(type,listener){return this.removeEvent(linker.win,type,listener);},fireLinkerEvent:function(type,data,silent){if(!silent&&('undefined'!==typeof DEBUG)&&DEBUG)
this.fireEvent(linker.win,'linkerDebugEvent',[type].concat(data));return this.fireEvent(linker.win,type,data);}});extend(this,(function(){var digit_pattern=/^[0-9]$/;var alpha_pattern=/^[A-Z]$/;var accession_pattern=/^[OPQ][0-9][0-9A-Z][0-9A-Z][0-9A-Z][0-9]$/;return{isDigit:function(num){return digit_pattern.test(num);},isAlpha:function(str){return alpha_pattern.test(str);},isAccessionNumber:function(Id){return accession_pattern.test(Id);}};})());extend(this,{map:function(f,list){if(!list)
return list;if('string'===typeof f){var name=f;f=function(a){a[name]();};}
if('function'===typeof list.map)
return list.map(f);if(list instanceof Array){var r=[];for(var i=0,n=list.length;i<n;++i)
r[r.length]=f(list[i]);return r;}
if('object'!==typeof list)
return list;var o={};for(var key in list){if('function'!==typeof list[key])
o[key]=f(list[key]);else
o[key]=list[key];}
return o;},hasValue:function(list,value){if('undefined'!==typeof list.indexOf)
return list.indexOf(value);for(var i=0,n=list.length;i<n;++i){if(list[i]===value)
return i;}
return-1;},intersect:function(a,b){var intersection=[];for(var i=0,n=a.length;i<n;++i){if(-1!=this.hasValue(b,a[i]))
intersection[intersection.length]=a[i];}
return intersection;},compare:function(a,b){var len=Math.min(a.length,b.length);for(var i=0;i<len;++i){if(a[i]!=b[i])
return a[i]-b[i];}
return 0;}});extend(this,(function(){var square_pattern=/^[\s\[]+|[\s\]]+$/g;var round_pattern=/^[\s\(]+|[\s\)]+$/g;var unquote_pattern=/^([\'\"])(.*)\1$/;return{trimSquare:function(str){return str.replace(square_pattern,"");},trimRound:function(str){return str.replace(round_pattern,"");},unquote:function(str){return str.replace(unquote_pattern,"$2");}};})());extend(this,(function(){var regexp=new RegExp("([0-9]{4})(-([0-9]{2})(-([0-9]{2})"+"(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?"+"(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?");return{fromISO8601:function(string){var d=string.match(regexp);var offset=0;var date=new Date(d[1],0,1);if(d[3]){date.setMonth(d[3]-1);}
if(d[5]){date.setDate(d[5]);}
if(d[7]){date.setHours(d[7]);}
if(d[8]){date.setMinutes(d[8]);}
if(d[10]){date.setSeconds(d[10]);}
if(d[12]){date.setMilliseconds(Number("0."+d[12])*1000);}
if(d[14]){offset=(Number(d[16])*60)+Number(d[17]);offset*=((d[15]=='-')?1:-1);}
offset-=date.getTimezoneOffset();time=(Number(date)+(offset*60*1000));date.setTime(Number(time));return date;}};})());extend(this,(function(){var regexp=new RegExp("^(?:([^:/?:.]+):)?(?://)?(([^:/?#]*)(?::(\\d*))?)?((/(?:[^?#](?![^?#/]*\\.[^?#/.]+(?:[\\?#]|$)))*/?)?([^?#/]*))?(?:\\?([^#]*))?(?:#(.*))?");var slash=/\/?$/;return{parseUri:function(sourceUri){var uriPartNames=["source","protocol","authority","domain","port","path","directoryPath","fileName","query","anchor"];var uriParts=regexp.exec(sourceUri);var uri={};for(var i=0,n=uriPartNames.length;i<n;++i)
uri[uriPartNames[i]]=uriParts[i]||"";if(0<uri.directoryPath.length)
uri.directoryPath=uri.directoryPath.replace(slash,"/");return uri;}};})());extend(this,{getServerName:function(url){return this.parseUri(url)["authority"];},getPathName:function(url){var pos=url.indexOf("nph-proxy.cgi");if(-1==pos)
pos=url.indexOf("pubmed.py");if(-1<pos)
url=url.slice(0,pos);return this.parseUri(url)["directoryPath"];}});extend(this,{getData:function(node,name){if(!node)
return null;if(node instanceof linker.jQuery){if(0===node.length)
return null;node=node[0];}
var value=null;try{value=linker.jQuery.data(node,'wikifier-'+name);if('undefined'===typeof value)
value=null;}catch(e){}
return value;},setData:function(node,name,value){if(!node)
throw'node is empty for setting data';if(node instanceof linker.jQuery){if(0===node.length)
return null;node=node[0];}
try{if(null===value)
linker.jQuery.removeData(node,'wikifier-'+name);else
linker.jQuery.data(node,'wikifier-'+name,value);}catch(e){}
return value;}});extend(this,{getElementsById:function(id,doc){return linker.jQuery("#"+id,doc).get();},getElementsByClassName:function(root,tagName,className){return linker.jQuery(tagName+"."+className,root).get();},isContains:function(node,parent){while(null!==node){if(node===parent)
return true;node=node.parentNode;}
return false;},isWikifierNode:function(node){while(null!==node){if(('string'==typeof node.id)&&(node.id.substr(0,9)=='wikifier-'))
return true;node=node.parentNode;}
return false;}});extend(utils,{createCookie:function(name,value,days){try{var expires="";if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}
document.cookie=name+"="+value+expires+"; path=/";}catch(e){linker.log.debug("Error while setting cookie",e);}},readCookie:function(name){var nameEQ=name+"=";try{var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)===0)
return c.substring(nameEQ.length,c.length);}}catch(e){}
return null;},eraseCookie:function(name){utils.createCookie(name,"",-1);}});extend(this,{getXMLDOM:function(text){if('string'!==typeof text)
return text;var doc;if('undefined'!==typeof DOMParser){var parser=new DOMParser();doc=parser.parseFromString(text,"text/xml");var error=false;if("parsererror"==doc.documentElement.tagName.toLowerCase()){error=doc.documentElement.firstChild.nodeValue;error=error.split(/\n/,2)[0];}
if(("html"==doc.documentElement.tagName.toLowerCase())&&("body"==doc.documentElement.firstChild.tagName.toLowerCase())&&("parsererror"==doc.documentElement.firstChild.firstChild.tagName.toLowerCase())){var node=doc.documentElement.firstChild.firstChild;if(("div"==node.childNodes[1].tagName.toLowerCase())&&(3==node.childNodes[1].firstChild))
error=node.childNodes[1].firstChild.nodeValue;else
error=node.innerHTML;}
if(error){var r=error.match(/^.*:\s+(.*)/);if(null!==r)
throw r[1];else
throw error;}
return doc;}
if('undefined'!==typeof ActiveXObject){var progIDs=['Msxml2.DOMDocument.6.0','Msxml2.DOMDocument.3.0'];for(var i=0;i<progIDs.length;i++){try{doc=new ActiveXObject(progIDs[i]);break;}
catch(e){}}
if(doc){doc.async="false";doc.loadXML(text);if(null===doc.documentElement)
throw doc.parseError.reason;}
return doc;}
return null;},GetXMLHttpRequest:function(){var req=null;if('undefined'!==typeof XMLHttpRequest){req=new XMLHttpRequest();if(req.overrideMimeType)
req.overrideMimeType('text/xml');}
if(!req&&('undefined'!==typeof ActiveXObject)){var msxmls=new Array('Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP');for(var i=0;i<msxmls.length;i++){try{req=new ActiveXObject(msxmls[i]);break;}catch(e){}}}
return req;},unescapeHTML:function(str){var node=linker.win.document.createElement('span');node.innerHTML=str;return utils.getText(node);},extractTag:function(text,startTag,endTag){var startOffset=text.indexOf(startTag);if(startOffset==-1)
return null;var endOffset=text.indexOf(endTag,startOffset+startTag.length);if(endOffset!=-1)
return[utils.unescapeHTML(text.slice(startOffset+startTag.length,endOffset)),startOffset,endOffset+endTag.length];return[utils.unescapeHTML(text.slice(startOffset+startTag.length)),startOffset,text.length];},getText:function(node){var s='';if(null===node)
return s;switch(node.nodeType){case 2:case 3:case 4:return node.nodeValue||s;case 7:case 8:return s;case 9:case 10:return arguments.callee(node.body);default:for(var i=0,n=node.childNodes.length;i<n;++i)
s+=arguments.callee(node.childNodes[i]);return s;}}});extend(this,{String:{PAD_LEFT:0,PAD_RIGHT:1,PAD_BOTH:2,pad:function(string,len,pad,type){var append=new String();len=isNaN(len)?0:len-string.length;pad=typeof(pad)=="string"?pad:" ";if(type==this.PAD_BOTH){string=this.pad(string,Math.floor(len/2)+string.length,pad,this.PAD_LEFT);return this.pad(string,Math.ceil(len/2)+string.length,pad,this.PAD_RIGHT);}
while((len-=pad.length)>0)
append+=pad;append+=pad.substr(0,len+pad.length);return(type==this.PAD_LEFT?append.concat(string):string.concat(append));}},randomInt:function(min,max){if(!isFinite(min))min=0;if(!isFinite(max))max=1;return Math.floor((Math.random()%1)*(max-min+1)+min);},UUID:{generate:function(type){switch((type||'v4').toUpperCase()){case'V4':var tl=this._randomHexString(8);var tm=this._randomHexString(4);var thav='4'+this._randomHexString(3);var cshar=utils.randomInt(0,0xFF);cshar=((cshar&~(1<<6))|(1<<7)).toString(16);var csl=this._randomHexString(2);var n=this._randomHexString(12);return tl+'-'+tm+'-'+thav+'-'+cshar+csl+'-'+n;case'NIL':return'00000000-0000-0000-0000-000000000000';default:return null;}
return(null);},_randomHexString:function(len){var random=utils.randomInt(0,Math.pow(16,len)-1);return utils.String.pad(random.toString(16),len,'0',utils.String.PAD_LEFT);}}});});linker.addModule("utils.jquery",function(linker){linker.extend(this,{NAME:"Linker Utilites jQuery Module",VERSION:"1.0"});if(!linker.jQuery)
linker.jQuery=linker.win.jQuery;(function($){$.extend({create:function(element,attributes,children){if('string'===typeof element)
element=(linker.processDocument||document).createElement(element);element=$(element);if('object'===typeof attributes)
element.attr(attributes);children=children||attributes;if(children){if('string'===typeof children){element.text(children);}else{if(children&&children.toArray)
children=children.toArray();if((children instanceof Array)||('Array'===children.constructor.name)){for(var i=0,n=children.length;i<n;++i){if('string'===typeof children[i])
element.append(arguments.callee(children[i]));else if((children[i]instanceof Array)||('Array'===children[i].constructor.name))
element.append(arguments.callee.apply(children[i]));else
element.append(children[i]);}}}}
return element;}});$.fn.extend({setClass:function(className,switcher){this.removeClass(className);if(switcher)
this.addClass(className);return this;}});$.each(['Left','Top'],function(i,name){var method='scroll'+name;$.fn[method]=function(val){if(!this[0])
return null;return undefined!==val?this.each(function(){!this.ownerDocument?(this.defaultView||this.parentWindow||this).scrollTo(!i?val:$(this.defaultView||this.parentWindow||this).scrollLeft(),i?val:$(this.defaultView||this.parentWindow||this).scrollTop()):this[method]=val;}):!this[0].ownerDocument?this[0][i?'pageYOffset':'pageXOffset']||(this[0].document||this[0]).documentElement[method]||(this[0].document||this[0]).body[method]||0:this[0][method];};});$.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){if(!this[0])
return null;return'undefined'===typeof this[0].ownerDocument?this[0].document.compatMode=="CSS1Compat"&&this[0].document.documentElement["client"+name]||this[0].document.body["client"+name]:null===this[0].ownerDocument?Math.max(this[0].documentElement["client"+name],this[0].body["scroll"+name],this[0].documentElement["scroll"+name],this[0].body["offset"+name],this[0].documentElement["offset"+name]):size===undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,typeof size==="string"?size:size+"px");};});})(linker.jQuery);});linker.addModule("utils.lazy",function(linker,utils){linker.extend(this,{NAME:"Linker Utilites Lazy Module",VERSION:"1.0"});(function(base,win){var extend=linker.extend;var slice=Array.prototype.slice;extend(base,{Lazy:function(init,assign){this._status=false;this.init=init;this.assign=assign;var self=this;this.callback=function(value,error){self._status=error||true;self._value=value;if(!error&&assign)
assign(value);};if(init)
init.call(this,this.callback);}});var Lazy=base.Lazy;extend(Lazy.prototype,{check:function(){if('boolean'===typeof this._status)
return this._status;throw this._status;},value:function(){return this._value;},wait:function(callback,interval,error,timeout){base.wait.call(base,this,callback,interval,error,timeout);}});extend(Lazy,{wait:function(list,callback,interval,error,timeout){var ft;var self=list;if(list instanceof Lazy)
list=[list];else if('function'===typeof list)
list=[new Lazy(list)];if(timeout){timeout=win.setTimeout(function(){ft&&win.clearTimeout(ft);error&&error.call(self,'timeouted');},timeout);}
(function(){ft=null;try{for(var i in list){if(list[i]instanceof Lazy){if(list[i].check()){list[i]=list[i].value();}else{ft=win.setTimeout(arguments.callee,interval||50);return;}}}}catch(e){timeout&&win.clearTimeout(timeout);error&&error.call(self,e);return;}
timeout&&win.clearTimeout(timeout);if((list instanceof win.Array)||('Array'===list.constructor.name))
callback.apply(self,list);else
callback.call(self,list);})();}});})(utils,linker.win);});linker.addModule("utils.class",function(linker,utils){linker.extend(this,{NAME:"Linker Utilites Class Module",VERSION:"1.0"});var extend=linker.extend;var slice=Array.prototype.slice;function empty(){}
if('function'!==typeof this.Class){this.Class=function(parent){if('function'===typeof parent)
return create.apply(parent,slice.call(arguments,1));else
return create.apply(null,arguments);};}
var Class=this.Class;extend(Class,{classID:0,extend:extend,inherit:function(parent,more,force,deep,map){if((null!==parent)||('object'===typeof parent)){empty.prototype=parent;parent=new empty;}
return extend(parent,more,force,deep,map);},extendObject:function(dst,src,deep,map){if((null===dst)||(('object'!==typeof dst)&&('function'!==typeof dst)))
dst={};if((null===src)||(('object'!==typeof src)&&('function'!==typeof src)))
return dst;var fmap=function(value,name,obj){if('__'===name.substr(0,2)){var old=obj[name];if('object'===typeof old){if('function'===typeof old.concat)
return old.concat(value);if(obj.hasOwnProperty(name))
return extend(old,value,true,deep,arguments.callee);return inherit(old,value,true,deep,arguments.callee);}}
return value;};return extend(dst,src,true,deep,map?function(value,name,obj){return fmap(map(value,name,obj),name,obj);}:fmap);},create:function(){return create.apply(null,arguments);}});var inherit=Class.inherit;var extendObject=Class.extendObject;var methods=Class.methods=extend(Class.methods,{name:function(name){return('undefined'!==typeof name)?this.__name=name:this.__name;},create:function(){var klass=function(){this.__initialize.apply(this,arguments);};var __super=klass.__super='function'===typeof this?this:Class.Base||null;if(__super){klass.prototype=inherit(__super.prototype);klass.__mixins=inherit(__super.__mixins);}
extend(klass,methods,true);klass.__id=++Class.classID;klass.__name='Class'+klass.__id;klass.prototype.constructor=klass;klass.__based=null;klass.__mixins=klass.__mixins||{};if(0<arguments.length)
klass=klass.extend.apply(klass,arguments);var __class=klass.prototype.__class;if(__class){extend(klass,__class);if('function'===typeof __class){klass.__based=__class;klass.__mixins[klass.getBaseID(__class)]=klass;klass.extendByObject(__class.prototype);}
delete klass.prototype.__class;}
klass.prototype.__initialize=klass.prototype.__initialize||empty;if(Base&&!klass.hasClass(Base))
klass=klass.create(Base);return klass.__based?klass.create():klass;},getBase:function(cls){var base=cls||this;while(base.__based)
base=base.__based;return base;},getBaseID:function(cls){var base=this.getBase(cls);return base.__id||base;},isClass:function(cls){return this.getBaseID()===this.getBaseID(cls);},hasClass:function(cls){var obj=inherit(this.prototype);if(obj instanceof cls)
return true;if(this.__mixins[this.getBaseID(cls)])
return true;return false;},extendByClass:function(cls){if('function'!==typeof cls)
return this;if(this.hasClass(cls))
return this;var parent=this;if(cls.__super)
parent=arguments.callee.call(this,cls.__super);return parent.create({__class:cls});},extendByObject:function(src,deep){var klass=this;extendObject(this.prototype,src,deep,function(value,name,obj){if('function'===typeof value)
return klass.method(value,name);return value;});return this;},extend:function(){var klass=this;for(var i=0;i<arguments.length;++i){if('function'===typeof arguments[i]){if(!klass.prototype.hasOwnProperty('__initialize'))
klass.prototype.__initialize=empty;klass=klass.extendByClass(arguments[i]);}else{klass.extendByObject(arguments[i],true);}}
return klass;},method:function(f,name){return extend(function(){var me=arguments.callee;var f=me.__original;f.__context=me;return f.apply(this,arguments);},{__original:f.__original||f,__class:this,__base:this.__super&&this.__super.prototype[name]||empty},true);}});var create=methods.create;var Base=Class.Base=Class({__init:[],__free:[],__initialize:function(){for(var i=0,n=this.__init.length;i<n;++i)
this.__init[i].call(this,this);},__destroy:function(){for(var i=0,n=this.__free.length;i<n;++i)
this.__free[i].apply(this);},getInstance:function(){return this;},getClass:function(){return this.constructor;},instanceOf:function(cls){return this.constructor.hasClass(cls);},instanceOfAll:function(list){for(var key in list){if(list.hasOwnProperty(key)){if(!this.instanceOf(list[key]))
return false;}}
return true;},instanceOfAny:function(list){for(var key in list){if(list.hasOwnProperty(key)){if(this.instanceOf(list[key]))
return true;}}
return false;},extend:function(place,obj){return extendObject(obj&&place||this,obj||place,true);},asClass:function(obj,cls){var instance=cls&&obj||this;if(instance instanceof(cls||obj))
return instance;if(instance.instanceOf&&instance.instanceOf(cls||obj))
return instance;return null;}});});linker.addModule("log","utils",function(linker,log){linker.extend(this,{NAME:"Linker Log Module",VERSION:"1.1"});var utils=linker.utils;linker.extend(this,{progress:function(message){utils.fireLinkerEvent("linkerProgress",[message],true);},trace:function(msg,f){try{(f||msg)();}catch(e){log.debug((f&&msg)||"error",e);}},debug:function(message,exception){utils.fireLinkerEvent("linkerDebug",[message,exception],true);if(DEBUG&&exception)
throw exception;}});utils.addLinkerEvent("linkerLogInit",function(event,log){utils.addLinkerEvent("linkerDebug",function(event,message,exception){log.debug(message,exception);});},true);utils.addLinkerEvent("linkerDebugEvent",function(event,type){log.debug("Got "+type+" event");});});linker.addModule("cache","utils",function(linker,cache){linker.extend(this,{NAME:"Linker Cache Module",VERSION:"1.1"});var utils=linker.utils;var extend=linker.extend;extend(this,{Storage:{SemanticGroups:{},SemanticTypes:{},ConceptInfos:{},CuiLists:[],Pages:{}}});extend(this,{SemanticGroup:function(name){this.name=name||'';}});extend(this.SemanticGroup,{has:function(name){return cache.Storage.SemanticGroups[name];},get:function(name){return this.has(name)||name&&this.put(new this(name))||null;},put:function(group){return cache.Storage.SemanticGroups[group.name]=group;}});extend(this.SemanticGroup.prototype,{toString:function(){return this.name;}},true);extend(this,{SemanticType:function(id,name,group){this.id=id;this.name=name||'';this.group=group&&group.name||group||'';}});extend(this.SemanticType,{has:function(id){return cache.Storage.SemanticTypes[id];},get:function(id,name,group){var type=this.has(id);if(type)
return type.adopt(name,group);return this.put(new this(id,name,group));},put:function(type){return cache.Storage.SemanticTypes[type.id]=type;}});extend(this.SemanticType.prototype,{adopt:function(name,group){this.name=name||this.name;this.group=group&&group.name||group||this.group;return this;},getGroup:function(){return cache.SemanticGroup.get(this.group);}});extend(this,{CuiListInfo:function(list){this.list=list.slice(0);}});extend(this.CuiListInfo,{has:function(list){var storage=cache.Storage.CuiLists;loop:for(var i=0,n=storage.length;i<n;++i){var list2=storage[i].list;for(var j=0;j<list2.length;++j){if(-1===utils.hasValue(list,list2[j]))
continue loop;}
for(j=0;j<list.length;++j){if(-1===utils.hasValue(list2,list[j]))
continue loop;}
return storage[i];}
return null;},get:function(list){return this.has(list)||this.put(new this(list));},put:function(list){return cache.Storage.CuiLists[cache.Storage.CuiLists.length]=list;}});extend(this,{ConceptInfo:function(id,name,types,parent){this.id=id;this.name=name||'';this.types=types||[];this.parent=parent&&parent.id||parent||null;}});extend(this.ConceptInfo,{has:function(id){return cache.Storage.ConceptInfos[id];},get:function(id,name,types,parent){var info=this.has(id);if(info)
return info.adopt(name,types,parent);return this.put(new this(id,name,types,parent));},put:function(info){return cache.Storage.ConceptInfos[info.id]=info;}});extend(this.ConceptInfo.prototype,{adopt:function(name,types,parent){this.name=name||this.name;this.parent=parent&&parent.id||parent||this.parent;if(types&&types.length){for(var i=0,n=types.length;i<n;++i){var type=types[i];if(utils.hasValue(this.types,type))
this.types[this.types.length]=type;}}
return this;},getParent:function(){return cache.ConceptInfo.get(this.parent);},getTypes:function(){var types=[];for(var i=0,n=this.types.length;i<n;++i)
types[types.length]=cache.SemanticType.get(this.types[i]);return types;}});extend(this,{FingerprintInfo:function(offset){this.offset=offset;this.words=[];}});extend(this.FingerprintInfo,{has:function(offset){var c=cache.PageCache.has();return c&&c.info.fingerprints&&c.info.fingerprints['offset'+offset];},get:function(offset){return this.has(offset)||this.put(new this(offset));},put:function(info){var c=cache.PageCache.has();if(!c)
return null;if(!c.info.fingerprints)
c.info.fingerprints=[];c.info.fingerprints['offset'+info.offset]=info;return c.info.fingerprints[c.info.fingerprints.length]=info;}});extend(this,{PageInfo:function(url,checksum){this.url=url;this.checksum=checksum;this.fingerprints=[];}});extend(this.PageInfo,{has:function(url,checksum){if(!cache.Storage.Pages[url])
return null;if('undefined'!==typeof checksum)
return cache.Storage.Pages[url][checksum];return cache.Storage.Pages[url].last&&cache.Storage.Pages[url][cache.Storage.Pages[url].last]||null;},get:function(url,checksum){return this.has(url,checksum)||this.put(new this(url,checksum));},put:function(page){if(!cache.Storage.Pages[page.url])
cache.Storage.Pages[page.url]={};cache.Storage.Pages[page.url].last=page.checksum;return cache.Storage.Pages[page.url][page.checksum]=page;}});extend(this,{PageCache:function(url){this.page=url;this.info=cache.PageInfo.get(url,linker.useChecksum&&linker.parsing.getCheckSum());this.fingerprints=[];this.highlightnodes=[];}});extend(this.PageCache,{has:function(){return utils.getData(linker.processWindow,'cache');},get:function(url){return this.has()||this.put(new this(url));},put:function(cache){return utils.setData(linker.processWindow,'cache',cache);}});});linker.addModule("state",["utils","log"],function(linker,state){linker.extend(this,{NAME:"Linker State Module",VERSION:"1.1"});var utils=linker.utils;var log=linker.log;linker.extend(this,{is_visible:true,is_enrich:true,types:{behavior:('undefined'!==typeof SHOW_BEHAVIOR)?SHOW_BEHAVIOR:true,anatomy:('undefined'!==typeof SHOW_ANATOMY)?SHOW_ANATOMY:true,chemicals:('undefined'!==typeof SHOW_CHEMICALS)?SHOW_CHEMICALS:true,diseases:('undefined'!==typeof SHOW_DISEASES)?SHOW_DISEASES:true,genes:('undefined'!==typeof SHOW_GENES)?SHOW_GENES:true,living:('undefined'!==typeof SHOW_LIVING)?SHOW_LIVING:true,physiology:('undefined'!==typeof SHOW_PHYSIOLOGY)?SHOW_PHYSIOLOGY:true,"new":('undefined'!==typeof SHOW_NEW)?SHOW_NEW:true,other:('undefined'!==typeof SHOW_OTHER)?SHOW_OTHER:false},savedConcepts:[],savedConceptsByCui:{},options:{topbar:{show:('undefined'!==typeof SHOW_TOPBAR&&'default'!==SHOW_TOPBAR)?true===SHOW_TOPBAR||'on'===SHOW_TOPBAR:('undefined'!==typeof linker.APPLICATION)?!!linker.APPLICATION:true},tooltip:{show:('undefined'!==typeof SHOW_TOOLTIP)?SHOW_TOOLTIP:true,semantic:('undefined'!==typeof TOOLTIP_SEMANTIC_TYPE)?TOOLTIP_SEMANTIC_TYPE:true,text:('undefined'!==typeof TOOLTIP_TEXT)?TOOLTIP_TEXT:false},button:{show:('undefined'!==typeof SHOW_BUTTON)?SHOW_BUTTON:true},coloring:{show:('undefined'!==typeof SHOW_COLORING)?SHOW_COLORING:true,group:('undefined'!==typeof GROUP_COLORING)?GROUP_COLORING:true,fade:('undefined'!==typeof FADE_COLORING)?FADE_COLORING:10,types:{behavior:('undefined'!==typeof COLOR_BEHAVIOR)?COLOR_BEHAVIOR:'#eca420',anatomy:('undefined'!==typeof COLOR_ANATOMY)?COLOR_ANATOMY:'#2b8bc1',chemicals:('undefined'!==typeof COLOR_CHEMICALS)?COLOR_CHEMICALS:'#38c0be',diseases:('undefined'!==typeof COLOR_DISEASES)?COLOR_DISEASES:'#e76f5f',genes:('undefined'!==typeof COLOR_GENES)?COLOR_GENES:'#dcd134',living:('undefined'!==typeof COLOR_LIVING)?COLOR_LIVING:'#58bb57',physiology:('undefined'!==typeof COLOR_PHYSIOLOGY)?COLOR_PHYSIOLOGY:'#d763a5','new':('undefined'!==typeof COLOR_NEW)?COLOR_NEW:'#FF0080',other:('undefined'!==typeof COLOR_OTHER)?COLOR_OTHER:'#bebebe'},'background-color':('undefined'!==typeof COLORING_BACKGROUND)?COLORING_BACKGROUND:'transparent'},highlighting:{show:('undefined'!==typeof SHOW_HIGHLIGHTING)?SHOW_HIGHLIGHTING:true,underline:{style:('undefined'!==typeof UNDERLINE_STYLE)?UNDERLINE_STYLE:true,color:('undefined'!==typeof UNDERLINE_COLOR)?UNDERLINE_COLOR:'',stay:('undefined'!==typeof UNDERLINE_COLOR_STAY)?UNDERLINE_COLOR_STAY:false}},selected:{'background-color':('undefined'!==typeof SELECTED_BACKGROUND)?SELECTED_BACKGROUND:'#ffff00'},addToQuery:{show:('undefined'!==typeof SHOW_ADDTOQUERY)?SHOW_ADDTOQUERY:true,order:('undefined'!==typeof ORDER_ADDTOQUERY)?ORDER_ADDTOQUERY:10,title:('undefined'!==typeof TITLE_ADDTOQUERY)?TITLE_ADDTOQUERY:'Add to search query'},definition:{show:('undefined'!==typeof SHOW_DEFINITION)?SHOW_DEFINITION:true,order:('undefined'!==typeof ORDER_DEFINITION)?ORDER_DEFINITION:20,title:('undefined'!==typeof TITLE_DEFINITION)?TITLE_DEFINITION:'Definition',empty:('undefined'!==typeof EMPTY_DEFINITION)?EMPTY_DEFINITION:"Definitions are from Wikiprofessional, which does not contain a valid definition for this concept yet. Please define this concept for the community by clicking the 'Connected concepts' link and then the [edit] button in the definition field, which can be found on the right hand side of the Concept Web page."},viewQuery:{show:('undefined'!==typeof SHOW_VIEWQUERY)?SHOW_VIEWQUERY:true,order:('undefined'!==typeof ORDER_VIEWQUERY)?ORDER_VIEWQUERY:30,title:('undefined'!==typeof TITLE_VIEWQUERY)?TITLE_VIEWQUERY:'View query and search'},followLink:{show:('undefined'!==typeof SHOW_FOLLOWLINK)?SHOW_FOLLOWLINK:true,order:('undefined'!==typeof ORDER_FOLLOWLINK)?ORDER_FOLLOWLINK:40,title:('undefined'!==typeof TITLE_FOLLOWLINK)?TITLE_FOLLOWLINK:'Follow this link'},authors:{show:('undefined'!==typeof SHOW_AUTHORS)?!!SHOW_AUTHORS:true,order:('undefined'!==typeof ORDER_AUTHORS)?ORDER_AUTHORS:50,title:('undefined'!==typeof TITLE_AUTHORS)?TITLE_AUTHORS:'Show related experts',empty:('undefined'!==typeof EMPTY_AUTHORS)?EMPTY_AUTHORS:'No related experts available',satellite:false,cache:false,open:false},publications:{show:('undefined'!==typeof SHOW_PUBLICATIONS)?!!SHOW_PUBLICATIONS:true,order:('undefined'!==typeof ORDER_PUBLICATIONS)?ORDER_PUBLICATIONS:60,title:('undefined'!==typeof TITLE_PUBLICATIONS)?TITLE_PUBLICATIONS:'Show related publications',empty:('undefined'!==typeof EMPTY_PUBLICATIONS)?EMPTY_PUBLICATIONS:'No related publications available',satellite:false,cache:false,open:false},factualConcepts:{show:('undefined'!==typeof SHOW_FACTUALCONCEPTS)?!!SHOW_FACTUALCONCEPTS:true,order:('undefined'!==typeof ORDER_FACTUALCONCEPTS)?ORDER_FACTUALCONCEPTS:65,title:('undefined'!==typeof TITLE_FACTUALCONCEPTS)?TITLE_FACTUALCONCEPTS:'Show related concepts',empty:('undefined'!==typeof EMPTY_FACTUALCONCEPTS)?EMPTY_FACTUALCONCEPTS:'No related concepts available',max:('undefined'!==typeof FACTUALCONCEPTS_MAXDISPLAY)?FACTUALCONCEPTS_MAXDISPLAY:5,link:('undefined'!==typeof FACTUALCONCEPTS_STRING)?FACTUALCONCEPTS_STRING:'add to search',satellite:false,cache:false,open:false},connectedConcepts:{show:('undefined'!==typeof SHOW_CONNECTEDCONCEPTS)?SHOW_CONNECTEDCONCEPTS:true,order:('undefined'!==typeof ORDER_CONNECTEDCONCEPTS)?ORDER_CONNECTEDCONCEPTS:70,title:('undefined'!==typeof TITLE_CONNECTEDCONCEPTS)?TITLE_CONNECTEDCONCEPTS:'Connected concepts'},joinConceptWeb:{show:('undefined'!==typeof SHOW_JOINCONCEPTWEB)?SHOW_JOINCONCEPTWEB:true,order:('undefined'!==typeof ORDER_JOINCONCEPTWEB)?ORDER_JOINCONCEPTWEB:80,title:('undefined'!==typeof TITLE_JOINCONCEPTWEB)?TITLE_JOINCONCEPTWEB:'Join the Concept Web'},gotoWiki:{show:('undefined'!==typeof SHOW_GOTOWIKI)?SHOW_GOTOWIKI:false,order:('undefined'!==typeof ORDER_GOTOWIKI)?ORDER_GOTOWIKI:85,title:('undefined'!==typeof TITLE_GOTOWIKI)?TITLE_GOTOWIKI:'Go to Wiki page'},books:{show:('undefined'!==typeof SHOW_BOOKS)?!!SHOW_BOOKS:true,order:('undefined'!==typeof ORDER_BOOKS)?ORDER_BOOKS:90,title:('undefined'!==typeof TITLE_BOOKS)?TITLE_BOOKS:'Available books',empty:('undefined'!==typeof EMPTY_BOOKS)?EMPTY_BOOKS:'No books available',max:('undefined'!==typeof BOOKS_MAXDISPLAY)?BOOKS_MAXDISPLAY:5,satellite:false,cache:false,open:true},springer:{show:('undefined'!==typeof SHOW_SPRINGER)?SHOW_SPRINGER:false,order:('undefined'!==typeof ORDER_SPRINGER)?ORDER_SPRINGER:86,title:('undefined'!==typeof TITLE_SPRINGER)?TITLE_SPRINGER:'Show in Springer Exemplar',link:('undefined'!==typeof SPRINGER_LINK)?SPRINGER_LINK:'http://springerexemplar.com/search.aspx?q='},webmd:{show:('undefined'!==typeof SHOW_WEBMD)?!!SHOW_WEBMD:true,order:('undefined'!==typeof ORDER_WEBMD)?ORDER_WEBMD:87,title:('undefined'!==typeof TITLE_WEBMD)?TITLE_WEBMD:'WebMD Search',empty:('undefined'!==typeof EMPTY_WEBMD)?EMPTY_WEBMD:'Search result is empty',max:('undefined'!==typeof WEBMD_MAXDISPLAY)?WEBMD_MAXDISPLAY:5,link:('undefined'!==typeof WEBMD_STRING)?WEBMD_STRING:'Show more',satellite:false,cache:false,open:false},products:{show:('undefined'!==typeof SHOW_PRODUCTS)?!!SHOW_PRODUCTS:true,order:('undefined'!==typeof ORDER_PRODUCTS)?ORDER_PRODUCTS:100,title:('undefined'!==typeof TITLE_PRODUCTS)?TITLE_PRODUCTS:'Available products',satellite:true,cache:false,open:true},footer:{text:('undefined'!==typeof FOOTER_TEXT)?FOOTER_TEXT:'',size:('undefined'!==typeof FOOTER_SIZE)?FOOTER_SIZE:'6px'},help:{show:('undefined'!==typeof POPUPHELP_SHOW)?POPUPHELP_SHOW:false,link:('undefined'!==typeof POPUPHELP_LINK)?POPUPHELP_LINK:'http://www.wikiprofessional.org/portal/wikifier/index.php'},theme:('undefined'!==typeof THEME)?THEME:'Default',searchEngines:('undefined'!==typeof SEARCH_ENGINES)?SEARCH_ENGINES:{"Google":"linker.ui.GoogleCB","Concept Web":"linker.ui.KnowletCB","PubMed":"linker.ui.PubMedCB","BioMedCentral":"linker.ui.BMCCB","SpringerLink":"linker.ui.SpringerLinkCB","Google Scholar":"linker.ui.GoogleScholarCB","Google Patents":"linker.ui.GooglePatentCB","Yahoo":"linker.ui.YahooCB","CRISP":"linker.ui.CRISPCB","NIH Grants":"linker.ui.NIHGrantsCB"},searchEnginesSets:('undefined'!==typeof SEARCH_ENGINES_SETS)?SEARCH_ENGINES_SETS:{"Default":[{engine:"Google",proxy:true,flags:false},{engine:"Concept Web",proxy:true,flags:false},{engine:"PubMed",proxy:true,flags:false},{engine:"BioMedCentral",proxy:true,flags:false},{engine:"SpringerLink",proxy:true,flags:false},{engine:"Google Scholar",proxy:true,flags:false},{engine:"Google Patents",proxy:true,flags:false},{engine:"Yahoo",proxy:true,flags:false},{engine:"CRISP",proxy:true,flags:false},{engine:"NIH Grants",proxy:true,flags:false}]},searchEnginesSet:('undefined'!==typeof SEARCH_ENGINES_SET)?SEARCH_ENGINES_SET:'Default',parsing:{other:('undefined'!==typeof PARSE_OTHER_PAGES)?!!PARSE_OTHER_PAGES:true,empty:('undefined'!==typeof PARSE_EMPTY_PAGES)?!!PARSE_EMPTY_PAGES:true},requests:{timeout:('undefined'!==typeof REQUEST_TIMEOUT)?REQUEST_TIMEOUT:10,retries:('undefined'!==typeof REQUEST_RETRIES)?REQUEST_RETRIES:3,retryTimeout:('undefined'!==typeof REQUEST_RETRY_TIMEOUT)?REQUEST_RETRY_TIMEOUT:0,indexingTimeout:('undefined'!==typeof INDEXING_TIMEOUT)?INDEXING_TIMEOUT:(('undefined'!==typeof REQUEST_TIMEOUT)?REQUEST_TIMEOUT:10),error:('undefined'!==typeof REQUEST_ERROR)?REQUEST_ERROR:'No data avaialble due to a network problem'}}});linker.extend(this,{init:function(){var panel=linker.jQuery("#wikifier-toolbar",linker.getNavigationDocument());if(0===panel.length)
return;state.is_enrich=0===linker.jQuery("#wikifier-enrich:not(:checked)",panel).length;for(var name in state.types){if("function"==typeof state.types[name])
continue;state.types[name]=0<linker.jQuery("#wikifier-"+name+":checked",panel).length;}},hasSavedConcepts:function(){return 0<state.savedConcepts.length;},getSavedConcepts:function(){return state.savedConcepts;},getSavedConcept:function(cui){if("undefined"!=typeof state.savedConceptsByCui[cui])
return state.savedConcepts[state.savedConceptsByCui[cui]];return null;},isConceptSelected:function(cui){if(cui instanceof Array){for(var i=0,n=cui.length;i<n;++i){if(("undefined"!=typeof state.savedConceptsByCui[cui[i]])&&state.savedConcepts[state.savedConceptsByCui[cui[i]]].selected)
return true;}
return false;}
if("undefined"!=typeof state.savedConceptsByCui[cui])
return state.savedConcepts[state.savedConceptsByCui[cui]].selected;return false;},addSavedConcept:function(cui,override){if(!cui)
return null;var savedConcept=null;if("undefined"!=typeof state.savedConceptsByCui[cui]){savedConcept=state.savedConcepts[state.savedConceptsByCui[cui]];savedConcept.selected=true;}else{var concept=linker.subject.Concept.get(cui);if(!concept)
return null;state.savedConceptsByCui[cui]=state.savedConcepts.length;savedConcept=state.savedConcepts[state.savedConcepts.length]={cui:cui,selected:true,'name':concept.name()};if(concept.info.parent){var parent=linker.cache.ConceptInfo.get(concept.info.parent);linker.extend(savedConcept,{selected:!!override,mappedId:parent.id,mappedName:parent.name},true);}}
return savedConcept;},removeSavedConcept:function(cui){if("undefined"==typeof state.savedConceptsByCui[cui])
return;state.savedConcepts.splice(state.savedConceptsByCui[cui],1);delete state.savedConceptsByCui[cui];},emptySavedConcepts:function(){state.savedConcepts=[];state.savedConceptsByCui={};}});utils.addLinkerEvent("linkerPageInit",function(event){state.init();});utils.addLinkerEvent("linkerPanelChanged",function(event){state.init();utils.fireLinkerEvent("linkerStateChanged");});utils.addLinkerEvent("linkerVisibilityChanged",function(event,visibility){state.is_visible=visibility;utils.fireLinkerEvent("linkerStateChanged");});utils.addLinkerEvent("linkerParsingFinish",function(event){utils.setData(linker.processWindow,"parsed",true);});utils.addLinkerEvent("linkerIndexingFinish",function(event){utils.setData(linker.processWindow,"indexed",true);});utils.addLinkerEvent("linkerHighlightingFinish",function(event){utils.setData(linker.processWindow,"highlighted",true);});});linker.addModule("parsing",["utils","log","cache"],function(linker,parsing){linker.extend(this,{NAME:"Linker Parsing Module",VERSION:"1.2"});var utils=linker.utils;var log=linker.log;var cache=linker.cache;var extend=linker.extend;extend(this,{NodeOffset:[],TextLengthCache:{},TextLengthCount:0,IndexNodeQueue:[],parsed:false});extend(this,(function(){var timeout=null;return{indexNode:function(node){if(!node)
return false;try{switch(node.nodeType){case 3:break;case 9:case 10:for(var i=0;i<node.body.childNodes.length;++i)
arguments.callee(node.body.childNodes[i]);return false;case 1:var tagName=node.tagName.toLowerCase();if(tagName=="script")
return false;if(tagName=="body"){for(var k=0;k<node.childNodes.length;++k)
arguments.callee(node.childNodes[k]);return false;}
if(utils.isWikifierNode(node))
return false;break;default:break;}
if(0===parsing.getTextLength(node))
return false;parsing.IndexNodeQueue[parsing.IndexNodeQueue.length]={node:node,handled:false};if(!timeout){timeout=linker.win.setTimeout(function(){timeout=null;parsing.processNodeQueue();},100);}}catch(e){log.debug("Error while adding indexing node",e);return false;}
return true;},processNodeQueue:function(){if(!parsing.parsed)
return;for(var i=0;i<parsing.IndexNodeQueue.length;++i){if(parsing.IndexNodeQueue[i].handled)
continue;parsing.IndexNodeQueue[i].handled=true;try{var node=parsing.IndexNodeQueue[i].node;var s=parsing.getText(node);var off=parsing.getOffset(node);var offset=off;var brakes=[];if(linker.browser.is_ie){if("undefined"!==typeof node.innerText){var text=node.innerText;var re=/\r|\n/g;var pos;var n=0;while(null!==(pos=re.exec(text))){brakes[brakes.length]=off+pos.index-n;++n;}}}else{if("undefined"!==typeof node.getElementsByTagName){var list=node.getElementsByTagName("br");for(var t=0;t<list.length;++t)
brakes[brakes.length]=parsing.getOffset(list[t]);list=node.getElementsByTagName("td");for(t=0;t<list.length;++t)
brakes[brakes.length]=parsing.getOffset(list[t]);list=node.getElementsByTagName("div");for(t=0;t<list.length;++t)
brakes[brakes.length]=parsing.getOffset(list[t]);list=node.getElementsByTagName("p");for(t=0;t<list.length;++t)
brakes[brakes.length]=parsing.getOffset(list[t]);}}
if(0<brakes.length){brakes.sort(function(a,b){return a-b;});for(var a=0;a<brakes.length;++a){if(brakes[a]>offset){linker.indexing.indexText(s.substr(offset-off,brakes[a]-offset),node,offset);offset=brakes[a];}}}
if(offset<off+s.length)
linker.indexing.indexText((off<offset)?s.substr(offset-off):s,node,offset);}catch(e){parsing.IndexNodeQueue[i].handled=false;}}
for(var i=parsing.IndexNodeQueue.length-1;0<=i;--i){if(!parsing.IndexNodeQueue[i].handled)
continue;parsing.IndexNodeQueue.splice(i,1);}},clearNodeQueue:function(){if(timeout){linker.win.clearTimeout(timeout);timeout=null;}
parsing.IndexNodeQueue=[];}};})());extend(this,(function(){var text_pattern=/\r|\n/g;var html_pattern=/<\/?[^>]*>/g;function getBodyText(node){var s="";for(var i=0;i<node.childNodes.length;++i){s+=parsing.getText(node.childNodes[i]);}
return s;}
return{getText:function(node){if(null===node)
return"";switch(node.nodeType){case 2:case 3:case 4:return node.nodeValue||"";case 7:case 8:return"";case 9:case 10:return getBodyText(node.body);default:if(node.ownerDocument&&(node===node.ownerDocument.body))
return getBodyText(node);if("undefined"!=typeof node.textContent)
return node.textContent;if("undefined"!=typeof node.innerText)
return node.innerText.replace(text_pattern,"");if("undefined"!=typeof node.innerHTML)
return node.innerHTML.replace(html_pattern,"").replace(text_pattern,"");return"";}}};})());extend(this,{init:function(){for(var i=0;i<parsing.NodeOffset.length;i++){try{if(null!==utils.getData(parsing.NodeOffset[i].node,"offset"))
utils.setData(parsing.NodeOffset[i].node,"offset",null);}catch(e){}}
parsing.NodeOffset=[];parsing.TextLengthCache={};parsing.parsed=false;},getTextLength:function(node){if(null===node)
return 0;if(3===node.nodeType)
return node.length;var id=utils.getData(node,'node-id');if(null===id){++parsing.TextLengthCount;id=parsing.TextLengthCount;utils.setData(node,'node-id',id);}
if('undefined'!==typeof parsing.TextLengthCache[id])
return parsing.TextLengthCache[id];return parsing.TextLengthCache[id]=parsing.getText(node).length;},setOffset:function(node,offset,type,index){if(3!==node.nodeType)
utils.setData(node,"offset",offset);if("undefined"==typeof index){index=parsing.getIndexByPos(offset);while((-1<index)&&utils.isContains(parsing.NodeOffset[index].node,node))--index;++index;}
if(parsing.NodeOffset.length==index)
parsing.NodeOffset[index]={offset:offset,node:node,type:type};else
parsing.NodeOffset.splice(index,0,{offset:offset,node:node,type:type});},getOffset:function(node){if(null===node)
return null;var offset=utils.getData(node,"offset");if(null!==offset)
return offset;if(node.ownerDocument){if(node===node.ownerDocument.body)
return 0;if(node.ownerDocument.createRange){var parent=node;while(parent.parentNode){parent=parent.parentNode;if(parent===node.ownerDocument.body)
break;offset=utils.getData(parent,"offset");if(null!==offset)
break;}
if(!offset)
offset=0;if(node!==parent){var r=node.ownerDocument.createRange();r.setStartBefore(parent.firstChild);r.setEndBefore(node);offset+=r.toString().length;delete r;}
parsing.setOffset(node,offset,(3===node.nodeType)?3:1);return offset;}}
var parent=node.parentNode;offset=arguments.callee(parent)||0;for(var i=0;(i<parent.childNodes.length)&&(parent.childNodes[i]!==node);++i)
offset+=parsing.getTextLength(parent.childNodes[i]);parsing.setOffset(node,offset,(3===node.nodeType)?3:1);return offset;},getIndexOffset:function(el){if(utils.isWikifierNode(el))
return 0;return parsing.getOffset(el);},getCheckSum:function(){return parsing.getTextLength(linker.processDocument.body);},getIndexByPos:function(aPos,index){if(0===parsing.NodeOffset.length)
return-1;var cur=index||0;var step=parsing.NodeOffset.length-cur;while(true){step=Math.max(1,step>>1);if(parsing.NodeOffset[cur].offset>aPos){cur-=step;if(cur<0)
return-1;}else if(cur+1<parsing.NodeOffset.length&&parsing.NodeOffset[cur+1].offset<=aPos){cur+=step;if(cur>=parsing.NodeOffset.length)
return parsing.NodeOffset.length-1;}else{return cur;}}
return-1;},removeProxyInfo:function(aUrl){var pos=aUrl.lastIndexOf("http://");if(pos>6){aUrl=aUrl.slice(pos);return aUrl;}
pos=aUrl.lastIndexOf(/http/);if(pos>6){aUrl="http://"+aUrl.slice(pos+6);}
return aUrl;},constructFullUrl:function(processDocument,aurl,page){var url=aurl;if((page==3)||(page==8)){var Db="";var Term="";for(var f=0;f<processDocument.forms.length;f++){for(var e=0;e<processDocument.forms[f].elements.length;e++){if(processDocument.forms[f].elements[e].name=="EntrezSystem2.PEntrez.Pubmed.SearchBar.Db"){Db=processDocument.forms[f].elements[e].value;}
if(processDocument.forms[f].elements[e].name=="EntrezSystem2.PEntrez.Pubmed.SearchBar.Term"){Term=processDocument.forms[f].elements[e].value;}}}
url+="?EntrezSystem2.PEntrez.Pubmed.SearchBar.Db="+Db+"&EntrezSystem2.PEntrez.Pubmed.SearchBar.Term="+Term;}
return url;},SiteSpecificHandling:function(aPage){try{var offset=0;var aUrl=parsing.removeProxyInfo(linker.url);var page=aPage||IsURLToEnrich(linker.processDocument,aUrl);log.progress("Extraction of text");utils.fireLinkerEvent("linkerParsingStart");var toIndex=ProcessPage(linker.processDocument,page);if(toIndex!==false){parsing.NodeOffset.sort(function(a,b){return a.offset-b.offset;});try{var cache=linker.cache.PageCache.get(parsing.constructFullUrl(linker.processDocument,aUrl,page));linker.useChecksum=true;}catch(e){log.debug("catch error on retrieving fingerprint from cache",e);throw e;}
if(cache.info.fingerprints&&cache.info.fingerprints.length){parsing.clearNodeQueue();linker.indexing.clearTextQueue();parsing.parsed=true;utils.fireLinkerEvent("linkerParsingFinish");utils.fireLinkerEvent("linkerIndexingStart");linker.indexing.indexed=true;utils.fireLinkerEvent("linkerIndexingFinish");for(var i=0,n=cache.info.fingerprints.length;i<n;++i)
var fp=linker.subject.Fingerprint.get(cache.info.fingerprints[i].offset);linker.highlighting.ShowConcepts(0,cache.fingerprints.length-1);}else{parsing.parsed=true;utils.fireLinkerEvent("linkerParsingFinish");if(parsing.IndexNodeQueue.length||linker.indexing.IndexTextQueue.length){utils.fireLinkerEvent("linkerIndexingStart");parsing.processNodeQueue();linker.indexing.processTextQueue();}}}}catch(e){log.debug("Error in sitespecifichandling",e);}finally{log.progress();}}});utils.addLinkerEvent("linkerInit",function(event){parsing.init();});});linker.addModule("indexing",["utils","log","cache"],function(linker,indexing){linker.extend(this,{NAME:"Linker Indexing Module",VERSION:"1.2"});var utils=linker.utils;var log=linker.log;var cache=linker.cache;linker.extend(this,{IndexTextQueue:[],IndexingRequestQueue:[],IndexingResultQueue:[],IndexingResponseQueue:[],queryLength:("undefined"!==typeof QUERY_LENGTH)?Math.max(QUERY_LENGTH,100):1024,indexed:false});linker.extend(this,(function(){var timeout=null;return{indexText:function(text,node,offset){var len=text.length;if(0===len)
return false;try{node=node||linker.processDocument.body;offset=offset||linker.parsing.getOffset(node);text=text.replace(/^\s+/,"");offset+=len-text.length;text=text.replace(/\s+$/,"");indexing.IndexTextQueue[indexing.IndexTextQueue.length]={text:text,node:node,offset:offset,handled:false};if(!timeout){timeout=linker.win.setTimeout(function(){timeout=null;indexing.processTextQueue();},10);}}catch(e){log.debug("Error while adding indexing text",e);return false;}
return true;},processTextQueue:function(){if(!linker.parsing.parsed)
return;for(var i=0;i<indexing.IndexTextQueue.length;++i){if(indexing.IndexTextQueue[i].handled)
continue;indexing.IndexTextQueue[i].handled=true;var node=indexing.IndexTextQueue[i].node;var text=indexing.IndexTextQueue[i].text;var offset=indexing.IndexTextQueue[i].offset;var length=text.length;try{var off=0;do{var len=length-off;if(indexing.queryLength<len){len=text.lastIndexOf(" ",off+indexing.queryLength)-off;if(len<=0)
len=indexing.queryLength;}
indexing.storeIndexRequest((len==length)?text:text.substr(off,len),offset+off,node);off+=len;}while(off<length);}catch(e){indexing.IndexTextQueue[i].handled=false;}}
for(var i=indexing.IndexTextQueue.length-1;0<=i;--i){if(!indexing.IndexTextQueue[i].handled)
continue;indexing.IndexTextQueue.splice(i,1);}
linker.parsing.processNodeQueue();},clearTextQueue:function(){if(timeout){linker.win.clearTimeout(timeout);timeout=null;}
indexing.IndexTextQueue=[];}};})());linker.extend(this,(function(){var timeout=null;var blocked=false;return{storeIndexRequest:function(text,offset,node){if(0===text.length)
return false;try{node=node||processDocument.body;var fp=linker.subject.Fingerprint.get(offset);fp.node=node;indexing.IndexingRequestQueue[indexing.IndexingRequestQueue.length]={text:text,offset:offset,fp:fp,handled:false,node:node};if(!timeout){timeout=linker.win.setTimeout(function(){timeout=null;indexing.processRequestQueue();},10);}}catch(e){log.debug("Error while adding indexing request",e);return false;}
return true;},processRequestQueue:function(){if(blocked)
return;blocked=true;var text="";var requests=[];try{log.progress("semantic analysis of text");for(var i=0;i<indexing.IndexingRequestQueue.length;++i){if(indexing.IndexingRequestQueue[i].handled)
continue;if(text.length+indexing.IndexingRequestQueue[i].text.length>indexing.queryLength)
break;indexing.IndexingRequestQueue[i].handled=true;requests[requests.length]={request:indexing.IndexingRequestQueue[i],offset:text.length};text+=indexing.IndexingRequestQueue[i].text+". ";}
if(0<requests.length){indexing.storeIndexResult(requests,text);}else{log.progress();indexing.processTextQueue();}}catch(e){log.debug("Error while processing indexing requests queue",e);log.progress();}finally{blocked=false;}},requestPending:function(){if(blocked)
return true;for(var i=0;i<indexing.IndexingResultQueue.length;++i){if(indexing.IndexingResultQueue[i].handled)
continue;return true;}
return false;}};})());linker.extend(this,(function(){var timeout=null;var blocked=false;return{storeIndexResult:function(requests,text){try{var id=linker.utils.UUID.generate("v4");indexing.IndexingResultQueue[id]=indexing.IndexingResultQueue[indexing.IndexingResultQueue.length]={id:id,requests:requests,text:text,handled:false};if(!timeout){timeout=linker.win.setTimeout(function(){timeout=null;indexing.processResultQueue();},10);}}catch(e){log.debug("Error while adding indexing result",e);return false;}
return true;},processResultQueue:function(){if(blocked)
return;blocked=true;var index=-1;try{for(var i=0;i<indexing.IndexingResultQueue.length;++i){if(indexing.IndexingResultQueue[i].handled)
continue;indexing.IndexingResultQueue[i].handled=true;index=i;break;}
if(-1<index){indexing.Index(indexing.IndexingResultQueue[index].id,indexing.IndexingResultQueue[index].text,indexing.processResultCallback,null,function(){blocked=false;indexing.processResultQueue();});}else{blocked=false;indexing.processRequestQueue();}}catch(e){blocked=false;log.debug("Error while processing indexing results queue",e);}},processResultCallback:function(id,text){if("undefined"==indexing.IndexingResultQueue[id]){log.debug("Error while finding result by id: "+id);return;}
var result=indexing.IndexingResultQueue[id];result.handled=true;indexing.storeIndexResponse(result,text);},resultPending:function(){if(blocked)
return true;for(var i=0;i<indexing.IndexingResultQueue.length;++i){if(indexing.IndexingResultQueue[i].handled)
continue;return true;}
return false;}};})());linker.extend(this,(function(){var timeout=null;var blocked=false;return{storeIndexResponse:function(result,text){if(!text)
return false;try{indexing.IndexingResponseQueue[indexing.IndexingResponseQueue.length]={result:result,text:text,handled:false};if(!timeout){timeout=linker.win.setTimeout(function(){timeout=null;indexing.processResponseQueue();},100);}}catch(e){log.debug("Error while adding indexing response",e);return false;}
return true;},processResponseQueue:function(){if(blocked)
return;blocked=true;var index=-1;try{for(var i=0;i<indexing.IndexingResponseQueue.length;++i){if(indexing.IndexingResponseQueue[i].handled)
continue;index=i;break;}
if(-1<index){var fp=new linker.subject.Fingerprint();var response=indexing.IndexingResponseQueue[index];linker.win.setTimeout(function(){indexing.parse(response);indexing.processResponseCallback(response);},0);}else{blocked=false;if(indexing.resultPending())
indexing.processResultQueue();else if(indexing.requestPending())
indexing.processRequestQueue();else
utils.fireLinkerEvent("linkerIndexingFinish");}}catch(e){blocked=false;log.debug("Error while processing indexing responses queue",e);}},processResponseCallback:function(response){var cache=linker.cache.PageCache.has();linker.highlighting.ShowConcepts(response.result.requests[0].request.fp.index,response.result.requests[response.result.requests.length-1].request.fp.index);response.handled=true;blocked=false;indexing.processResponseQueue();},responsePending:function(){if(blocked)
return true;for(var i=0;i<indexing.IndexingResponseQueue.length;++i){if(indexing.IndexingResponseQueue[i].handled)
continue;return true;}
return false;}};})());linker.extend(this,{init:function(){this.IndexingRequestQueue=[];this.IndexingResultQueue=[];this.IndexingResponseQueue=[];this.indexed=false;},Index:function(id,text,callback,error,complete){text=text.replace(/\n|\x01|\x02/g,' ');linker.api.getIndex(id,text,callback,error,complete);},getRequestByPos:function(result,pos){for(var i=0;i<result.requests.length-1;i++){if(pos<result.requests[i+1].offset)
return result.requests[i];}
return result.requests[result.requests.length-1];},parse:function(response){var data=response.text;for(var i=0,n=data.semantictypes.length;i<n;++i){var type=data.semantictypes[i];cache.SemanticType.get(type.id,type.name,cache.SemanticGroup.get(type.group));}
if(0===data.concepts.length){linker.ui.hidePB();return;}
for(i=0,n=data.concepts.length;i<n;++i){var item=data.concepts[i];var parent=item.mappedfrom&&cache.ConceptInfo.get(item.mappedfrom,item.mappedfromname,item.semtypes,null)||null;var concept=cache.ConceptInfo.get(item.id,item.name,item.semtypes,parent);if(item.positions&&item.positions.length){for(var j=0,nj=item.positions.length;j<nj;++j){var position=item.positions[j];var request=linker.indexing.getRequestByPos(response.result,position.pos);request.request.fp.addWord(Math.max(position.pos-request.offset-1,0),position.word,position.clid,concept.id,true);if(parent)
request.request.fp.addWord(Math.max(position.pos-request.offset-1,0),position.word,position.clid,parent.id,false);}}}
for(i=0,n=response.result.requests.length;i<n;++i)
response.result.requests[i].request.fp.extractpositions();}});utils.addLinkerEvent("linkerInit",function(event){indexing.init();});utils.addLinkerEvent("linkerIndexingFinish",function(event){log.progress();if(indexing.indexed)
return;indexing.indexed=true;linker.parsing.TextLengthCache={};if(!linker.highlighting.highlighting)
utils.fireLinkerEvent("linkerHighlightingFinish");});});linker.addModule("highlighting",["utils","log","parsing"],function(linker,highlighting){linker.extend(this,{NAME:"Linker Highlighting Module",VERSION:"1.2"});var utils=linker.utils;var log=linker.log;linker.extend(this,{new_concepts:null,highlighting:0});linker.extend(this,{init:function(){this.new_concepts=[];},AddHighlightNodes:function(fpId,positions){if(0===positions.length)
return;var cache=linker.cache.PageCache.has();for(var p=0;p<positions.length;++p){var index=linker.parsing.getIndexByPos(positions[p].startPos);if(-1===index){linker.parsing.setOffset(linker.processDocument.body,0,1,0);index=0;}
var node=linker.parsing.NodeOffset[index].node;var offset=positions[p].startPos-linker.parsing.NodeOffset[index].offset;var len=linker.parsing.getTextLength(node);while((null!==node)&&(offset>=len)){offset-=len;while((null!==node)&&(null===node.nextSibling))
node=node.parentNode;if(null!==node){node=node.nextSibling;len=linker.parsing.getTextLength(node);linker.parsing.setOffset(node,positions[p].startPos-offset,1,index+1);}}
if(null===node){log.debug('Node not found');continue;}
while((null!==node)&&(3!==node.nodeType)){var cur;for(var i=0;i<node.childNodes.length;++i){cur=node.childNodes[i];len=linker.parsing.getTextLength(cur);if(offset<len)
break;offset-=len;}
node=cur;if(null!==node)
linker.parsing.setOffset(node,positions[p].startPos-offset,1,index+1);}
if(null!==node){if(utils.isWikifierNode(node))
continue;var highlightnode=linker.processDocument.createElement('font');highlightnode.className='wikiprotein';utils.setData(highlightnode,'position',positions[p]);var fontnode=linker.processDocument.createElement('font');fontnode.className='wikihighlight';if(linker.browser.is_ie)
fontnode.style.styleFloat="none";else
fontnode.style.cssFloat="none";fontnode.style.background="transparent";fontnode.style.borderLeft="0px none";fontnode.style.borderRight="0px none";var urlNode=this.getEnclosingUrl(node);if(null!==urlNode)
utils.setData(highlightnode,"url",urlNode.href);var txt=node.splitText(offset);offset=positions[p].endPos-positions[p].startPos;if(offset<txt.nodeValue.length)
txt.splitText(offset);node.parentNode.replaceChild(highlightnode,txt);fontnode.appendChild(txt);highlightnode.appendChild(fontnode);utils.addEvent(highlightnode,"click",this.highlightClick,false,highlightnode);utils.addEvent(highlightnode,"mouseenter",this.highlightNode,false,highlightnode);utils.addEvent(highlightnode,"mouseleave",this.unhighlightNode,false,highlightnode);offset-=txt.nodeValue.length;node=highlightnode;if(cache.highlightnodes['_'+fpId])
cache.highlightnodes['_'+fpId].push(cache.highlightnodes.length);else
cache.highlightnodes['_'+fpId]=[cache.highlightnodes.length];cache.highlightnodes.push([highlightnode,[fpId,p]]);while(0<offset){while((null!==node)&&(3!==node.nodeType)){while((null!==node)&&(null===node.nextSibling))
node=node.parentNode;if(null!==node)
node=node.nextSibling;while((null!==node)&&(null!==node.firstChild))
node=node.firstChild;}
if(null===node)
break;highlightnode=linker.processDocument.createElement('font');highlightnode.className='wikiprotein';utils.setData(highlightnode,'position',positions[p]);fontnode=linker.processDocument.createElement('font');fontnode.className='wikihighlight';if(linker.browser.is_ie)
fontnode.style.styleFloat="none";else
fontnode.style.cssFloat="none";fontnode.style.background="transparent";fontnode.style.borderLeft="0px none";fontnode.style.borderRight="0px none";if(offset<node.nodeValue.length)
node.splitText(offset);node.parentNode.replaceChild(highlightnode,node);fontnode.appendChild(node);highlightnode.appendChild(fontnode);utils.addEvent(highlightnode,"click",this.highlightClick,false,highlightnode);utils.addEvent(highlightnode,"mouseenter",this.highlightNode,false,highlightnode);utils.addEvent(highlightnode,"mouseleave",this.unhighlightNode,false,highlightnode);offset-=node.nodeValue.length;node=highlightnode;cache.highlightnodes['_'+fpId].push(cache.highlightnodes.length);cache.highlightnodes.push([highlightnode,[fpId,p]]);}}}},Highlight:function(fpId,initial,On){try{var cache=linker.cache.PageCache.has();if(initial){try{this.AddHighlightNodes(fpId,cache.fingerprints[fpId].positions);}catch(e){log.debug("addhighlightnodes error",e);}}
if(!cache.highlightnodes['_'+fpId])
return;for(var j=0;j<cache.highlightnodes['_'+fpId].length;j++){var i=cache.highlightnodes['_'+fpId][j];var rec=cache.highlightnodes[i][1];var highlightnode=cache.highlightnodes[i][0];var concept=utils.getData(highlightnode,"concept")||utils.setData(highlightnode,"concept",linker.subject.Concept.get(utils.getData(highlightnode,'position').preferred[0]));var cui=concept.id;var node=this.getFontNode(highlightnode);var suppress=!On||this.IsSuppressed(concept);linker.ui.ShowHighlight(node,On&&(linker.state.getSavedConcept(cui)!==null));if(linker.state.options.tooltip.show){var annotation=[];if(linker.state.options.tooltip.semantic){var semanticgroups=concept.semanticgroups();if(0<semanticgroups.length)
annotation[annotation.length]=semanticgroups[0].replace("&amp;","&");}
if(linker.state.options.tooltip.text)
annotation[annotation.length]=linker.state.options.tooltip.text;if(0<annotation.length)
node.title=annotation[0];}
node.style.cursor=suppress?"":"pointer";utils.setData(highlightnode,"suppress",suppress);if(linker.state.options.highlighting.show){if(!suppress){if(linker.browser.is_ie6)
node.style.position="relative";node.style.borderBottomWidth="1px";}else{if(linker.browser.is_ie6)
node.style.position="";node.style.borderBottomWidth=0;}}
linker.jQuery(node).toggleClass(this.getSemanticTypeClassName(concept)+"-node",!suppress);}}catch(e){log.debug("highlight error",e);}},getNewCooccurrences:function(url){var i=0;var startPos,endPos,argument,elts,parts;var result=[];startPos=url.indexOf("new=[(");if(-1!=startPos){endPos=url.indexOf(")]");argument=utils.trimSquare(url.slice(startPos+4,endPos));elts=argument.split("),");for(j=0;j<elts.length;j++){if(elts[j]!==""){parts=elts[j].split(",");for(p=0;p<parts.length;p++){parts[p]=utils.trimSquare(parts[p]);if(parts[p][1]=='u'){parts[p]=parts[p].substr(2);}
parts[p]=utils.unquote(utils.trimRound(parts[p]));}
result[result.length]=parts;}}}
return result;}});linker.extend(this,{partHighlight:function(f,initial,checked){if(0===f)
utils.fireLinkerEvent("linkerHighlightingStart");var i=0,n=linker.cache.PageCache.has().fingerprints.length;while(i<1000&&f<n){this.Highlight(f,initial,checked);i++;f++;}
if(f<n){linker.win.setTimeout(function(){highlighting.partHighlight(f,initial,checked);},10);}else{utils.fireLinkerEvent("linkerHighlightingFinish");}},changeHighlight:function(){if(utils.getData(linker.processWindow,"indexed")){highlighting.partHighlight(0,!utils.getData(linker.processWindow,"highlighted"),linker.state.is_enrich);if(linker.state.is_enrich)
linker.indexing.processRequestQueue();}else if(!utils.getData(linker.processWindow,"parsed")){linker.parsing.SiteSpecificHandling();}},clearHighlight:function(){if(!utils.getData(linker.processWindow,"indexed"))
return;highlighting.partHighlight(0,!utils.getData(linker.processWindow,"highlighted"),false);},highlightCallback:function(f,l,initial,checked){var cache=linker.cache.PageCache.has();if(f<=l){if(!cache.fingerprints[f].shown){cache.fingerprints[f].shown=true;this.Highlight(f,initial,checked);}
self.setTimeout(function(){highlighting.highlightCallback(f+1,l,initial,checked);},0);}else{--this.highlighting;if(f===cache.fingerprints.length){if(!this.highlighting&&linker.indexing.indexed)
utils.fireLinkerEvent("linkerHighlightingFinish");}}},ShowConcepts:function(f,l){if(0===f)
utils.fireLinkerEvent("linkerHighlightingStart");try{log.progress("presentation of analysis results");this.new_concepts=this.getNewCooccurrences(unescape(linker.url));++this.highlighting;self.setTimeout(function(){highlighting.highlightCallback(f,l,true,linker.state.is_enrich);},0);}catch(e){this.highlighting=false;log.debug("error in ShowConcepts",e);log.progress();}}});linker.extend(this,{getEnclosingUrl:function(node){return linker.jQuery(node).parents("a:first").get(0)||null;},getFontNode:function(node){return node.firstChild;},IsSuppressed:function(concept){if(null===concept)
return true;var suppressed=true;var semanticgroups=concept.semanticgroups();for(var i=0;i<semanticgroups.length;i++){if((semanticgroups[i]=="Behavior & Activity")||(semanticgroups[i]=="Behavior &amp; Activity")){suppressed=!linker.state.types["behavior"];}
else if(semanticgroups[i]=="Anatomy"){suppressed=!linker.state.types["anatomy"];}
else if((semanticgroups[i]=="Chemicals & Drugs")||(semanticgroups[i]=="Chemicals &amp; Drugs")){suppressed=!linker.state.types["chemicals"];}
else if((semanticgroups[i]=="Diseases & Disorders")||(semanticgroups[i]=="Diseases &amp; Disorders")){suppressed=!linker.state.types["diseases"];}
else if((semanticgroups[i]=="Genes & Molecular Sequences")||(semanticgroups[i]=="Genes &amp; Molecular Sequences")){suppressed=!linker.state.types["genes"];}
else if(semanticgroups[i]=="Living Beings"){suppressed=!linker.state.types["living"];}
else if(semanticgroups[i]=="Physiology"){suppressed=!linker.state.types["physiology"];}
else if(semanticgroups[i]=="New"){suppressed=!linker.state.types["new"];}
else if(semanticgroups[i]=="Other"){suppressed=!linker.state.types["other"];}
else if(semanticgroups[i]=="null"){suppressed=!linker.state.types["other"];}}
return suppressed;},getSemanticTypeClassName:function(concept){var semanticgroups=concept.semanticgroups();if(0<semanticgroups.length){var i=0;var type=semanticgroups[i];++i;while(("Other"===type)&&(i<semanticgroups.length)){type=semanticgroups[i];++i;}
switch(type){case"Behavior & Activity":case"Behavior &amp; Activity":return'wikifier-orange';case"Anatomy":return'wikifier-blue';case"Chemicals & Drugs":case"Chemicals &amp; Drugs":return'wikifier-turquoise';case"Diseases & Disorders":case"Diseases &amp; Disorders":return'wikifier-red';case"Genes & Molecular Sequences":case"Genes &amp; Molecular Sequences":return'wikifier-yellow';case"Living Beings":return'wikifier-green';case"Physiology":return'wikifier-pink';case"New":return'wikifier-purple';default:return'wikifier-gray';}}
semanticgroups=null;return'wikifier-gray';},getForegroundColor:function(concept){switch(this.getSemanticTypeClassName(concept)){case'wikifier-orange':return linker.state.options.coloring.types.behavior;case'wikifier-blue':return linker.state.options.coloring.types.anatomy;case'wikifier-turquoise':return linker.state.options.coloring.types.chemicals;case'wikifier-red':return linker.state.options.coloring.types.diseases;case'wikifier-yellow':return linker.state.options.coloring.types.genes;case'wikifier-pink':return linker.state.options.coloring.types.physiology;case'wikifier-green':return linker.state.options.coloring.types.living;case'wikifier-purple':return linker.state.options.coloring.types['new'];default:return linker.state.options.coloring.types.other;}}});linker.extend(this,{highlightNode:function(event){utils.fireLinkerEvent("linkerNodeOver",[event.data]);},unhighlightNode:function(event,underlined){utils.fireLinkerEvent("linkerNodeOut",[event.data]);},highlightClick:function(event){if(!utils.getData(event.data,"suppress")){event.preventDefault();event.stopPropagation();}
utils.fireLinkerEvent("linkerNodeClick",[event.data,event]);}});linker.extend(this,{setColoring:function(node){if(!linker.state.options.coloring.show&&(false!==linker.state.options.coloring.fade))
return;node=linker.state.options.coloring.group?linker.processDocument.body:(node||linker.processDocument.body);if(!node)
return;if(utils.getData(node,"coloring-blocked"))
return;utils.setData(node,"coloring-blocked",true);var timeout=utils.getData(node,"coloring-timeout");if(timeout){linker.win.clearTimeout(timeout);utils.setData(node,"coloring-timeout",null);}
linker.jQuery(node).addClass("wikifier-coloring-show");},removeColoring:function(node){if(!linker.state.options.coloring.show&&(false!==linker.state.options.coloring.fade))
return;node=linker.state.options.coloring.group?linker.processDocument.body:(node||linker.processDocument.body);if(!node)
return;utils.setData(node,"coloring-blocked",null);utils.setData(node,"coloring-timeout",linker.win.setTimeout(function(){utils.setData(node,"coloring-timeout",null);linker.jQuery(node).removeClass("wikifier-coloring-show");},linker.state.options.coloring.fade*1000));}});utils.addLinkerEvent("linkerInit",function(event){highlighting.init();});utils.addLinkerEvent("linkerPanelOver linkerButtonOver",function(event){highlighting.setColoring();});utils.addLinkerEvent("linkerPanelOut linkerButtonOut",function(event){highlighting.removeColoring();});utils.addLinkerEvent("linkerNodeOver",function(event,node){if(utils.getData(node,"suppress"))
return;highlighting.setColoring(node);});utils.addLinkerEvent("linkerNodeOut",function(event,node){if(utils.getData(node,"suppress"))
return;highlighting.removeColoring(node);});utils.addLinkerEvent("linkerHighlightingFinish",function(event){if(linker.state.options.coloring.show&&('number'===typeof linker.state.options.coloring.fade)&&(0<linker.state.options.coloring.fade)){highlighting.setColoring();highlighting.removeColoring();}});utils.addLinkerEvent("linkerStateChanged",function(event){if(linker.state.is_visible){if(linker.browser.is_ff){linker.win.setTimeout(function(){highlighting.changeHighlight();},50);}else{highlighting.changeHighlight();}}else{highlighting.clearHighlight();}});});linker.addModule("subject",["utils","cache"],function(linker,subject){linker.extend(this,{NAME:"Linker Subjects Module",VERSION:"1.1"});var utils=linker.utils;var cache=linker.cache;var extend=linker.extend;extend(this,{Concept:function(id){this.id=id;this.info=cache.ConceptInfo.get(id);}});extend(this.Concept,{has:function(id){var c=cache.PageCache.has();return c&&c.concepts&&c.concepts[id]||null;},get:function(id){return this.has(id)||this.put(new this(id));},put:function(concept){var c=cache.PageCache.has();if(!c)
return null;if(!c.concepts)
c.concepts=[];c.concepts[concept.id]=concept;return c.concepts[c.concepts.length]=concept;}});extend(this.Concept.prototype,{name:function(){return this.info.name;},semanticgroups:function(){if(this.groups)
return this.groups;this.groups=[];for(var i=0,n=this.info.types.length;i<n;++i)
this.groups[this.groups.length]=cache.SemanticType.get(this.info.types[i]).group;return this.groups;},hasDefinition:function(){return!!this.info.definition&&!(this.info.definition instanceof utils.Lazy);},getDefinition:function(){if(this.info.definition)
return this.info.definition;var concept=this;return this.info.definition=new utils.Lazy(function(callback){linker.api.getDefinition(concept.id,function(data){concept.parseDefinition(data);callback(concept.info.definition);utils.fireLinkerEvent("linkerDefinitionLoaded",[concept]);},function(error){callback(concept.info.definition='',error);});});},setDefinition:function(text){this.info.definition=text;},parseDefinition:function(data){this.info.definitionInfo=data[0]||{};this.info.definition=this.info.definitionInfo.definition||'';},hasTerms:function(){return!!this.info.terms&&!(this.info.terms instanceof utils.Lazy);},getTerms:function(destination){if(this.info.terms)
return this.info.terms;var concept=this;if("umls/C"==this.id.slice(0,6)){return this.info.terms=new utils.Lazy(function(callback){linker.api.getTerms(concept.id.slice(6),destination,function(data){concept.parseTerms(data);callback(concept.info.terms);utils.fireLinkerEvent("linkerTermsLoaded",[concept]);},function(error){callback(concept.info.terms=null,error);});});}else{var terms=[];if(!utils.isAccessionNumber(this.info.name)){if(2<this.info.name.length){terms[terms.length]="\""+this.replaceSpecies(this.info.name)+"\"";}}
return this.info.terms=terms;}},setTerms:function(value){this.info.terms=value;},replaceSpecies:function(term){term=term.replace(/\(Mus Musculus\)/i,"");term=term.replace(/\(Homo Sapiens\)/i,"");term=term.replace(/\(Rattus Norvegicus\)/i,"");return utils.trimSquare(term);},parseTerms:function(xml){var terms=[];try{var list=xml.getElementsByTagName("term");for(var i=0;i<list.length;++i)
terms[terms.length]=utils.getText(list[i]);}catch(e){}
this.info.terms=terms;},hasBooks:function(){return!!this.info.books&&!(this.info.books instanceof utils.Lazy);},getBooks:function(){if(this.info.books)
return this.info.books;var concept=this;var keywords=this.name();return this.info.books=new utils.Lazy(function(callback){function findBooks(publisher){linker.api.getBooks(keywords,publisher,concept,function(response){if((response.length===0)&&(publisher!=="")){findBooks("");}else{var maxbooks=(response.length<linker.state.options.books.max?response.length:linker.state.options.books.max);var list=[];for(var i=0;i<maxbooks;i++){var item=list[list.length]={title:response[i].ItemAttributes.Title,authors:[]};try{for(var j=0;j<response[i].ItemAttributes.Authors.length;++j){item.authors[item.authors.length]=response[i].ItemAttributes.Authors[j];}}catch(e){}
item.link=response[i].DetailPageURL;item.publisher=response[i].ItemAttributes.Manufacturer;item.asin='amazon/'+response[i].ASIN;}
concept.info.books=linker.state.options.books.cache?list:null;callback(list);}},function(error){callback(concept.info.books=null,error);});}
findBooks(PUBLISHER);});},setBooks:function(value){this.info.books=value;},hasProducts:function(){return!!this.info.products&&!(this.info.products instanceof utils.Lazy);},getProducts:function(){if(this.info.products)
return this.info.products;var concept=this;return this.info.products=new utils.Lazy(function(callback){linker.api.getProducts(concept.id,function(data){concept.info.products=linker.state.options.products.cache?data:null;callback(data);},function(error){callback(concept.info.products=null,error);});});},setProducts:function(value){this.info.products=value;},hasFactualConcepts:function(){return!!this.info.factualConcepts&&!(this.info.factualConcepts instanceof utils.Lazy);},getFactualConcepts:function(){if(this.info.factualConcepts)
return this.info.factualConcepts;var concept=this;return this.info.factualConcepts=new utils.Lazy(function(callback){linker.api.getFactualConcepts(concept.id,linker.state.options.factualConcepts.max,function(data){concept.info.factualConcepts=linker.state.options.factualConcepts.cache?data:null;callback(data);},function(error){callback(concept.info.factualConcepts=null,error);});});},setFactualConcepts:function(value){this.info.factualConcepts=value;},hasWebMD:function(){return!!this.info.webmd&&!(this.info.webmd instanceof utils.Lazy);},getWebMD:function(){if(this.info.webmd)
return this.info.webmd;var concept=this;return this.info.books=new utils.Lazy(function(callback){linker.api.getWebMD(concept,function(data){concept.info.webmd=linker.state.options.webmd.cache?data:null;callback(data);},function(error){callback(concept.info.books=null,error);});});},setWebMD:function(value){this.info.webmd=value;}});extend(this,{Fingerprint:function(offset){this.offset=offset;this.node=null;this.info=cache.FingerprintInfo.get(offset);this.concepts=[];this.shown=false;this.extractpositions();}});extend(this.Fingerprint,{has:function(offset){var c=cache.PageCache.has();return c&&c.fingerprints&&c.fingerprints['offset'+offset]||null;},get:function(offset){return this.has(offset)||this.put(new this(offset));},put:function(fp){var c=cache.PageCache.has();if(!c)
return null;if(!c.fingerprints)
c.fingerprints=[];fp.index=c.fingerprints.length;c.fingerprints['offset'+fp.offset]=fp;return c.fingerprints[fp.index]=fp;}});extend(this.Fingerprint.prototype,{addConcept:function(id){var concept=subject.Concept.get(id);this.concepts[concept.id]=concept;return this.concepts[this.concepts.length]=concept;},addWord:function(pos,text,clid,id,preferred){var word=this.info.words['offset'+pos];if(!word){word={pos:pos,len:text.length,text:text,clid:clid,concepts:[id],preferred:[]};this.info.words['offset'+pos]=word;this.info.words[this.info.words.length]=word;}
if(preferred&&(-1===utils.hasValue(word.preferred,id)))
word.preferred.push(id);if(!this.info.words['concept'+id])
this.info.words['concept'+id]=[word];else
this.info.words['concept'+id].push(word);return word;},extractpositions:function(){this.positions=[];var clusters={};for(var i=0,n=this.info.words.length;i<n;++i){var word=this.info.words[i];var cluster=clusters[word.clid];if(!cluster){cluster=clusters[word.clid]=this.positions[this.positions.length]={startPos:this.offset+word.pos,endPos:this.offset+word.pos+word.len,concepts:word.concepts,preferred:word.preferred};}else{cluster.startPos=Math.min(cluster.startPos,this.offset+word.pos);cluster.endPos=Math.max(cluster.endPos,this.offset+word.pos+word.len);}}
return this.positions;}});});linker.addModule("transport",["utils","log","state"],function(linker,transport){linker.extend(this,{NAME:"Linker Transportation Module",VERSION:"1.1"});var utils=linker.utils;var log=linker.log;var state=linker.state;var extend=linker.extend;if(!linker.pageTracker)
linker.pageTracker=linker.win.pageTracker;extend(this,{stack:[],api:{}});var api=this.api;extend(api,{'default':{prefix:'proxy/',postfix:'.py',method:'GET',type:'json',timeout:state.options.requests.timeout,retry:!!state.options.requests.retries,retryCount:state.options.requests.retries,retryTimeout:state.options.requests.retryTimeout,pre:null,post:null,prepare:null,options:{async:true,global:false}},index:{action:'index',method:'POST',timeout:state.options.requests.indexingTimeout},terms:{action:'getterms',type:'xml'},definition:{action:'getdefinition'},authors:{action:'getauthors'},publications:{action:'getpublications'},concepts:{action:'getFactualRelations'},destination:{action:'querydestination'},adtrack:{action:'adtracker'},popuptrack:{action:'popuptracker'},books:{action:'getbooks'},products:{action:'getproducts'},webmd:{action:'getwebmd'}});extend(this,{init:function(){},push:function(options){this.stack[this.stack.length]=options;return this;},pop:function(){return this.stack.pop();},wrap:function(options,callback){this.push(options);try{return callback.apply(this);}finally{this.pop();}},generate:function(request,stack){var options=extend({},request.options);stack=stack||this.stack;function map(value,name,obj){var old=obj[name];if('function'===typeof old){if('function'===typeof value){return function(){var r=value.apply(request,arguments);if(false===r)
return false;return old.apply(request,('object'===typeof r)&&r||arguments);};}
return value||old;}
return value;}
for(var i=0,n=stack.length;i<n;++i)
extend(options,stack[i],true,false,map);return options;}});extend(this,{makeRequest:function(name,data,callback,error,complete){if('undefined'===typeof this.api[name]){log.debug('No such API method: '+name);return;}
var data=extend({siteid:linker.siteid},data,true);var request=extend(extend({},this.api['default']),this.api[name],true);extend(request,{name:name,data:data,status:'starting',result:null,call:function(){return(request.prepare||function(code){return code.call(request,request.options);}).call(request,function(options){linker.jQuery.ajax(options);request.actualUrl=options.url;return this;});}});return transport.wrap({complete:function(){if(complete)
complete.apply(request);},error:function(){if(error)
error.call(request,request.result);},success:function(){if(callback)
callback.call(request,request.result);}},function(){return transport.wrap({callback:request.callback,error:request.error,success:request.success},function(){return(request.pre||function(code){return code.apply(request);}).call(request,function(){extend(request.options,{data:request.data||{},dataType:request.type||'json',timeout:request.timeout*1000,type:request.method&&request.method.toUpperCase()||'GET',url:HOST+'/'+request.prefix+request.action+request.postfix},true);return transport.wrap({complete:function(){if(('done'!==request.status)&&('error'!==request.status))
return false;request.status='complete';return true;},error:function(xhr,status,exception){request.status='error';request.result=exception||status;if(('timeout'===status)&&request.retry&&(0<request.retryCount)){request.status='retry';--request.retryCount;linker.win.setTimeout(function(){request.status='retrying';request.call();},request.retryTimeout);return false;}
return true;},success:function(data){if('done'===request.status)
return false;request.status='done';if('string'===typeof data){if('xml'===request.type){try{data=utils.getXMLDOM(data);}catch(e){}}else if('json'===request.type){try{data=eval("("+data+")");}catch(e){}}}
request.result=data;if(linker.pageTracker)
linker.pageTracker._trackPageview(request.actualUrl.replace(/^https?:\/\/[^\/]+/,''));return true;}},function(){return(request.post||function(code){return code.apply(request);}).call(request,function(){request.options=transport.generate(request);request.status='requesting';return request.call();});});});});});}});utils.addLinkerEvent("linkerInit",function(event){transport.init();});});linker.addModule("api","transport",function(linker,api){linker.extend(this,{NAME:"Linker API Module",VERSION:"1.1"});var transport=linker.transport;var extend=linker.extend;extend(this,{getIndex:function(id,text,callback,error,complete){transport.makeRequest('index',{id:id,text:text,option:3},function(data){callback(id,data);},error,complete);},getTerms:function(concept,destination,callback,error,complete){transport.makeRequest('terms',{text:concept.id||concept,querydestination:destination||''},callback,error,complete);},getDefinition:function(concept,callback,error,complete){transport.makeRequest('definition',{id:concept.id||concept},callback,error,complete);},getRelatedAuthors:function(list,callback,error,complete){transport.makeRequest('authors',{list:list.toString()},function(data){if(0!==data.status)
error(data.error);else
callback(data.response,list);},error,complete);},getRelatedPublications:function(list,callback,error,complete){transport.makeRequest('publications',{list:list.toString()},function(data){if(0!==data.status)
error(data.error);else
callback(data.response,list);},error,complete);},getFactualConcepts:function(list,max,callback,error,complete){transport.makeRequest('concepts',{list:list.toString(),show:max},function(data){if(0!==data.status)
error(data.error);else
callback(data.response,list);},error,complete);},queryDestination:function(destination,list,callback,error,complete){transport.makeRequest('destination',{querydestination:destination,knowletID:list.toString()},callback,error,complete);},adTrack:function(id,callback,error,complete){transport.makeRequest('adtrack',{asid:id},callback,error,complete);},popupTrack:function(reason,callback,error,complete){transport.makeRequest('popuptrack',{reason:reason},callback,error,complete);},getBooks:function(Keywords,Publisher,concept,callback,error,complete){transport.makeRequest('books',extend({Keywords:Keywords,knowletID:concept.id||concept},Publisher?{Publisher:Publisher}:{}),callback,error,complete);},getProducts:function(list,callback,error,complete){transport.makeRequest('products',{list:list.toString()},function(data){if(0!==data.status)
error(data.error);else
callback(data.response[0].products);},error,complete);},getWebMD:function(concept,callback,error,complete){transport.makeRequest('webmd',{query:concept.name(),knowletID:concept.id},callback,error,complete);}});});linker.addModule("ui",["utils","log","state"],function(linker,ui){linker.extend(this,{NAME:"Linker User Interface Module",VERSION:"1.0"});var utils=linker.utils;var log=linker.log;var state=linker.state;linker.extend(this,{caller:""});linker.extend(this,{GetDefinitionFromWiki:function(callback,concept){utils.Lazy.wait([concept.getDefinition()],function(definition){callback(definition,concept);},50,function(error){callback(state.options.requests.error,concept);});},changeSelection:function(event){var target=event.target;var cui=utils.getData(target,'cui');var savedConcept=state.getSavedConcept(cui);if(savedConcept&&(savedConcept.selected===target.checked))
return;ui.selectConcept([cui],false);},ExtractSpecies:function(cui){var Species=null;if(cui.indexOf("uniprot")!=-1){var concept=linker.subject.Concept.get(cui);if(concept){var aTerm=concept.name();lpos=aTerm.length-1;if(aTerm.charAt(lpos)==")"){bpos=aTerm.lastIndexOf("(");if(bpos!=-1){Species=aTerm.substring(bpos+1,lpos);}}}}
return Species;},adjustForSpecies:function(cui,aTerm){var Species=ui.ExtractSpecies(cui);if(Species){var bpos=aTerm.lastIndexOf("(");aTerm=aTerm.substring(0,bpos-1)+"<font size=-3>"+" (<i>"+Species+"</i>\)"+"</font>";}
return aTerm;},openHelp:function(){var url=LANDINGPAGE;if("undefined"!==typeof window.openWikifyHelp)
url=openWikifyHelp();if(url){if(!url.match(/^https?:\/\//))
url="http://"+url;ui.openURL(url,true);}},truncateDefinition:function(text){try{if(text.length>80){for(var i=80;i<text.length;i++){if(text.charAt(i)==" "){text=text.slice(0,i)+"...";break;}}}
return text;}
catch(e){return text;}},IsUMLSAbove2M:function(conceptId){var elts=conceptId.split("/");if((elts[0]=="umls")&&(parseInt(elts[1].slice(1),10)>=2000000)){return true;}
else{return false;}},insertRules:function(rules,root){root=root||'body';var rex=/:root/;if(linker.processDocument.createStyleSheet){var style=linker.processDocument.createStyleSheet();for(var i=0,n=rules.length;i<n;++i){var rule=rules[i];var rs=rule.rule.split(',');for(var j=0;j<rs.length;++j){for(var key in rule.styles){if(!rule.styles.hasOwnProperty(key))
continue;try{style.addRule(rs[j].replace(rex,root),key+':'+rule.styles[key]);}catch(e){throw e;}}}}}else{var fileref=linker.processDocument.createElement("style");fileref.setAttribute("type","text/css");linker.processDocument.getElementsByTagName("head")[0].appendChild(fileref);var style=fileref.sheet||linker.processDocument.styleSheets[linker.processDocument.styleSheets.length-1];for(var i=0,n=rules.length;i<n;++i){var rule=rules[i];var rs=[];for(var key in rule.styles){if(!rule.styles.hasOwnProperty(key))
continue;rs[rs.length]=key+':'+rule.styles[key];}
style.insertRule(rule.rule.replace(rex,root)+' { '+rs.join(';')+' }',style.cssRules.length);}}},insertStyle:function(){if(linker.processDocument.createStyleSheet){var style=linker.processDocument.createStyleSheet(linker.wikifypath("css/menu.css"));}else{var fileref=linker.processDocument.createElement("link");fileref.setAttribute("rel","stylesheet");fileref.setAttribute("type","text/css");fileref.setAttribute("href",linker.wikifypath("css/menu.css"));linker.processDocument.getElementsByTagName("head")[0].appendChild(fileref);}
var rules=[];if(linker.state.options.coloring.show){if(false===linker.state.options.coloring.fade){rules[rules.length]={rule:'font.wikifier-orange-node',styles:{color:linker.state.options.coloring.types.behavior}};rules[rules.length]={rule:'font.wikifier-blue-node',styles:{color:linker.state.options.coloring.types.anatomy}};rules[rules.length]={rule:'font.wikifier-turquoise-node',styles:{color:linker.state.options.coloring.types.chemicals}};rules[rules.length]={rule:'font.wikifier-red-node',styles:{color:linker.state.options.coloring.types.diseases}};rules[rules.length]={rule:'font.wikifier-yellow-node',styles:{color:linker.state.options.coloring.types.genes}};rules[rules.length]={rule:'font.wikifier-pink-node',styles:{color:linker.state.options.coloring.types.physiology}};rules[rules.length]={rule:'font.wikifier-green-node',styles:{color:linker.state.options.coloring.types.living}};rules[rules.length]={rule:'font.wikifier-purple-node',styles:{color:linker.state.options.coloring.types['new']}};rules[rules.length]={rule:'font.wikifier-gray-node',styles:{color:linker.state.options.coloring.types.other}};if('transparent'!==linker.state.options.coloring['background-color']){rules[rules.length]={rule:'font.wikihighlight',styles:{'background-color':linker.state.options.coloring['background-color']}};}}else{rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-orange-node, font.wikifier-coloring-show font.wikifier-orange-node',styles:{color:linker.state.options.coloring.types.behavior}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-blue-node, font.wikifier-coloring-show font.wikifier-blue-node',styles:{color:linker.state.options.coloring.types.anatomy}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-turquoise-node, font.wikifier-coloring-show font.wikifier-turquoise-node',styles:{color:linker.state.options.coloring.types.chemicals}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-red-node, font.wikifier-coloring-show font.wikifier-red-node',styles:{color:linker.state.options.coloring.types.diseases}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-yellow-node, font.wikifier-coloring-show font.wikifier-yellow-node',styles:{color:linker.state.options.coloring.types.genes}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-pink-node, font.wikifier-coloring-show font.wikifier-pink-node',styles:{color:linker.state.options.coloring.types.physiology}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-green-node, font.wikifier-coloring-show font.wikifier-green-node',styles:{color:linker.state.options.coloring.types.living}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-purple-node, font.wikifier-coloring-show font.wikifier-purple-node',styles:{color:linker.state.options.coloring.types['new']}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-gray-node, font.wikifier-coloring-show font.wikifier-gray-node',styles:{color:linker.state.options.coloring.types.other}};if('transparent'!==linker.state.options.coloring['background-color']){rules[rules.length]={rule:'body.wikifier-coloring-show font.wikihighlight, font.wikifier-coloring-show',styles:{'background-color':linker.state.options.coloring['background-color']}};}}}
if(linker.state.options.highlighting.show){rules[rules.length]={rule:'font.wikihighlight',styles:{'border-bottom-style':linker.state.options.highlighting.underline.style}};if('concept'===linker.state.options.highlighting.underline.color){rules[rules.length]={rule:'font.wikifier-orange-node',styles:{'border-bottom-color':linker.state.options.coloring.types.behavior}};rules[rules.length]={rule:'font.wikifier-blue-node',styles:{'border-bottom-color':linker.state.options.coloring.types.anatomy}};rules[rules.length]={rule:'font.wikifier-turquoise-node',styles:{'border-bottom-color':linker.state.options.coloring.types.chemicals}};rules[rules.length]={rule:'font.wikifier-red-node',styles:{'border-bottom-color':linker.state.options.coloring.types.diseases}};rules[rules.length]={rule:'font.wikifier-yellow-node',styles:{'border-bottom-color':linker.state.options.coloring.types.genes}};rules[rules.length]={rule:'font.wikifier-pink-node',styles:{'border-bottom-color':linker.state.options.coloring.types.physiology}};rules[rules.length]={rule:'font.wikifier-green-node',styles:{'border-bottom-color':linker.state.options.coloring.types.living}};rules[rules.length]={rule:'font.wikifier-purple-node',styles:{'border-bottom-color':linker.state.options.coloring.types['new']}};rules[rules.length]={rule:'font.wikifier-gray-node',styles:{'border-bottom-color':linker.state.options.coloring.types.other}};}else{rules[rules.length]={rule:'font.wikihighlight',styles:{'border-bottom-color':linker.state.options.highlighting.underline.color}};if(!linker.state.options.highlighting.underline.stay){rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-orange-node, font.wikifier-coloring-show font.wikifier-orange-node',styles:{'border-bottom-color':linker.state.options.coloring.types.behavior}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-blue-node, font.wikifier-coloring-show font.wikifier-blue-node',styles:{'border-bottom-color':linker.state.options.coloring.types.anatomy}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-turquoise-node, font.wikifier-coloring-show font.wikifier-turquoise-node',styles:{'border-bottom-color':linker.state.options.coloring.types.chemicals}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-red-node, font.wikifier-coloring-show font.wikifier-red-node',styles:{'border-bottom-color':linker.state.options.coloring.types.diseases}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-yellow-node, font.wikifier-coloring-show font.wikifier-yellow-node',styles:{'border-bottom-color':linker.state.options.coloring.types.genes}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-pink-node, font.wikifier-coloring-show font.wikifier-pink-node',styles:{'border-bottom-color':linker.state.options.coloring.types.physiology}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-green-node, font.wikifier-coloring-show font.wikifier-green-node',styles:{'border-bottom-color':linker.state.options.coloring.types.living}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-purple-node, font.wikifier-coloring-show font.wikifier-purple-node',styles:{'border-bottom-color':linker.state.options.coloring.types['new']}};rules[rules.length]={rule:'body.wikifier-coloring-show font.wikifier-gray-node, font.wikifier-coloring-show font.wikifier-gray-node',styles:{'border-bottom-color':linker.state.options.coloring.types.other}};}}}
this.insertRules(rules);},openURL:function(argument,newtab){if(null!==linker.processWindow){ui.truepopdown('open link');linker.processWindow.open(argument,(linker.wikify()&&!newtab)?'_self':'_blank',"",false);}},openWikiURL:function(node,argument){truepopdown('open link to wiki');linker.processWindow.open(argument,(linker.wikify()?'_self':'_blank'),"");},createLogoButton:function(processDocument,menu){},createAdButton:function(processDocument,menu){}});linker.extend(ui,{getAbsolutePosition:function(element){var r={x:element.offsetLeft,y:element.offsetTop};if(element.offsetParent){var tmp=arguments.callee(element.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}
return r;},getX:function(doc,elt){var id=elt.id;return doc.getElementById(id).offsetLeft;},getY:function(doc,elt){var id=elt.id;return doc.getElementById(id).offsetTop;},getHeight:function(doc,elt){var id=elt.id;return doc.getElementById(id).offsetHeight;},getWidth:function(doc,elt){var id=elt.id;return doc.getElementById(id).offsetWidth;},pageWidth:function(aWindow,aDocument){return aWindow.innerWidth!==null?aWindow.innerWidth:aDocument.documentElement&&aDocument.documentElement.clientWidth?aDocument.documentElement.clientWidth:aDocument.body!==null?aDocument.body.clientWidth:null;},pageHeight:function(aWindow,aDocument){return aWindow.innerHeight!==null?aWindow.innerHeight:aDocument.documentElement&&aDocument.documentElement.clientHeight?aDocument.documentElement.clientHeight:aDocument.body!==null?aDocument.body.clientHeight:null;},posLeft:function(){return typeof window.frames['contentframe'].pageXOffset!=="undefined"?window.frames['contentframe'].pageXOffset:document.documentElement&&document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft?document.body.scrollLeft:0;},posTop:function(){return typeof window.frames['contentframe'].pageYOffset!=="undefined"?window.pageYOffset:document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop?document.body.scrollTop:0;}});linker.extend(this,{getSelectedCuiList:function(){var savedConcepts=state.getSavedConcepts();var cuiList=[];for(var i=0;i<savedConcepts.length;i++){if(savedConcepts[i].selected)
cuiList[cuiList.length]=savedConcepts[i].cui;}
return cuiList;},ExpandConcepts:function(pre,post){var savedConcepts=state.getSavedConcepts();var terms="";for(var i=0;i<savedConcepts.length;i++){if(savedConcepts[i].selected)
terms+=pre+savedConcepts[i].name+post;}
return terms;},openSearchResult:function(url){ui.openSearchResultWindow(url);},FindSpecies:function(Species,conceptList){for(var i=0;i<conceptList.length;i++){var species=ui.ExtractSpecies(conceptList[i]);if(species){if(species.toLowerCase()==Species)
return i;}}
return-1;},FindHomologue:function(conceptList){var selected=-1;if(conceptList!==null){selected=ui.FindSpecies("homo sapiens",conceptList);if(selected==-1){selected=ui.FindSpecies("mus musculus",conceptList);}}
if(selected!=-1)
return conceptList[selected];return null;},ShowHighlight:function(node,selected){node.style.backgroundColor=selected?linker.state.options.selected['background-color']:'transparent';},RouteViaProxy:function(url){if(linker.wikifybutton()){return'default.py?url='+escape(url);}else{return url;}},getSelectedNodes:function(cui){var cache=linker.cache.PageCache.has();res=[];for(var c=0;c<cache.highlightnodes.length;c++){var ids=utils.getData(cache.highlightnodes[c][0],'position').concepts;for(var i=0;i<ids.length;i++){if(cui==ids[i]){res[res.length]=linker.highlighting.getFontNode(cache.highlightnodes[c][0]);break;}}}
return res;},ExpandSearchArguments:function(cuiList,pre,post,maxlen,callback,destination,separator){var cuiTerms=[];separator=separator||' OR ';for(var i=0;i<cuiList.length;i++){var concept=linker.subject.Concept.get(cuiList[i]);cuiTerms[cuiTerms.length]=concept.getTerms(destination);}
utils.Lazy.wait(cuiTerms,function(){var len=0;var l=0;loop:while(true){var old=len;for(var p=0;p<cuiTerms.length;++p){if(l<cuiTerms[p].length){cuiTerms[p][l]=escape(cuiTerms[p][l]);if(0===l)
len+=pre.length+cuiTerms[p][l].length+post.length;else
len+=4+cuiTerms[p][l].length;if(len>maxlen)
break loop;}}
if(old==len)
break;++l;}
var text="";for(var i=0;i<cuiTerms.length;++i)
text+=pre+cuiTerms[i].slice(0,(i<p)?l+1:l).join(separator)+post;callback(text);},50,function(){log.debug("Error while getting terms, search aborted");});},openSearchResultWindow:function(url){var target="_blank";if(linker.wikifybutton())
target="_self";else if(linker.wikify())
target="contentframe";return linker.processWindow.open(url,target);},mit_enrich:function(rev){if(!window)
return-5;var navigationframe=window.frames["navigationframe"];if(navigationframe){if(!navigationframe.document)
return-7;var iframeNode=navigationframe.document.getElementById("wikifier-toolbar");if(!iframeNode)
return-8;var widget=navigationframe.document.getElementById("wikifier-enrich");if(!widget)
return-9;}
var contentframe=window.frames['dynamic']||window.frames['contentframe'];if(!contentframe)
return-4;if(!contentframe.location)
return-3;if(!contentframe.location.href)
return-2;var app="";var href=contentframe.location.href;if(-1<href.indexOf("caller=CWButton"))
ui.caller="CWButton";var pos=href.indexOf("application=");if(-1<pos){app=href.substr(pos+12);pos=app.indexOf("&");if(-1<pos)
app=app.substr(0,pos);}
HOST=HOST.replace(/\/$/,"");if(window.linker_log)
utils.fireLinkerEvent("linkerLogInit",[window.linker_log]);linker.initpage(contentframe,"proxy_"+rev,app);if(iframeNode)
utils.fireLinkerEvent("linkerPanelInit",[iframeNode]);if(!widget||widget.checked)
linker.parsing.SiteSpecificHandling();return 0;},resetInitialization:function(){if(window!==null){if(window.frames['dynamic']!==null){contentframe=window.frames['dynamic'];}else if(window.frames['contentframe']!==null){contentframe=window.frames['contentframe'];}
contentframe.initialized=false;}}});linker.extend(this,{search:function(url,options){if(options.proxy)
url=HOST+"/"+ui.RouteViaProxy("nph-proxy.cgi/"+(options.flags||linker.nphflags)+url.replace(/^([^:]+):\/\//,"/$1/"))+"&caller="+escape(ui.caller)+"&application="+escape(linker.application);ui.openSearchResultWindow(url);},CRISPCB:function(list,options){linker.api.queryDestination("CRISP",list,function(){var terms=ui.ExpandConcepts(""," ");ui.search("http://crisp.cit.nih.gov/crisp/crisp_lib.query?p_keywords="+terms+"&p_opr=or&p_expansion=none&p_maxhit=250&p_state=&p_irg=&p_fy=2008%2C&p_icd=&p_nlast=&p_nfirst=&p_type=&p_activity=&p_grant=&p_title=&p_irg1=&p_icd1=&p_inst=&p_fy1=2008&p_state1=&p_query=("+terms+")&ticket=58810770&p_audit_session_id=296504978&p_audit_query_type=ASQ&p_test_mode=N",options);});},NIHGrantsCB:function(list,options){linker.api.queryDestination("NIH Grants",list,function(){var terms=ui.ExpandConcepts("",",");ui.search("http://grants.nih.gov/grants/guide/search_results.htm?scope=rfa&scope=pa&year=active&text_curr="+terms+"&Search.x=30&Search.y=7",options);});},GoogleCB:function(list,options){ui.ExpandSearchArguments(ui.getSelectedCuiList(),"%2b(",") ",500,function(text){ui.search("http://www.google.com/search?q="+text,options);},"Google");},YahooCB:function(list,options){ui.ExpandSearchArguments(list,"%2b(",") ",1024,function(text){ui.search("http://search.yahoo.com/search?p="+text,options);},"Yahoo");},GoogleScholarCB:function(list,options){ui.ExpandSearchArguments(list,"%2b(",") ",500,function(text){ui.search("http://scholar.google.com/scholar?q="+text,options);},"Google Scholar");},GooglePatentCB:function(list,options){ui.ExpandSearchArguments(list,"%2b(",") ",500,function(text){ui.search("http://www.google.com/patents?q="+text,options);},"Google Patent");},BMCCB:function(list,options){linker.api.queryDestination("BioMedCentral",list,function(){var terms=ui.ExpandConcepts(""," ");ui.search("http://www.biomedcentral.com/search/results.asp?terms="+terms+"&drpPhrase1=and&type=bmc_advanced_results&chkBMCJournals=true&chkCurrentOpinion=true&chkNSP=true&Search.x=10",options);});},SpringerLinkCB:function(list,options){linker.api.queryDestination("SpringerLink",list,function(){var terms=ui.ExpandConcepts(""," ");ui.search("http://www.springerlink.com/content/=3fk=3d"+terms,options);});},PubMedCB:function(list,options){linker.api.queryDestination("PubMed",list,function(){var terms=ui.ExpandConcepts(""," ");ui.search("http://www.ncbi.nlm.nih.gov/sites/entrez?Db=pubmed&Cmd=Search&Term="+terms+"&itool=EntrezSystem2.PEntrez.Pubmed.Pubmed_ResultsPanel.Pubmed_RVAbstractPlus",options);});}});utils.addLinkerEvent("linkerPageInit",function(event){if(utils.getData(linker.processWindow,"initialized"))
return;ui.addPopup();ui.insertStyle();utils.setData(linker.processWindow,"initialized",true);});utils.addLinkerEvent("linkerPanelInit",function(event,panel){utils.addEvent(panel,"mouseenter",function(){linker.utils.fireLinkerEvent("linkerPanelOver");});utils.addEvent(panel,"mouseleave",function(){linker.utils.fireLinkerEvent("linkerPanelOut");});},true);utils.addLinkerEvent("linkerIndexingStart linkerHighlightingStart",function(event){ui.truepopdown('indexing start');});utils.addLinkerEvent("linkerStateChanged",function(event){linker.jQuery("#wikifier-toolbar",linker.getNavigationDocument()).css("display",linker.state.is_visible?"":"none");});});linker.addModule("ui.pb",["utils"],function(linker,ui){linker.extend(this,{NAME:"Linker User Interface Progress Bar Module",VERSION:"1.0"});var utils=linker.utils;linker.extend(this,{progressBar:null,progressBarTimeout:null});linker.extend(this,(function(){var progressSteps=0.0;return{setProgressPB:function(current){progressSteps=current||0.0;if("none"==ui.progressBar.style.display)
return;if(progressSteps>=1.0)
progressSteps=0.0;try{setPercent(ui.progressBar,progressSteps);}catch(e){}
linker.win.setTimeout(function(){ui.setProgressPB(progressSteps+0.01);},200);}};})());linker.extend(this,{getProgressBarDocument:function(){return linker.getNavigationDocument();},initPB:function(){var d=ui.getProgressBarDocument();var parentNode=d.getElementById("wikifier-toolbar");var highlightbutton=d.getElementById("wikifier-legend");if(0===highlightbutton.offsetLeft)
return false;var offset=linker.jQuery(highlightbutton).offset();var x=offset.left;var y=offset.top;var width=parentNode.offsetWidth;ui.progressBar=jt_ProgressBar(d,parentNode,x,y+1,width-x-10,18);ui.startPB();return true;},startPB:function(){ui.setProgressPB(0.0);},showPB:function(msg){if("undefined"==typeof jt_ProgressBar)
return;if(!ui.progressBar&&!ui.initPB()){if(ui.progressBarTimeout){linker.win.clearTimeout(ui.progressBarTimeout);ui.progressBarTimeout=null;}
ui.progressBarTimeout=linker.win.setTimeout(function(){ui.progressBarTimeout=null;if(ui.initPB())
ui.showPB(msg);else
ui.progressBarTimeout=linker.win.setTimeout(arguments.callee,50);},50);return;}
if("none"==ui.progressBar.style.display){ui.progressBar.style.display="block";ui.startPB();}
ui.setProgressBarMessage(msg);linker.jQuery("#wikifier-legend:visible",ui.getProgressBarDocument()).hide();},hidePB:function(){if("undefined"==typeof jt_ProgressBar)
return;if(!ui.progressBar){if(ui.progressBarTimeout){linker.win.clearTimeout(ui.progressBarTimeout);ui.progressBarTimeout=null;}
return;}
ui.progressBar.style.display="none";linker.jQuery("#wikifier-legend:hidden",ui.getProgressBarDocument()).show();},setProgressBarMessage:function(msg){ui.progressBar.childNodes[1].childNodes[0].nodeValue=msg;}});utils.addLinkerEvent("linkerPanelInit",function(event,panel){utils.addLinkerEvent("linkerProgress",function(event,message){if(message)
ui.showPB(message);else
ui.hidePB();});},true);});linker.addModule("ui.widget",["utils.class","utils.jquery","utils"],function(linker,ui){linker.extend(this,{NAME:"Linker User Interface Widget Module",VERSION:"1.0"});var $=linker.jQuery;var utils=linker.utils;var Class=utils.Class;linker.extend(ui,{controlID:0});if('object'!==typeof this.controls)
this.controls={};(function(controls){controls.Base=Class.Base;controls.Control=controls.Base.create({__init:function(){this._controlID=++ui.controlID;this._controls={};},__free:function(){if(this._parent)
this.setParent(null);for(var id in this._controls){if(this._controls.hasOwnProperty(id)&&this._controls[id].instanceOf(Class.Base))
this._controls[id].__destroy();}},getChildren:function(){return this._controls;},add:function(){for(var i=0,n=arguments.length;i<n;++i){var control=this.asClass(arguments[i],controls.Control);if(control)
control.setParent(this);}
return this;},empty:function(){for(var key in this._controls){if(this._controls.hasOwnProperty(key))
this._controls[key].setParent(null);}},attach:function(control){this._controls[control.getID()]=control;return this;},dettach:function(control){delete this._controls[control.getID()];return this;},getID:function(){return this._controlID;},getParent:function(){return this._parent;},setParent:function(parent){if(this._parent)
this._parent.dettach(this);this._parent=parent&&parent.asClass(controls.Control)||null;if(this._parent)
this._parent.attach(this);return this;}});})(this.controls);if('object'!==typeof this.widgets)
this.widgets={};(function(widgets){widgets.PageControl=ui.controls.Control.create({__tagName:'div',__id:undefined,__className:['wikifier-ui-control'],__corners:'none',__attributes:{},__styles:{},__events:{},__width:undefined,__height:undefined,__initialize:function(opts,styles,events){var context=arguments.callee.__context;this._elements={};this._theme=null;this.extend(opts);this.extend(this.__styles,styles);this.extend(this.__events,events);this._panel=this.create(this.__tagName).addClass(this.__className.join(' ')).addClass('wikifier-ui-corner-'+this.__corners);context.__base.apply(this);if('undefined'===typeof this.__id)
this.__id='wikifier-ui-'+this.getID();this.getBox().attr('id',this.__id);this.getPanel().attr(this.__attributes).css(this.__styles);this.bindEvents(this.__events);this.setSize(this.__width,this.__height);},getBox:function(){return this._panel;},getPanel:function(){return this._panel;},_getContent:function(){return this;},getContent:function(name){if(name)
return this.getContent().getElement(name);return this._getContent();},addContent:function(name,control){this.getContent().addElement(name,control);return this;},getPlace:function(control){return this._panel;},addAttributes:function(attrs){this._panel.attr(attrs||{});},addStyles:function(styles){this._panel.css(styles||{});},create:function(tag){var element=$.create(tag||'div');utils.setData(element[0],'control',this);return element;},attach:function(control){var context=arguments.callee.__context;context.__base.apply(this,arguments);if(control.instanceOf(ui.widgets.PageControl))
control.getBox().appendTo(this.getPlace(control));return this;},dettach:function(control){var context=arguments.callee.__context;if(control.instanceOf(ui.widgets.PageControl))
control.getBox().remove();context.__base.apply(this,arguments);return this;},_show:function(){this.getBox().show();},show:function(show){show=('undefined'===typeof show)?true:show;if(!show)
return this.hide();this._show();this.fire('linkerShow');return this;},_hide:function(){this.getBox().hide();},hide:function(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)&&this._controls[id].instanceOf&&this._controls[id].instanceOf(widgets.Block))
this._controls[id].hide();}
this._hide();this.fire('linkerHide');return this;},fire:function(type,data){utils.fireEvent(this.getPanel(),type,data);return this;},bind:function(type,listener,once,data){utils.addEvent(this.getPanel(),type,listener,once,data);return this;},unbind:function(type,listener){utils.removeEvent(this.getPanel(),type,listener);return this;},bindEvents:function(events){for(var event in events){if(events.hasOwnProperty(event))
this.bind(event,events[event]);}
return this;},addElement:function(name,control){this.add(control);this._elements[name]=control.getID();return this;},getElement:function(name){if('undefined'===typeof this._elements[name])
return null;var id=this._elements[name];if('undefined'===typeof this._controls[id])
return null;return this._controls[id];},addClass:function(cls){this.getPanel().addClass(cls);return this;},setClass:function(cls,switcher){this.getPanel().setClass(cls,switcher);return this;},removeClass:function(cls){this.getPanel().removeClass(cls);return this;},addContentClass:function(cls){this.getContent().addClass(cls);return this;},setContentClass:function(cls,switcher){this.getContent().setClass(cls,switcher);return this;},removeContentClass:function(cls){this.getContent().removeClass(cls);return this;},getWidth:function(){return this.getPanel().width();},getHeight:function(){return this.getPanel().height();},getSize:function(){var box=this.getPanel();return{width:box.width(),height:box.height()};},setWidth:function(width){if('function'===typeof width)
width=width.apply(this);if('undefined'!==typeof width)
this.getPanel().width(width);return this;},setHeight:function(height){if('function'===typeof height)
height=height.apply(this);if('undefined'!==typeof height)
this.getPanel().height(height);return this;},setSize:function(width,height){return this.setWidth(width).setHeight(height);},getTheme:function(){return this._theme;},setParent:function(parent){var context=arguments.callee.__context;context.__base.apply(this,arguments);parent=this.getParent();if(parent)
this.applyTheme(parent.getTheme());return this;},applyTheme:function(theme,applied){if('string'===typeof theme)
theme=ui.themes.getTheme(theme);if('undefined'!==typeof theme)
this._theme=theme;if(!theme)
return;if(!applied)
theme.applyThemeToControl(this);for(var id in this._controls){if(this._controls.hasOwnProperty(id)&&this._controls[id].instanceOf&&this._controls[id].instanceOf(widgets.PageControl))
this._controls[id].applyTheme(theme,true);}}});widgets.Inline=widgets.PageControl.create({attach:function(control){var context=arguments.callee.__context;if(!control||!control.instanceOf(widgets.Inline))
throw'Control is not Inline';context.__base.apply(this,arguments);return this;},getContentHTML:function(){return this.getPanel().html();},setContentHTML:function(html){this.getPanel().html(html);this.fire('linkerResize');return this;}});widgets.InlineContent=widgets.Inline.create({__content:{__className:['wikifier-ui-content']},__contentHTML:'',__button:undefined,__buttons:undefined,__initialize:function(){var context=arguments.callee.__context;context.__base.apply(this,arguments);if(this.__button&&this.__button.__float){this.extend(this.__button,{__className:['wikifier-ui-button']});this.addElement('button',new widgets.Inline(this.__button));}
if(this.__buttons){for(var i=0;i<this.__buttons.length;++i){var button=this.__buttons[i];if(button.__float){this.extend(button,{__className:['wikifier-ui-button']});this.addElement('button'+i,new widgets.Inline(button));}}}
this.add(this._content=new widgets.Inline(this.__content));if(this.__contentHTML){this.setContentHTML(this.__contentHTML);this._content.applyTheme();}
if(this.__button&&!this.__button.__float){this.extend(this.__button,{__className:['wikifier-ui-button']});this.addElement('button',new widgets.Inline(this.__button));}
if(this.__buttons){for(var i=0;i<this.__buttons.length;++i){var button=this.__buttons[i];if(!button.__float){this.extend(button,{__className:['wikifier-ui-button']});this.addElement('button'+i,new widgets.Inline(button));}}}
this.create().css('clear','both').appendTo(this.getPanel());},_getContent:function(){return this._content;},getContentHTML:function(){return this.getContent().getContentHTML();},setContentHTML:function(html){this.getContent().setContentHTML(html);return this;},getButton:function(){return this.getElement('button');}});widgets.Block=widgets.PageControl.create({__x:0,__y:0,__box:{__styles:{position:'absolute','z-index':19000,'overflow':'visible'}},__initialize:function(){var context=arguments.callee.__context;this._box=this.create().addClass('wikifier-ui-control-place').css(this.__box.__styles);context.__base.apply(this,arguments);this._place=this.create().appendTo(this._box).css({'z-index':-1,position:'absolute'});this.getPanel().appendTo(this._box);var self=this;this.bind('linkerShow linkerHide',function(event){self.fire('linkerResize');});this.bind('linkerResize',function(event){self.resize();});this.setPosition(this.__x,this.__y);context=undefined;},getBox:function(){return this._box;},getPlace:function(control){if(!control)
return null;else if(control.instanceOf(widgets.Inline))
return this._panel;else if(control.instanceOf(widgets.Block))
return this._place;else
return null;},getX:function(){return this.__x;},getY:function(){return this.__y;},getPosition:function(){return{x:this.__x,y:this.__y};},setX:function(x,animate){this.setPosition(x,this.__y,animate);},setY:function(y,animate){this.setPosition(this.__x,y,animate);},_relocate:function(x,y){},setPosition:function(x,y,animate){this.__x=x||0;this.__y=y||0;this._relocate(x,y);var css={left:this.__x,top:this.__y};if(animate)
this.getBox().animate(css,animate);else
this.getBox().css(css);return this;},_resize:function(){},resize:function(){this._resize();for(var id in this._controls){if(this._controls.hasOwnProperty(id)&&this._controls[id].instanceOf&&this._controls[id].instanceOf(widgets.Block))
this._controls[id].resize();}}});widgets.Widget=widgets.Block.create({__className:'wikifier-ui-widget',__corners:'all',__width:400,__header:{__className:['wikifier-ui-widget-header'],__corners:'none',__contentHTML:'Linker Widget'},__content:{__className:['wikifier-ui-widget-content']},__initialize:function(){var context=arguments.callee.__context;context.__base.apply(this,arguments);if(this.__header)
this.addElement('header',new widgets.InlineContent(this.__header));this.addElement('content',this._content=new widgets.Inline(this.__content));if(this.__footer){this.extend(this.__footer,{__className:['wikifier-ui-widget-footer']});this.addElement('footer',new widgets.Inline(this.__footer));}},getHeader:function(){return this.getElement('header');},_getContent:function(){return this._content;},getFooter:function(){return this.getElement('footer');},getTitle:function(){return this.getHeader().getContentHTML();},setTitle:function(title){this.getHeader().setContentHTML(title||'');return this;},addContent:function(name,control){var context=arguments.callee.__context;context.__base.apply(this,arguments);control.addClass('wikifier-ui-widget-content-element');return this;}});widgets.Balloon=widgets.Widget.create({__className:'wikifier-ui-balloon',__corners:'none',__header:{__corners:'top'},__footer:{__corners:'bottom'}});widgets.AccordionElement=widgets.InlineContent.create({__initialize:function(owner,opts,styles,events){this._owner=owner;var context=arguments.callee.__context;context.__base.call(this,opts,styles,events);},_show:function(){var context=arguments.callee.__context;this.getParent().getParent().hideAccordion();context.__base.apply(this,arguments);}});widgets.Accordion=widgets.Balloon.create({__className:'wikifier-ui-accordion',__initialize:function(){var context=arguments.callee.__context;this._accordion={};context.__base.apply(this,arguments);},addContent:function(name,control){var context=arguments.callee.__context;context.__base.apply(this,arguments);if(control.instanceOf(widgets.AccordionElement)){control.hide();this._accordion[name]=control.getID();}
return this;},hideAccordion:function(){for(var name in this._accordion){if(this._accordion.hasOwnProperty(name)){var item=this.getContent(name);if(item._owner)
item._owner.close();else
item.hide();}}}});})(this.widgets);});linker.addModule("ui.theme",["utils.class","utils.jquery","utils","state"],function(linker,ui){linker.extend(this,{NAME:"Linker User Interface Theme Module",VERSION:"1.0"});var $=linker.jQuery;var utils=linker.utils;var Class=utils.Class;if('object'!==typeof this.themes)
this.themes={};(function(themes){linker.extend(themes,{list:{},addTheme:function(theme){if('string'===typeof theme){theme=themes[theme+'Theme']||themes[theme]||theme;if('string'===typeof theme)
throw'No such theme: '+theme;}
this.list[theme.prototype.__name]=theme;},getTheme:function(name){return this.list[name]||themes[name+'Theme']||null;}});themes.Theme=Class.Base.create({__name:'Unnamed',__ruleSets:[],__initialize:function(name,styles){this.__name=name||this.__name;if(styles){this.extend({__ruleSets:styles});}},getName:function(){return this.__name;},applyTheme:function(doc){var rules=Array.prototype.concat(this.__preRuleSets,this.__ruleSets,this.__postRuleSets);for(var i=0,n=rules.length;i<n;++i){var ruleSet=rules[i];if(ruleSet.req&&!ruleSet.req())
continue;$(ruleSet.rule,doc||linker.processDocument).css(ruleSet.styles);}},applyThemeToControl:function(control){if(!control||!control.instanceOf||!control.instanceOf(ui.widgets.PageControl))
return false;var rules=Array.prototype.concat(this.__preRuleSets,this.__ruleSets,this.__postRuleSets);var root='#'+control.__id;var rex=/:root/g;var list=control.getBox().find('*').andSelf();for(var i=0,n=rules.length;i<n;++i){var ruleSet=rules[i];if(ruleSet.req&&!ruleSet.req())
continue;list.filter(ruleSet.rule.replace(rex,root)).css(ruleSet.styles);}}});themes.addTheme(themes.Base=themes.Theme.create({__name:'Base',__preRuleSets:[{rule:'.wikifier-ui-control, .wikifier-ui-control *',styles:{padding:0,marging:0,color:'black',background:'transparent',font:'normal normal normal 13px Verdana, Arial',position:'static',overflow:'visible',border:'1px none black','text-align':'left'}}],__ruleSets:[{rule:'a.wikifier-ui-control, .wikifier-ui-control a',styles:{'text-decoration':'none'}},{rule:'b.wikifier-ui-control, .wikifier-ui-control b',styles:{'font-weight':'bold'}},{rule:'.wikifier-ui-content',styles:{padding:'4px'}},{rule:'.wikifier-ui-widget',styles:{background:'white','border-style':'solid'}},{rule:'.wikifier-ui-widget-header',styles:{cursor:'default'}},{rule:'.wikifier-ui-widget-header > .wikifier-ui-content',styles:{'float':'left','white-space':'nowrap',overflow:'hidden','font-size':'14px',cursor:'default'}},{rule:'.wikifier-ui-balloon',styles:{'border-style':'none'}},{rule:'.wikifier-ui-balloon > .wikifier-ui-widget-header',styles:{'border-style':'solid solid none solid'}},{rule:'.wikifier-ui-balloon > .wikifier-ui-widget-content',styles:{'border-style':'none solid'}},{rule:'.wikifier-ui-balloon > .wikifier-ui-widget-footer',styles:{'border-style':'none solid solid solid',height:linker.state.options.footer.size}},{rule:'.wikifier-ui-balloon > .wikifier-ui-widget-footer > div',styles:{'font-size':'10px',padding:'2px','text-align':'right'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-header > .wikifier-ui-content',styles:{padding:0,margin:'4px 10px',width:(linker.state.options.help.show?175:200)+'px'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-header > .wikifier-ui-button',styles:{padding:0,margin:0,'float':'right',cursor:'pointer'}},{rule:'.wikifier-ui-widget-content-element',styles:{position:'relative'}},{rule:'.wikifier-ui-widget-content-element > .wikifier-ui-content',styles:{cursor:'pointer'}},{rule:'.wikifier-ui-widget-content-element > .wikifier-ui-content, .wikifier-ui-button',styles:{position:'relative'},req:function(){return linker.browser.is_ie6;}},{rule:'.wikifier-ui-widget-content-element > .wikifier-ui-button',styles:{cursor:'pointer','float':'right',width:'20px',padding:'4px'}},{rule:'.wikifier-ui-popup-definition > .wikifier-ui-content',styles:{padding:'10px 6px 14px 6px','font-size':'11px',cursor:'default'}},{rule:'.wikifier-ui-popup-image-plus, .wikifier-ui-popup-image-check',styles:{'float':'left','margin-right':'5px','font-size':'1px',position:'relative'}},{rule:'.wikifier-ui-popup-simple > .wikifier-ui-content',styles:{'font-size':'12px',cursor:''}},{rule:'.wikifier-ui-popup-simple a',styles:{font:'normal normal normal 12px Verdana,Arial'}},{rule:'.wikifier-ui-popup-simple-list > .wikifier-ui-content',styles:{height:'150px',overflow:'auto'}},{rule:'.wikifier-ui-popup-experts-list > .wikifier-ui-content',styles:{height:'90px'}},{rule:'.wikifier-ui-popup-query > .wikifier-ui-content',styles:{'font-size':'12px',cursor:''}},{rule:'.wikifier-ui-popup-query a',styles:{font:'normal normal normal 12px Verdana,Arial'}},{rule:'.wikifier-ui-popup-query-list > .wikifier-ui-content',styles:{'font-size':'11px',height:'90px',overflow:'auto'}},{rule:'.wikifier-ui-popup-query-empty',styles:{'text-align':'right'}},{rule:'.wikifier-ui-popup-query-empty > .wikifier-ui-content',styles:{cursor:'pointer'}},{rule:'.wikifier-ui-popup-query-select > .wikifier-ui-button',styles:{'float':'left',width:'25px',height:'25px',background:'transparent url('+linker.wikifypath('img/search.png')+')'}},{rule:'.wikifier-ui-popup-query-select > .wikifier-ui-content',styles:{'float':'left',padding:'2px',color:'black',background:'white','border-style':'solid'}},{rule:'.wikifier-ui-popup-query-select > .wikifier-ui-content > option',styles:{color:'black'}},{rule:'.wikifier-ui-popup-concepts-list a',styles:{cursor:'pointer'}},{rule:'.wikifier-ui-popup-satelite > .wikifier-ui-widget-content',styles:{overflow:'hidden'}},{rule:'.wikifier-ui-popup-products a',styles:{'text-decoration':'underline'}}],__postRuleSets:[]}));themes.addTheme(themes.BlueTheme=themes.Base.create({__name:'Blue',__preRuleSets:[{rule:'.wikifier-ui-control, .wikifier-ui-control *',styles:{color:'white','border-color':'#075776'}}],__ruleSets:[{rule:'.wikifier-ui-widget',styles:{background:'#008dac'}},{rule:'.wikifier-ui-popup',styles:{background:'transparent'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-header',styles:{background:'#008dac url('+linker.wikifypath('img/header.png')+')',height:'45px'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-header > .wikifier-ui-button',styles:{'background-image':'url('+linker.wikifypath('img/close.png')+')',width:'22px',height:'22px',position:'relative',top:'-10px',left:'-5px'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-header > .wikifier-ui-popup-help',styles:{'background-image':'url('+linker.wikifypath('img/help.png')+')',width:'22px',height:'22px',top:'-10px',left:'-5px'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-content',styles:{background:'#199dbe url('+linker.wikifypath('img/content-bg.png')+') repeat-x'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-footer',styles:{background:'#095268'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-content > .wikifier-ui-widget-content-element > .wikifier-ui-content, .wikifier-ui-popup > .wikifier-ui-widget-content > .wikifier-ui-widget-content-element > .wikifier-ui-button',styles:{'border-top':'1px solid #59b0ca','border-bottom':'1px solid #0c5a74'}},{rule:'.wikifier-ui-popup-element-first > .wikifier-ui-content, .wikifier-ui-popup-element-first > .wikifier-ui-button',styles:{'border-top-width':0}},{rule:'.wikifier-ui-popup-element-last > .wikifier-ui-content, .wikifier-ui-popup-element-last > .wikifier-ui-button',styles:{'border-bottom-width':0,cursor:'default'}},{rule:'.wikifier-ui-popup-image-plus',styles:{'background-image':'url('+linker.wikifypath('img/plus.png')+')',width:'12px',height:'12px'}},{rule:'.wikifier-ui-popup-image-check',styles:{'background-image':'url('+linker.wikifypath('img/check.png')+')',width:'12px',height:'12px',display:'none'}},{rule:'.wikifier-ui-popup-satelite',styles:{color:'#008dac',background:'white'}},{rule:'.wikifier-ui-popup-satelite *',styles:{color:'#008dac'}}],__postRuleSets:[]}));themes.addTheme(themes.OldTheme=themes.Base.create({__name:'Old',__preRuleSets:[{rule:'.wikifier-ui-corner-tl, .wikifier-ui-corner-tr, .wikifier-ui-corner-bl, .wikifier-ui-corner-br, .wikifier-ui-corner-top, .wikifier-ui-corner-bottom, .wikifier-ui-corner-right, .wikifier-ui-corner-left, .wikifier-ui-corner-all',styles:{'-moz-border-radius-topleft':0,'-moz-border-radius-topright':0,'-moz-border-radius-bottomleft':0,'-moz-border-radius-bottomright':0,'-webkit-border-top-left-radius':0,'-webkit-border-top-right-radius':0,'-webkit-border-bottom-left-radius':0,'-webkit-border-bottom-right-radius':0}},{rule:'.wikifier-ui-control, .wikifier-ui-control *',styles:{color:'#3C514E','border-color':'#AAC4C2',font:'normal normal normal 12px Arial'}}],__ruleSets:[{rule:'.wikifier-ui-widget',styles:{background:'#EFF8F4'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-header',styles:{'font-size':'11px','font-weight':'bold'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-header > .wikifier-ui-button',styles:{'background-image':'url('+linker.wikifypath('img/close.gif')+')',width:'19px',height:'16px',position:'relative',top:'4px',left:0}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-content > .wikifier-ui-widget-content-element > .wikifier-ui-content, .wikifier-ui-popup > .wikifier-ui-widget-content > .wikifier-ui-widget-content-element > .wikifier-ui-button',styles:{background:'#DCF2ED','border-style':'solid none'}},{rule:'.wikifier-ui-popup > .wikifier-ui-widget-footer, .wikifier-ui-popup-element-content-last',styles:{display:'none'}},{rule:'.wikifier-ui-popup-definition > .wikifier-ui-content',styles:{background:'transparent','font-size':'11px'}},{rule:'.wikifier-ui-popup-image-plus',styles:{'background-image':'url('+linker.wikifypath('img/wikifier-add-icon.gif')+')',width:'14px',height:'14px'}},{rule:'.wikifier-ui-popup-image-check',styles:{'background-image':'url('+linker.wikifypath('img/wiki-icon.gif')+')',width:'14px',height:'14px',display:'none'}},{rule:'.wikifier-ui-popup-simple > .wikifier-ui-content',styles:{background:'#EFF8F4'}},{rule:'.wikifier-ui-popup-query > .wikifier-ui-content',styles:{background:'#EFF8F4'}}],__postRuleSets:[]}));themes.DefaultTheme=themes.BlueTheme;})(this.themes);});linker.addModule("ui.popup",["utils.jquery","ui.widget","ui.theme","utils","state"],function(linker,ui){linker.extend(this,{NAME:"Linker User Interface Popup Module",VERSION:"1.0"});var $=linker.jQuery;var utils=linker.utils;var state=linker.state;linker.extend(this,{popup:null});this.PopupList=ui.widgets.AccordionElement.create({__className:'wikifier-ui-popup-simple',__list:{__className:['wikifier-ui-popup-simple-list']},__initialize:function(){var context=arguments.callee.__context;context.__base.apply(this,arguments);this.addContent('loading',new ui.widgets.InlineContent({__contentHTML:'Loading...'}));this.addContent('list',this._list=new ui.widgets.InlineContent(this.__list));},getList:function(){return this._list;},addItem:function(item){this.getList().addContent(item.getID(),item);return this;},clear:function(){this.getList().hide().getContent().empty();this.getContent().getElement('loading').show();return this;},addError:function(msg){var context=arguments.callee.__context;context.__class.prototype.addItem.call(this,new ui.widgets.InlineContent({__contentHTML:msg||state.options.requests.error}));return this;},addEmpty:function(msg){var context=arguments.callee.__context;context.__class.prototype.addItem.call(this,new ui.widgets.InlineContent({__contentHTML:msg||"No data available"}));return this;}});this.RelatedExperts=this.PopupList.create({__className:'wikifier-ui-popup-experts',__list:{__className:'wikifier-ui-popup-experts-list'},addItem:function(name,link){var context=arguments.callee.__context;return context.__base.call(this,new ui.widgets.InlineContent({__contentHTML:'<a href="'+link+'" target="_blank">'+name+'</a>'}));}});this.RelatedPublications=this.PopupList.create({__className:'wikifier-ui-popup-publications',__list:{__className:'wikifier-ui-popup-publications-list'},addItem:function(name,link){var context=arguments.callee.__context;return context.__base.call(this,new ui.widgets.InlineContent({__contentHTML:'<a href="'+link+'" target="_blank">'+name+'</a>'}));}});this.FactualConcepts=this.PopupList.create({__className:'wikifier-ui-popup-concepts',__list:{__className:'wikifier-ui-popup-concepts-list'},addItem:function(item){var context=arguments.callee.__context;linker.cache.ConceptInfo.get(item[1],item[3],[],null);linker.subject.Concept.get(item[1]);context.__base.call(this,new ui.widgets.InlineContent({__contentHTML:item[0]+' '+item[2]+' '+item[3]+' (<a onclick="top.linker.ui.addQuery([\''+item[1]+'\'])">'+state.options.factualConcepts.link+'</a>)'}));return this;}});this.WebMD=this.PopupList.create({__className:'wikifier-ui-popup-webmd',__list:{__className:'wikifier-ui-popup-webmd-list'},addItem:function(item){var context=arguments.callee.__context;return context.__base.call(this,new ui.widgets.InlineContent({__contentHTML:'<a href="'+item.link+'" target="_blank">'+item.title+'</a><br />'+item.description}));},addMore:function(url){var context=arguments.callee.__context;context.__class.__super.prototype.addItem.call(this,new ui.widgets.InlineContent({__contentHTML:'<a href="'+url+'" target="_blank">'+state.options.webmd.link+'</a>'}));}});this.RelatedBooks=this.PopupList.create({__className:'wikifier-ui-popup-books',__list:{__className:'wikifier-ui-popup-books-list'},addItem:function(item){var context=arguments.callee.__context;var authorsList=item.authors.join(', ');if(0<item.authors.length)
authorsList='<small>by:&nbsp;</small>'+authorsList+'<br/>';return context.__base.call(this,new ui.widgets.InlineContent({__contentHTML:'<a href="'+item.link+'" onclick="top.linker.ui.openBook(\''+item.link+'\',\''+item.asin+'\'); return false;"><b>'+item.title+'</b><br/>'+authorsList+item.publisher+'</a>'}));}});this.PopupQuery=ui.widgets.InlineContent.create({__className:'wikifier-ui-popup-query',__list:{__className:['wikifier-ui-popup-query-list']},__empty:{__className:['wikifier-ui-popup-query-empty'],__contentHTML:'empty list',__content:{__tagName:'a',__events:{click:function(event){ui.clearQuery();event.stopPropagation();event.preventDefault();return false;}}}},__select:{__className:['wikifier-ui-popup-query-select'],__content:{__tagName:'select'},__button:{__className:['image'],__float:false,__events:{click:function(event){var list=ui.getSelectedCuiList();if(0===list.length){alert('You should select at least one concept.');}else{var self=utils.getData(this,'control').getParent().getParent().getParent();ui.truepopdown('going to search engine page');var engine=self.getSearchEngine();if(engine)
engine.callback(list,engine.options);}
event.stopPropagation();event.preventDefault();return false;}}}},__initialize:function(){var context=arguments.callee.__context;this._engines={};context.__base.apply(this,arguments);this.addContent('empty',new ui.widgets.InlineContent(this.__empty));this.addContent('list',this._list=new ui.widgets.InlineContent(this.__list));this.addContent('select',this._select=new ui.widgets.InlineContent(this.__select));var set=state.options.searchEnginesSets[state.options.searchEnginesSet];if(set){for(var i=0;i<set.length;++i){if('string'===typeof set[i]){set[i]={engine:set[i],proxy:true,flags:linker.nphflags};}
var name=set[i].engine;var engine=state.options.searchEngines[name];if(engine){if('string'===typeof engine)
engine=eval(engine);if(engine)
this.addSourceItem(name,engine,set[i]);}}}},getList:function(){return this._list;},addItem:function(cui,name,selected){var item=new ui.widgets.InlineContent({__contentHTML:'<input type="checkbox"'+(state.isConceptSelected(cui)?' checked="checked"':'')+' /> '+ui.adjustForSpecies(cui,name)});var checkbox=$('input[type=checkbox]',item.getPanel());utils.setData(checkbox,'cui',cui);utils.addEvent(checkbox,'click',ui.changeSelection);this.getList().addContent(item.getID(),item);return this;},clear:function(){this.getList().getContent().empty();return this;},addSourceItem:function(text,callback,options){this._engines[text]={callback:callback,options:options};var item=$.create('option',{className:'wikifier-source'},text).appendTo(this._select.getContent().getPanel());utils.setData(item[0],'engine',text);return this;},getSearchEngine:function(){var engine=utils.getData($(':selected',this._select.getContent().getPanel())[0],'engine');return engine&&this._engines[engine]||null;}});this.PopupSatelite=ui.widgets.Widget.create({__className:'wikifier-ui-popup-satelite',__corners:'right',__width:218,__x:22,__y:8,_show:function(){this.setPosition(261,8,{duration:500});},_hide:function(){var self=this;this.setPosition(22,8,{duration:500});},_resize:function(){if(this.getParent()){var h=this.getParent().getHeight();if(h)
this.getContent().setHeight(h-48);}},addItem:function(item){this.addContent(item.getID(),item);return this;},addError:function(msg){var context=arguments.callee.__context;context.__class.prototype.addItem.call(this,new ui.widgets.InlineContent({__contentHTML:msg||state.options.requests.error}));return this;},addEmpty:function(msg){var context=arguments.callee.__context;context.__class.prototype.addItem.call(this,new ui.widgets.InlineContent({__contentHTML:msg||"No data available"}));return this;}});this.PopupProducts=this.PopupSatelite.create({__className:'wikifier-ui-popup-products',__header:{__contentHTML:'Available products'},clear:function(){this.getContent().empty();return this;},addItem:function(product){var context=arguments.callee.__context;return context.__base.call(this,new ui.widgets.InlineContent({__contentHTML:'<b>'+product.name+'</b><br/><a href="'+product.outlink+'" target="_blank">Available from '+product.supplier+'</a>'+(product.description?'<br/>'+product.description:'')}));}});this.PopupLink=ui.widgets.InlineContent.create({__initialize:function(title,action,opts,styles,events){var context=arguments.callee.__context;var self=this;this._action=action||null;this.extend({__contentHTML:title,__content:{__events:{click:function(event){self.action();event.stopPropagation();event.preventDefault();return false;}}},__button:{__float:true,__events:{click:function(event){self.action();event.stopPropagation();event.preventDefault();return false;}}}});context.__base.call(this,opts,styles,events);this.getElement('button').getPanel().html('>');},action:function(){if(this._action)
this._action();}});this.PopupElement=ui.widgets.InlineContent.create({__initialize:function(title,open,close,opts,styles,events){var context=arguments.callee.__context;var self=this;this._open=open||null;this._close=close||null;this.extend({__contentHTML:title,__content:{__events:{click:function(event){self.action(true);event.stopPropagation();event.preventDefault();return false;}}},__button:{__float:true,__events:{click:function(event){self.action();event.stopPropagation();event.preventDefault();return false;}}}});context.__base.call(this,opts,styles,events);this._opened=false;this.getElement('button').getPanel().html('+');},action:function(open){open=('undefined'!==typeof open)?open:!this._opened;if(open)
this.open();else
this.close();},open:function(){if(this._open)
this._open();this._opened=true;this.getElement('button').getPanel().html('-');},close:function(){this._opened=false;this.getElement('button').getPanel().html('+');if(this._close)
this._close();}});this.Popup=ui.widgets.Accordion.create({__id:'wikifier-popup',__className:'wikifier-ui-popup',__width:262,__header:{__button:{__className:['image'],__float:false,__events:{click:function(event){ui.truepopdown('close button clicked');event.stopPropagation();event.preventDefault();return false;}}}},__modules:{addToQuery:function(self,options){if(!options.show)
return;self.addContent('addToQuery',new ui.PopupElement('<div class="wikifier-ui-popup-image-plus image"></div> <div>'+options.title+'</div>',function(){ui.selectConcept(self.getCuiList(),true);ui.showQueryDialog();},function(){self.getContent('popupQuery').hide();}));self.addContent('popupQuery',new ui.PopupQuery());},definition:function(self,options){if(!options.show)
return;self.addContent('definition',new ui.widgets.InlineContent({__className:'wikifier-ui-popup-definition',__content:{__events:{mouseenter:function(event){showhint(self.getDefinition(),self.getContent().getElement('definition').getPanel()[0],event,'300px');}}}}));},followLink:function(self,options){if(!options.show)
return;self.addContent('followLink',new ui.PopupLink('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openURL(self._link);}));},authors:function(self,options){if(!options.show)
return;self.addContent('relatedExperts',new ui.PopupElement('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openRelatedAuthors(self.getCuiList());},function(){self.getContent('relatedExpertsList').hide();}));self.addContent('relatedExpertsList',new ui.RelatedExperts(self.getContent('relatedExperts')));},publications:function(self,options){if(!options.show)
return;self.addContent('relatedPublications',new ui.PopupElement('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openRelatedPublications(self.getCuiList());},function(){self.getContent('relatedPublicationsList').hide();}));self.addContent('relatedPublicationsList',new ui.RelatedPublications(self.getContent('relatedPublications')));},factualConcepts:function(self,options){if(!options.show)
return;self.addContent('factualConcepts',new ui.PopupElement('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openFactualConcepts(self.getConcept());},function(){self.getContent('factualConceptsList').hide();}));self.addContent('factualConceptsList',new ui.FactualConcepts(self.getContent('factualConcepts')));},connectedConcepts:function(self,options){if(!options.show)
return;self.addContent('connectedConcepts',new ui.PopupLink('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openURL(self._conceptLink,true);}));},joinConceptWeb:function(self,options){if(!options.show)
return;self.addContent('joinConceptWeb',new ui.PopupLink('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openURL(CONCEPTWEBHOST+"/createProfile",true);}));},gotoWiki:function(self,options){if(!options.show)
return;self.addContent('gotoWiki',new ui.PopupLink('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openURL(ANNOTATION_WIKI+self.getConcept().id.replace(/.*\//,''),true);}));},springer:function(self,options){if(!options.show)
return;self.addContent('springer',new ui.PopupLink('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){var text=utils.getText(self._target);ui.openURL(options.link+encodeURI('"'+text+'"'),true);}));},webmd:function(self,options){if(!options.show)
return;self.addContent('webmd',new ui.PopupElement('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openWebMD(self.getConcept());},function(){self.getContent('webmdList').hide();}));self.addContent('webmdList',new ui.WebMD(self.getContent('webmd')));},books:function(self,options){if(!options.show)
return;self.addContent('books',new ui.PopupElement('<div class="wikifier-ui-popup-image-check image"></div> <div>'+options.title+'</div>',function(){ui.openRelatedBooks(self.getConcept());},function(){self.getContent('booksList').hide();}));self.addContent('booksList',new ui.RelatedBooks(self.getContent('books')));},products:function(self,options){if(!options.show)
return;self.addElement('productsList',(new ui.PopupProducts()).setTitle(options.title));}},__initialize:function(){var context=arguments.callee.__context;if(state.options.help.show){this.__header.__buttons=[{__className:['image','wikifier-ui-popup-help'],__float:false,__events:{click:function(event){ui.openURL(state.options.help.link,true);event.stopPropagation();event.preventDefault();return false;}}}];}
context.__base.apply(this,arguments);var exclude={};var list=[];for(var name in this.__modules){if('undefined'!==typeof state.options[name].order)
list[list.length]=name;}
list=list.sort(function(a,b){return state.options[a].order-state.options[b].order;});for(var i=0;i<list.length;++i)
this.__modules[list[i]](this,state.options[list[i]]);this.addContent('preFooter',new ui.widgets.InlineContent({__className:'wikifier-ui-popup-element-last'}));utils.getData(this.getContent().getPanel().children()[0],'control').addClass('wikifier-ui-popup-element-first');this.getElement('footer').getPanel().html('<div>'+state.options.footer.text+'</div>');this._hidden_elements=[];},getDefinition:function(){return this._definition;},setDefinition:function(definition){this._definition=definition;this.getContent().getElement('definition').setContentHTML(ui.truncateDefinition(this._definition));},setDirection:function(x,y){},setTarget:function(target){this._target=target;var position=utils.getData(target,'position');var cuiList=position.concepts;this.setCuiList(cuiList);var concept;var selected=ui.FindHomologue(cuiList);if(selected)
concept=linker.subject.Concept.get(selected);else
concept=linker.subject.Concept.get(position.preferred[0]);this.setConcept(concept);var cui=concept.id;var elts=cui.split('/');this._conceptLink=CONCEPTWEBHOST+'/conceptNavigator?knowletId='+cui;var url=utils.getData(target,'url')||'';this.setLink(url);},getConcept:function(){return this._concept;},setTitle:function(title){var context=arguments.callee.__context;context.__base.apply(this,arguments);var div=this.getHeader().getContent().getPanel()[0];linker.win.setTimeout(function(){if(div.offsetWidth<div.scrollWidth){div.innerHTML=div.innerHTML.replace(/\s+\S+\s*$/,'...');}else if(0<div.offsetWidth){return;}
linker.win.setTimeout(arguments.callee,10);},10);context=undefined;return this;},setConcept:function(concept){this._concept=concept;if(!concept)
return;var title=concept.name();this.setTitle(title);this.getHeader().getContent().addAttributes({title:title});},getCuiList:function(){return this._cuiList;},setCuiList:function(cuiList){this._cuiList=cuiList;},setLink:function(url){this._link=url;this.getContent().getElement('followLink').show(this._link);},_relocate:function(x,y){var context=arguments.callee.__context;context.__base.apply(this,arguments);this.checkPageElements(x,y,this.getBox().width(),this.getBox().height());},_resize:function(){var context=arguments.callee.__context;context.__base.apply(this,arguments);this.checkPageElements(this.__x,this.__y,this.getBox().width(),this.getBox().height());},checkPageElements:function(x,y,width,height){if(!x||!y||!width||!height){if(this._hidden_elements&&this._hidden_elements.length){linker.jQuery(this._hidden_elements).css('visibility','visible');this._hidden_elements=[];}
return;}
if(!this._hidden_elements)
this._hidden_elements=[];var nj=this._hidden_elements.length;var tags=['embed','object'];if(linker.browser.is_ie6)
tags.push('select');var elems=linker.jQuery(tags.join(','),linker.processDocument).filter(':not(.wikifier-ui-control)').get();loop:for(var i=0,n=elems.length;i<n;++i){var k=-1;for(var j=0;j<nj;++j){if(this._hidden_elements[j]===elems[i])
k=j;}
var elem=linker.jQuery(elems[i]);var pos=elem.offset();if((x+width<pos.left)||(y+height<pos.top)||(pos.left+elem.width()<x)||(pos.top+elem.height()<y)){if(-1<k){elem.css('visibility','visible');this._hidden_elements.splice(k,1);}
continue;}
if(-1<k)
continue;this._hidden_elements.push(elems[i]);elem.css('visibility','hidden');}}});linker.extend(this,{addPopup:function(){linker.win.setTimeout(function(){ui.popup=new ui.Popup();ui.popup.hide().getBox().appendTo(linker.processDocument.body);ui.theme=new(ui.themes.getTheme(state.options.theme));ui.popup.applyTheme(ui.theme);ui.popup.getBox().find('div.image').each(function(){IEPNGFix.process(this,1);});},0);},showQueryDialog:function(){var dialog=ui.popup.getContent('popupQuery');if(!dialog)
return;dialog.clear();try{var savedConcepts=state.getSavedConcepts();for(var i=savedConcepts.length-1;i>=0;i--){var cui=savedConcepts[i].cui;var name=savedConcepts[i].name;dialog.addItem(cui,name,savedConcepts[i].selected);}}catch(e){WriteDebugLine("issue with adding new queryitems",e);}
dialog.show(0<dialog.getList().getContent().getPanel().children().length);},addQuery:function(cuiList){ui.selectConcept(cuiList,false);ui.showQueryDialog();},selectConcept:function(list,override){if(!list)
return;var main=ui.FindHomologue(list)||list[0];for(var i=list.length-1;0<=i;--i){var savedConcept=state.getSavedConcept(list[i]);if(!savedConcept)
savedConcept=state.addSavedConcept(list[i],override||(list[i]===main));else
savedConcept.selected=override||!savedConcept.selected;var selectNodes=ui.getSelectedNodes(list[i]);for(var j=0;j<selectNodes.length;++j){var selected=savedConcept.selected;if(!selected){var ids=utils.getData(selectNodes[j].parentNode,'position').concepts;for(var k=0;k<ids.length;++k){if(ids[k]===list[i])
continue;var otherConcept=state.getSavedConcept(ids[k]);if(otherConcept&&otherConcept.selected){selected=true;break;}}}
ui.ShowHighlight(selectNodes[j],selected);}}},clearQuery:function(node){var savedConcepts=state.getSavedConcepts();for(var i=0;i<savedConcepts.length;i++){var selectNodes=ui.getSelectedNodes(savedConcepts[i].cui);for(var j=0;j<selectNodes.length;j++){selectNodes[j].style.backgroundColor=state.options.coloring['background-color'];}}
state.emptySavedConcepts();ui.popup.getContent('addToQuery').close();},truepopdown:function(reason){if(!ui.popup)
return;if(reason&&ui.popup.getBox().is(':visible'))
linker.api.popupTrack(reason);ui.popup.hide();ui.popup.checkPageElements(ui.popup.__x,ui.popup.__y,0,0);},setDefinition:function(text,concept){var info=null;if("string"==typeof concept)
concept=linker.subject.Concept.get(concept);var resultText=text;if(concept){var cuiList=ui.popup.getCuiList();var ignore=true;for(var q=0;q<cuiList.length;++q){if(concept.id==cuiList[q])
ignore=false;}
if(ignore)return;info=concept.info.definitionInfo;}
var defaultDefinition=state.options.definition.empty;ui.popup._definitionInfo=info;if(info&&info.outlink)
ui.popup._conceptLink=info.outlink;resultText=resultText||defaultDefinition;ui.popup.setDefinition(resultText);var hint=linker.processDocument.getElementById("hintbox");if(hint)
hint.innerHTML=resultText;},contextShow:function(event,target,popup){target=$(target);var win=$(linker.processWindow);var rects;if(target[0].getClientRects){rects=target[0].getClientRects();}else{var offset=target.offset();rects=[{left:offset.left-win.scrollLeft(),top:offset.top-win.scrollTop()}];rects[0].right=rects[0].left+target.width();rects[0].bottom=rects[0].top+target.height();}
var tx=event.pageX,ty=event.pageY;var x=tx-win.scrollLeft(),y=ty-win.scrollTop();var w=0,h=0;for(var i=0;i<rects.length;++i){if((x<rects[i].left)||(x>rects[i].right)||(y<rects[i].top)||(y>rects[i].bottom))
continue;x=rects[i].left;y=rects[i].top;w=rects[i].right-rects[i].left;h=rects[i].bottom-rects[i].top;break;}
popup.show();var dx=20;var dy=-50;var sx=x,sy=y;if(x+w+dx+popup.getWidth()<win.width()){x+=w+dx;sx+=w;}else{x-=dx+popup.getWidth();sx-=dx;}
if(2*y+h<win.height()){y+=dy;}else{y-=dy+popup.getHeight();}
if(y<0)
y=0;x+=win.scrollLeft();y+=win.scrollTop();sx+=win.scrollLeft();sy+=win.scrollTop();popup.setPosition(x,y);popup.setDirection(sx,sy);},popupShow:function(target,event){ui.truepopdown('open another concept');if(!ui.popup)
return;ui.popup.hideAccordion();ui.popup.getContent('popupQuery').hide();ui.setDefinition("Retrieving definition...");ui.popup.setTarget(target);var concept=ui.popup.getConcept();ui.GetDefinitionFromWiki(ui.setDefinition,concept);ui.contextShow(event,target,ui.popup);if(state.options.books.show&&state.options.books.open)
ui.popup.getContent('books').open();if(state.options.products.show&&state.options.products.open)
ui.openRelatedProducts(concept);ui.showQueryDialog();},openRelatedAuthors:function(cuiList){var dialog=ui.popup.getContent().getElement('relatedExpertsList').clear().show();if(state.options.authors.cache)
var saved=linker.cache.CuiListInfo.get(cuiList);utils.Lazy.wait([saved&&saved.authors||new utils.Lazy(function(callback){linker.api.getRelatedAuthors(cuiList,function(list,cuiList){if(state.options.authors.cache)
saved.authors=list;callback(list);},function(error){callback([],error);});})],function(list){if(ui.popup.getCuiList()!==cuiList)
return;dialog.getContent().getElement('loading').hide();for(var k=0;k<list.length;++k){var name=list[k][0];if('undefined'===typeof name)
continue;dialog.addItem(name,list[k][1]);}
if(0===list.length)
dialog.addEmpty(state.options.authors.empty);dialog.getList().show();},50,function(error){linker.log.debug("Error while getting authors",error);dialog.getContent().getElement('loading').hide();dialog.addError().getList().show();});},openRelatedPublications:function(cuiList){var dialog=ui.popup.getContent().getElement('relatedPublicationsList').clear().show();if(state.options.publications.cache)
var saved=linker.cache.CuiListInfo.get(cuiList);utils.Lazy.wait([saved&&saved.publications||new utils.Lazy(function(callback){linker.api.getRelatedPublications(cuiList,function(list,cuiList){if(state.options.publications.cache)
saved.publications=list;callback(list);},function(error){callback([],error);});})],function(list){if(ui.popup.getCuiList()!==cuiList)
return;dialog.getContent().getElement('loading').hide();for(var k=0;k<list.length;++k){var name=list[k][2];if('undefined'===typeof name)
continue;dialog.addItem(name,list[k][1]);}
if(0===list.length)
dialog.addEmpty(state.options.publications.empty);dialog.getList().show();},50,function(error){linker.log.debug("Error while getting publications",error);dialog.getContent().getElement('loading').hide();dialog.addError().getList().show();});},openFactualConcepts:function(concept){var dialog=ui.popup.getContent().getElement('factualConceptsList').clear().show();utils.Lazy.wait([concept.getFactualConcepts()],function(list){if(ui.popup.getConcept()!==concept)
return;dialog.getContent().getElement('loading').hide();for(var k=0;k<list.length;++k)
dialog.addItem(list[k]);if(0===list.length)
dialog.addEmpty(state.options.factualConcepts.empty);dialog.getList().show();},50,function(error){linker.log.debug("Error while getting factual concepts",error);dialog.getContent().getElement('loading').hide();dialog.addError().getList().show();});},openRelatedBooks:function(concept){var dialog=ui.popup.getContent().getElement('booksList').clear().show();utils.Lazy.wait([concept.getBooks()],function(books){if(ui.popup.getConcept()!==concept)
return;dialog.getContent().getElement('loading').hide();for(var k=0;k<books.length;++k)
dialog.addItem(books[k]);if(0===books.length)
dialog.addEmpty(state.options.books.empty);dialog.getList().show();},50,function(error){linker.log.debug("Error while getting books",error);dialog.getContent().getElement('loading').hide();dialog.addError().getList().show();});},openBook:function(link,asin){linker.api.adTrack(asin,function(){ui.openURL(link,true);});},openRelatedProducts:function(concept){var dialog=ui.popup.getElement('productsList').clear();utils.Lazy.wait([concept.getProducts()],function(products){if(ui.popup.getConcept()!==concept)
return;dialog.clear();for(var k=0;k<products.length;++k)
dialog.addItem(products[k]);dialog.show(0<products.length);},50,function(error){linker.log.debug("Error while getting products",error);});},openWebMD:function(concept){var dialog=ui.popup.getContent().getElement('webmdList').clear().show();utils.Lazy.wait([concept.getWebMD()],function(result){if(ui.popup.getConcept()!==concept)
return;dialog.getContent().getElement('loading').hide();var items=result.items.slice(0,state.options.webmd.max);for(var k=0;k<items.length;++k)
dialog.addItem(items[k]);if(0===items.length)
dialog.addEmpty(state.options.webmd.empty);else
dialog.addMore(result.url);dialog.getList().show();},50,function(error){linker.log.debug("Error while getting webmd",error);dialog.getContent().getElement('loading').hide();dialog.addError().getList().show();});}});utils.addLinkerEvent("linkerNodeClick",function(event,node,base){if(utils.getData(node,"suppress"))
return;ui.popupShow(node,base);});});