LT='\x3C', GT='\x3E', GTLT=GT+""+LT;


/* ======================================== */
function replaceCrossRefs(s) { return s; }
function shw(s0) {
  var s=s0
    .replace("JAVA_DOWNLOAD","http://java.com/download/")
    .replace("CYGWIN","http://www.cygwin.com/setup.exe")
    .replace("JDK_DOWNLOAD","http://java.sun.com/javase/downloads/");
  s=replaceCrossRefs(s);
  window.open(s,"Title", "height=300,width=500,scrollbars,status=yes, focus=yes").focus();

}
function javadoc(clazz) {
    var	addr="http://www.charite.de/bioinf/strap/javadoc/"+clazz.replace(/[.]/g,"/")+".html";
    document.write(LT+"a href=\""+addr+"\""+GT+"*"+LT+"/a"+GT);
}


function wrteWikiLnk(id,value,icon) {
  document.write(LT+"a href=\"javascript:shw('"+id+":"+value+"')\"  "+GTLT+"IMG onmouseout=\"tt();\" onmouseover=\"tt('"+id+" "+value+
                 "');\" style=\"height: 1em; border: 0; vertical-align: bottom; \" SRC=\"http://www.charite.de/bioinf/strap/images/"+icon+"\"   alt=\""+id+":\" "+GTLT+"/a"+GT);
}





function pubmed(txt) {  wrteWikiLnk("PUBMED",txt,"big_pubmed.jpg"); }
function wiki(txt)   {  wrteWikiLnk("WIKI",  txt,"big_wikipedia.jpg");}
function biowiki(txt)   {  wrteWikiLnk("BIOWIKI",  txt,"big_wikipedia.jpg");}
function alignEcClass(ecCode) {  document.write(LT+"a href=\"http://www-intern.charite.de/bioinf/strap/ce.php?alignAndRearange=UNIPROT_EC:"+ecCode+"\""+GT+ecCode+LT+"/a"+GT); }

function smartLnk(url, label) {
  document.write(LT+"a href=\"javascript:shw('"+url+"');\" onMouseOut=\"window.status='';\"  onmousemove=\"window.status='"+url+"';return true;\"   "+GT+label+LT+"/a"+GT);
}


function isIE() {
  if (navigator) {
    var agt=navigator.userAgent;
    return agt && agt.toLowerCase().indexOf("msie")!=-1;
  }
}
// if (isIE()) document.body.style.overflow="hidden";

/* ======================================== */

function ttMoveToMousePosE(e) {
// window.status=" document.body.scrollTop="+ window.pageYOffset+" "+document.documentElement.scrollTop+"  "+document.body.scrollTop;
  if (isIE()) ttMoveToMousePosXY(event.clientX + document.documentElement.scrollLeft, event.clientY + document.documentElement.scrollTop);
  else ttMoveToMousePosXY(e.pageX,e.pageY);
  return true;
}

function ttMoveToMousePosXY(x,y) {
  var stle=document.getElementById("toolTipLayer").style;
  if (stle) {
    stle.left= (x-10)+'px';
    stle.top=  (y+10)+'px';
  }
}


function tt(msg, fgColor, bgColor) {
  var stle=document.getElementById("toolTipLayer").style;
  if (stle) {
    if(msg) {
      var borderColor=fgColor && !bgColor ? fgColor : "black";
      var fg=fgColor && bgColor ? fgColor : "black";
      var bg=fgColor && bgColor ? bgColor : "#eeEEee";
      content=LT+'div  class="toolTip" style="border: 2px solid '+borderColor+';   color:' + fg   + '; background-color:  ' + bg + '; "'+GT+msg+LT+'/div'+GT;
      document.getElementById("toolTipLayer").innerHTML=content;
      stle.position='absolute';
      stle.display='block';
      stle.visibility='visible'; 
      stle.zIndex=8;
      stle.opacity=1;
      document.onmousemove=ttMoveToMousePosE;
      //alert(msg);
    }else {
      stle.visibility='hidden';
      stle.display='none';
      stle.left="-1000px";
      stle.top="-1000px";
      document.onmousemove=null;
    }

  }
}

/* ======================================== */

function showHideFigures(showHide) {
  var ee=document.getElementsByTagName('div');
  for( i=0;;i++) {
    if (i==ee.length) break;
    if ('figure'==ee[i].className) {
      ee[i].style.display= showHide ? 'block' : 'none';
    }
  }
}




function hide(id) {
  var e=document.getElementById(id);  
  if (e) {
    e.style.display='none';  
  }
}


function toggleVisible(button, id) {
  var e=document.getElementById(id);  
  if (e) {
    if (e.style.display=='none') {
      e.style.height="auto";
      e.style.visibility='visible';   
      e.style.display="block"; 
      button.value="-";
    } else {
      e.style.display='none';  
      button.value="+";
    }
  }
}



function writeToggle(id,txt) {
  document.write(LT+"form action=\"\""+GTLT+"input type=\"button\" onClick=\"toggleVisible(this, '"+id+"');\" value=\"+\" "+GT+(txt?txt:"Expand paragraph")+LT+"/form"+GT);
}

/*  
    put ~/java/charite/christo/strap.js -o /var/www/bioinf/strap/strap.js
    put ~/java/web/replaceCrossRefs.js -o /var/www/bioinf/strap/replaceCrossRefs.js   

scp ~/java/charite/christo/strap.js  ~/java/web/replaceCrossRefs.js ~/java/web/replaceCrossRefs.css $STRAP_DIR_B


*/
