﻿Ereignis = window.event;
window.onresize = neuAufbau;
document.onclick=hideSub;
var menuW=130, listL=130, listW=185, mapMaxW=808;
self.focus();
if (location.href.substr(7).indexOf("/")!=location.href.substr(7).lastIndexOf("/"))
location.replace('error.htm');
if (location.href.indexOf("www.")==-1 && location.href.indexOf("banana.")==-1
 && location.href.indexOf("localhost")==-1)
location.href="http://www."+location.hostname;

function reset(parm) {

if(parm==null) {
// Fenster maximieren
  if (document.all) {  // IE
  if (document.body.clientWidth<(screen.availWidth-12)) {
if (screen.width>screen.height*4/3) {
    top.window.moveTo((screen.availWidth-screen.availHeight*4/3)/2,0);
    top.window.resizeTo(screen.availHeight*4/3,screen.availHeight);
    top.window.moveTo((screen.availWidth-screen.availHeight*4/3)/2,0);}
else {
    top.window.moveTo(0,0);
    top.window.resizeTo(screen.availWidth,screen.availHeight);}}}
  else if (document.layers||document.getElementById) {  // NS
  if (top.window.outerHeight<screen.availHeight||
top.window.outerWidth<screen.availWidth){
if (screen.width>screen.height*4/3) {
    top.window.moveTo((screen.availWidth-screen.availHeight*4/3)/2,0);
    top.window.outerHeight = screen.availHeight;
    top.window.outerWidth = screen.availHeight*4/3;
    top.window.moveTo((screen.availWidth-screen.availHeight*4/3)/2,0);}
else {
  top.window.moveTo(0,0);
  top.window.outerHeight = screen.availHeight;
  top.window.outerWidth = screen.availWidth;}}
}

// Löschen der unnötigen Zeile
if ((screen.height<=600&&screen.width>screen.height)||
(screen.width<=600&&screen.width<screen.height)) {
document.getElementById("unnoetig1").style.height="0px";
document.getElementById("unnoetig2").innerHTML="";}

// Titel schreiben
document.getElementById("pagettl").innerHTML=
"<h1 style='display:inline'>"+
"<font color=0039D6><span class='XL'>B</span><u>ehavioral</font></u>&nbsp;"+
"<font color=209a20><span class='XL'>E</span><u>cology</font></u>&nbsp;<font color=E39500>&</font>&nbsp;"+
"<font color=C41200><span class='XL'>E</span><u>volution</font></u>&nbsp;<br>"+
"<font color=5522cc>Seoul National University&nbsp;</h1>";
document.getElementById("owners").innerHTML=
"<h2 style='display:inline;color:#5522cc'>Piotr G. Jab&#322;o&#324;ski "+
"<span onDblClick=tshow()>&</span> Sang-Im Lee</h2>";

// Datei laden
document.getElementById("subMenu1Div").innerHTML=
"<div id=buffDiv style='position:absolute;left:0;top:0;visibility:hidden'>"+
"<iframe name=subMenu1_1Fr src='research/index.php'></iframe></div>";
document.getElementById("divholder").innerHTML=
"<iframe name=LabBoard src='board/index.php'></iframe>";

  document.getElementById("bgdiv").innerHTML=
"<img id=bg style='position:absolute;z-index:0'></img>"+
"<img src=white.jpg id=menubg style='position:absolute;left:0;"+
"top:0;z-index:0;border-right-style:solid;"+
"border-width:1;border-color:BLACK;'></img>"+
"<img src=white.jpg id=zeileunten style='position:absolute;"+
"height:15;z-index:0'></img>"+
"<div id=menuschatten style='position:absolute;width:3;"+
"z-index:0;background-color:gray;'></div>";

document.getElementById("gruesse").innerHTML=document.getElementById("bodygruesse").innerHTML;
var c = parseInt((Math.random() * 100) % 20);
if (c==9) {c="bg2.jpg";
document.getElementById("gruesse").style.color="#003300";}
else {
if (c==7 || c==8) {c="bg1.jpg";
document.getElementById("gruesse").style.color="#aa00cc";}
else c="bg.jpg";}
document.getElementById("bg").src=c;

b_show(); // Board Zone anzeigen
}

// bis hier nur einmal beim Laden der Seite
//---------
// ab hier jedesmal bei der Resizing

lshow(); // Linke MenuSpalte anzeigen
if (document.all) {
  W=document.body.clientWidth;
  H=document.body.clientHeight;}
else {
  W=window.innerWidth;
  H=window.innerHeight;}

// die Breite von bgdiv & bodydiv begrenzen
var W0=W;
if (W>menuW+listW+mapMaxW) W=menuW+listW+mapMaxW;

document.getElementById("bgdiv").style.width=
document.getElementById("bodydiv").style.width=W;
document.getElementById("bgdiv").style.left=
document.getElementById("bodydiv").style.left=(W0-W)/2;

document.getElementById("lspalte").width=menuW;
W2=W-menuW-1, L=menuW+1, T=0, H2=(document.all)?H:H-15;

document.getElementById("bg").style.left=L;
document.getElementById("bg").style.top=T;
document.getElementById("bg").style.width=W2;
document.getElementById("bg").style.height=H2;
document.getElementById("menubg").style.width=menuW;
document.getElementById("menubg").style.height=H;
document.getElementById("zeileunten").style.left=L;
document.getElementById("zeileunten").style.top=H-15;
document.getElementById("zeileunten").style.width=W2;
if (document.all)
document.getElementById("zeileunten").style.filter=
"alpha(opacity=10,finishopacity=70,style=1,startx=0,finishx="+W2+")";
document.getElementById("menuschatten").style.left=menuW+1;
document.getElementById("menuschatten").style.top=T;
document.getElementById("menuschatten").style.height=H;

var mailWMHeight=(document.all)?(H-305):(H-322);
document.getElementById("diesdas").innerHTML=
"<div style='position:absolute;left:"+(W-400)+
";top:"+(H-15)+";width:400;height:15;z-index:0'>"+
"<table width=400 height=15 cellpadding=0 cellspacing=0 border=0>"+
"<tr><td align=right style='padding-right:10px'>"+
"<span id=vers></span>&nbsp; &nbsp; "+
"For bug reports or suggestions: "+
"<span onClick='mailshow("+(W-377)+
","+mailWMHeight+")' style='cursor:pointer'>"+
"Contact Webmaster</span></td></tr></table></div>";

document.getElementById("maintable").style.width=W-130;
document.getElementById("maintable").style.height=H;
document.getElementById("scrtable").style.height=H;
document.getElementById("vers").innerHTML="v.1.4.06"
if ("timerResize") clearTimeout("timerResize");

directLink=(self.location.href.indexOf("?")>0)?self.location.href.split("?"):"";
if (directLink[1]) {
if (directLink[1].toLowerCase()=="cv") subMenu(2);
if (directLink[1].toLowerCase()=="papers") subMenu(5);
if (directLink[1].toLowerCase()=="courses") subMenu(6);
if (directLink[1].toLowerCase()=="links") subMenu(7);
if (directLink[1].toLowerCase()=="grants") {subMenu(7); Disp("links/nrf-grant.php","NRF grant yearly plan");}
if (directLink[1].toLowerCase()=="if") {subMenu(7); Disp("/links/jcr.php","JCR");}
if (directLink[1].toLowerCase()=="contact") subMenu(9);
if (directLink[1].toLowerCase()=="nestboxes") subMenu(10);}
}

function neuAufbau() {
if ("timerResize") clearTimeout("timerResize");
timerResize=setTimeout("reset('resize')",1000);
}

function lshow() {
if (!frames["subMenu1_1Fr"].document.getElementById("Ende"))
{setTimeout('lshow()',500);return;}

document.getElementById("lspalte").innerHTML=
"<table width=130 height="+H+" cellpadding=0 cellspacing=0 border=0 "+
"style='background-image:URL(menubg.jpg);background-repeat:repeat-y;background-position:5 0'>"+
"<tr><td id=shadeDiv height=5% onMouseOver='hideSub()' align=center></td></tr>"+
"<tr><td class='menu' height=7% "+
"onClick='setTimeout(\"subMenu(1)\",1)'>"+
"<p id=1>&nbsp;&nbsp;Introduction</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(2)'>"+
"<p id=2>&nbsp;&nbsp;Curricula Vitarum</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(3)'>"+
"<p id=3>&nbsp;&nbsp;Lab Members</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(4)'>"+
"<p id=4>&nbsp;&nbsp;Collaborators</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(5)'>"+
"<p id=5>&nbsp;&nbsp;Scientific<br>&nbsp;&nbsp;Publications by<br>&nbsp;&nbsp;Lab Members</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(6)'>"+
"<p id=6>&nbsp;&nbsp;Courses</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(10)'>"+

"<p id=10>&nbsp;&nbsp;Nest Boxes "+
"<span style='background-color:yellow;color:black;font-family:\"Tahoma\"'><sup>new</sup></span></p></td></tr>"+

"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(7)'>"+
"<p id=7>&nbsp;&nbsp;Links&nbsp;&amp;<br>&nbsp;&nbsp;References</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(8)'>"+
"<p id=8>&nbsp;&nbsp;Miscellaneous</p></td></tr>"+
"<tr><td class='menu' height=7% onMouseOver='hideSub()' "+
"onClick='subMenu(9)'>"+
"<p id=9>&nbsp;&nbsp;Contact Infos</p></td></tr>"+
"<tr><td height=10% onMouseOver='hideSub()'>"+
"<hr width='60%' align=left style='margin-left:20'>"+

"<table bgcolor='88ccaa' width=100%><tr><td>"+
"<p onClick='showLab()' style='cursor:pointer;margin-top:6px;margin-bottom:6px;margin-left:20px'><b>"+
"Journal of<br>Student<br>Research</b></p>"+
"</td></tr></table>"+

"</td></tr>"+
"<tr><td style='height:5%' onMouseOver='hideSub()'></td></tr>"+
"</table>";}

function b_show() {
if(!frames["LabBoard"].document.getElementById("Ende")) {setTimeout('b_show();',500);return;}
document.getElementById("boardArea").innerHTML=
frames["LabBoard"].document.getElementById("List").innerHTML;
if (!document.all) delete frames["LabBoard"];}

function Bshow(parm) {
if (frames["bwriteFr"]) return;
hideSub();hideList();Shade();hideDisp();maphide();
var ttl=(parm.lastIndexOf("{@}")!=-1)?
parm.replace(/%20/g, ' ').substr(0,parm.replace(/%20/g, ' ').lastIndexOf("{@}")):
parm.replace(/%20/g, ' '),
wi=((W2-460)>400)?W2-460:400;
ttl=ttl.replace(/%27/g,"'");
document.getElementById("boardholder").innerHTML=
"<div style='position:absolute;width:"+wi+";height:"+(H-156)+
";left:"+(menuW)+";top:150;border-width:3;border-style:ridge;border-color:aaaaaa'>"+
"<table width="+wi+" height="+(H-156)+" cellpadding=0 cellspacing=0>"+
"<tr><td id=boardttl background=metalbgs.jpg align=left "+
"style='padding-left:20;font-weight:bold' height=25>"+
ttl+"</td><td id=dyn background=metalbgs.jpg align=right style='padding-right:5'>"+
"<img src=xs.gif onClick=Bhide() border=0 style='cursor:pointer' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'></td></tr>"+
"<tr><td colspan=2><iframe name=boardFr src=\"board/"+
parm.replace(/%27/g,"'").replace(/%/g,'%25').replace(/\u003F/g,'%3F').replace(/#/g,'%23')+
"/\" width="+wi+" height="+(H-181)+" frameborder=0></iframe></td></tr></table></div>";}

function Bhide() {
if (document.getElementById("boardholder").innerHTML!="")
document.getElementById("boardholder").innerHTML="";
if (!frames["bwriteFr"]&&document.getElementById("disMenu").innerHTML!="")
document.getElementById("disMenu").innerHTML="";
if (frames["boardFr"]&&!document.all) delete frames["boardFr"];}

function Bwrite() {
if (frames["bwriteFr"]) return;
if (frames["boardFr"])
 if (frames["boardFr"].document.getElementById("lastrow"))
  if (frames["boardFr"].document.getElementById("lastrow").innerHTML!="") return;
hideSub();hideList();Shade();hideDisp();maphide();
disableMenu();
var wi=480, he=320, le=(document.all)?W-wi:W-wi-6, to=(H-he)/2;
document.getElementById("ListL").innerHTML=
"<div id=DivListL style='position:absolute;width:"+wi+";height:"+he+";left:"+le+
";top:"+to+";z-index:10000;border-width:3;border-color:aaaaaa;border-style:ridge'>"+
"<iframe name=bwriteFr scrolling=no src='board/login/?allowed=LabMembers'"+
" width=100% height=100% frameborder=0></iframe>"+
"<img src=xs.gif onClick=closeDet() style='position:absolute;left:"+(wi-54)+
";top:"+7+";z-index:1;cursor:pointer' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'>"+
"<img id='xcover' src='halbtr.png' width=43 height=18 style='position:absolute;left:"+(wi-54)+
";top:"+7+";z-index:1;cursor:default;display:none'></div>";
hideList(); Shade();}

function Bedit() {
if (frames["bwriteFr"] || !frames["boardFr"]) return;
if (frames["boardFr"])
 if (frames["boardFr"].document.getElementById("lastrow").innerHTML!="") return;
hideSub();hideList();Shade();hideDisp();maphide();
disableMenu(); document.getElementById("dyn").innerHTML="";
var wi=480, he=320, le=(document.all)?W-wi:W-wi-6, to=(H-he)/2;
document.getElementById("ListL").innerHTML=
"<div id=DivListL style='position:absolute;width:"+wi+";height:"+he+";left:"+le+
";top:"+to+";z-index:10000;border-width:3;border-color:aaaaaa;border-style:ridge'>"+
"<iframe name=bwriteFr scrolling=no src='board/login/indexedt.php?allowed="+
frames["boardFr"].document.getElementById("writer").innerHTML.substr(3)+
"' width=100% height=100% frameborder=0></iframe>"+
"<img src=xs.gif onClick=closeDet() style='position:absolute;left:"+(wi-54)+
";top:"+7+";z-index:1;cursor:pointer;' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'>"+
"<img id='xcover' src='halbtr.png' width=43 height=18 style='position:absolute;left:"+(wi-54)+
";top:"+7+";z-index:1;cursor:default;display:none'></div>";
hideList(); Shade();}

function Bdelete() {
if (frames["bwriteFr"] || !frames["boardFr"]) return;
if (frames["boardFr"])
 if (frames["boardFr"].document.getElementById("lastrow").innerHTML!="") return;
hideSub();hideList();Shade();hideDisp();maphide();
disableMenu(); document.getElementById("dyn").innerHTML="";
var wi=480, he=320, le=(document.all)?W-wi:W-wi-6, to=(H-he)/2;
document.getElementById("ListL").innerHTML=
"<div id=DivListL style='position:absolute;width:"+wi+";height:"+he+";left:"+le+
";top:"+to+";z-index:10000;border-width:3;border-color:aaaaaa;border-style:ridge'>"+
"<iframe name=bwriteFr scrolling=no src='board/login/indexdel.php?allowed="+
frames["boardFr"].document.getElementById("writer").innerHTML.substr(3)+
"' width=100% height=100% frameborder=0></iframe>"+
"<img src=xs.gif "+
"onClick=closeDet() style='position:absolute;left:"+(wi-54)+
";top:"+7+";z-index:1;cursor:pointer;' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'></div>";
hideList(); Shade();}

function Bcmmnt() {
if (!document.all) delete frames["boardFr"];
if (frames["bwriteFr"] || !frames["boardFr"]) return;
if (frames["boardFr"].document.getElementById("lastrow").innerHTML!="") return;
hideSub();hideList();Shade();hideDisp();maphide();disableMenu();
frames["boardFr"].document.getElementById("lastrow").style.paddingLeft=30;
frames["boardFr"].document.getElementById("lastrow").innerHTML=
"Comment by <input id=cmmntwrt type=text size=10 maxlength=40 "+
"value='[name]' onClick='parent.nameinit()' onFocus='parent.nameinit()'> @ "+
"<span id=ip><div style='position:absolute;left:0;top:0;visibility:hidden'>"+
"<iframe name=ipFr src='/board/getip.php'></iframe></div></span><br>"+
"<textarea id=cmmntbox cols=54 rows=4 wrap=soft></textarea>"+
"<div width=100% align=right style='padding-right:30'>"+
"<input type=button id=wrtbtn value='write' onClick='parent.BcmmntWrite()' disabled>"+
"<input type=button id=cnclbtn value='cancel' onClick='parent.BcmmntCancel()' disabled></div>"+
"&bull;&nbsp;Once written, comments cannot be edited or deleted.<br>"+
"&bull;&nbsp;&lt; &gt; characters will NOT be interpreted as HTML-tag-related.<br>"+
"&bull;&nbsp;Your IP-address will be recorded even if you don't fill in your name."+
"<a name='.'></a>";
//frames["boardFr"].location.href="#.";
frames["boardFr"].document.getElementById("cmmntbox").focus();
getip();}

function nameinit() {
if (frames["boardFr"].document.getElementById("cmmntwrt").value=="[name]")
frames["boardFr"].document.getElementById("cmmntwrt").value="";}

function getip() {
if (!frames["boardFr"].frames["ipFr"].document.getElementById("Ende")) {
setTimeout('getip()',500); return;}
var ipNum=frames["boardFr"].frames["ipFr"].document.getElementById("ip").innerHTML;
frames["boardFr"].document.getElementById("ip").innerHTML=ipNum;
frames["boardFr"].document.getElementById("wrtbtn").disabled=false;
frames["boardFr"].document.getElementById("cnclbtn").disabled=false;
if (!document.all) delete frames["boardFr"].frames["ipFr"];
if (frames["boardFr"]&&!document.all) delete frames["boardFr"];}

function BcmmntWrite() {
if (trim(frames["boardFr"].document.getElementById("cmmntbox").value).length==0) return;
frames["boardFr"].document.getElementById("wrtbtn").disabled=true;
frames["boardFr"].document.getElementById("cnclbtn").disabled=true;
cWrt=(trim(frames["boardFr"].document.getElementById("cmmntwrt").value)=="[name]" ||
trim(frames["boardFr"].document.getElementById("cmmntwrt").value)=="")?
"--":trim(frames["boardFr"].document.getElementById("cmmntwrt").value);
ipNum=frames["boardFr"].document.getElementById("ip").innerHTML;
cStr=trim(frames["boardFr"].document.getElementById("cmmntbox").value);
cDir=document.getElementById("boardttl").innerHTML+"{@}"+
frames["boardFr"].document.getElementById("writer").innerHTML.substr(3);
frames["boardFr"].document.getElementById("ip").innerHTML+=
"<div style='position:absolute;left:0;top:0;visibility:hidden'>"+
"<iframe name=txtgenFr src='/board/txtgen.php'></iframe></div>"+
"<span style='position:fixed;left:20;top:50;background-color:green;color:white'><b>"+
"writing. . .</b></span>";
BdetSent();}

function BdetSent() {
if (!frames["boardFr"].frames["txtgenFr"].document.getElementById("sent")) {
setTimeout('BdetSent()',500); return;}
frames["boardFr"].document.getElementById("ip").innerHTML="";
if (!document.all) delete frames["boardFr"].frames["txtgenFr"];
frames["boardFr"].location.reload();
if (frames["boardFr"]&&!document.all) delete frames["boardFr"];
document.getElementById("disMenu").innerHTML="";
document.getElementById("divholder").innerHTML=
"<iframe name=LabBoard src='board/index.php'></iframe>";
b_show();}

function BcmmntCancel() {
if (frames["bwriteFr"]) return;
frames["boardFr"].document.getElementById("lastrow").innerHTML="";
document.getElementById("disMenu").innerHTML="";}

function Bpreview(ttl) {
hideSub();hideList();Shade();
wi=((W2-460)>400)?W2-460:400;
document.getElementById("boardholder").innerHTML=
"<div style='position:absolute;width:"+wi+";height:"+(H-156)+
";left:"+(menuW)+";top:150;border-width:3;border-style:ridge;border-color:aaaaaa'>"+
"<table width="+wi+" height="+(H-156)+" cellpadding=0 cellspacing=0>"+
"<tr><td background=metalbgs.jpg align=left style='padding-left:20' height=25><b>"+
"Preview: "+ttl.substr(1,ttl.length-2)+"</b></td>"+
"<td background=metalbgs.jpg align=right style='padding-right:5'>"+
"<img src=xs.gif onClick=Bhide() border=0 style='cursor:pointer' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'></td></tr>"+
"<tr><td colspan=2><iframe id=previewFr src='board/_preview' width="+wi+
" height="+(H-181)+" frameborder=0></iframe></td></tr></table></div>";}

function disableMenu() {
document.getElementById("disMenu").innerHTML=
"<div style='position:absolute;left:0;top:0;width:"+menuW+";height:"+H+"'>"+
"<table width="+menuW+" height="+H+" border=1 background='halbtr.png'><tr>"+
"<td width=100% height=100% onClick=\""+
"alert('Menu disabled while working with Lab Board')\">"+
"</td></tr></table></div>";}

function pic(parm) {
  if (window.mypic) mypic.close();
  mypic= window.open("/pic.htm?"+parm, "", "resizable=1,HEIGHT=200,WIDTH=200,left="+
(screen.availWidth-200)/2+",top="+(screen.availHeight-200)/2+
",toolbar=no,status=no,menubar=no,location=no");}

function clsWin() {
  if (window.mypic) mypic.close();}

function Blist(parm) {
document.getElementById("divholder").innerHTML=
"<iframe name=LabBoard src='board/index.php?i="+parm+"'></iframe>";
b_show();}

function hideSub() {
document.getElementById("subMenuDiv").innerHTML="";}

function subMenu(parm) {
maphide();
if (document.getElementById("listSDiv"))
 if ((parm==3 && document.getElementById("ListFr").src.indexOf("members")!=-1) ||
(parm==4 && document.getElementById("ListFr").src.indexOf("collab")!=-1) ||
(parm==6 && document.getElementById("ListFr").src.indexOf("misc")!=-1))
{hideList();Shade();return;}

if (document.getElementById("listSDiv")) {hideList();Shade();}
if (document.getElementById("LinkFr")) hideDisp();
if (document.getElementById("boardholder").innerHTML!="")
document.getElementById("boardholder").innerHTML="";
var pahe=(document.all)?65:60, mB=(document.all)?-12:-5;

switch (parm) {
case 1:
var wi=parseInt(frames["subMenu1_1Fr"].document.getElementById("maxLen").innerHTML),
c="",
//t=(H*0.08*(parm-1)+(H*0.06)+he+18>H)?H-he:H*0.08*(parm-1)+(H*0.06)+18;
t=H*0.06;
wi=(wi-wi/6)*8;

//c+="<ul type='square'>";
var counter=parseInt(frames["subMenu1_1Fr"].document.getElementById("counter").innerHTML),
he=(counter*5)+pahe;
for (i=1;i<=counter;i++)
c+="<p class=submenu onMouseOver=this.style.fontWeight='bold' "+
"onMouseOut=this.style.fontWeight='normal' "+
"onClick=\"Shade(1);Disp('research/'+this.innerHTML+'.php',"+
"this.innerHTML)\" style='margin-top:10px;margin-bottom:10px'>"+
frames["subMenu1_1Fr"].document.getElementById("s_"+i).innerHTML+
"</p>";

//c+="</ul>";
break;

case 2:
Disp("profiles/index.php","Curricula Vitarum");
Shade(2);
return; break;

case 3:
list("members/index.php");
Shade(3);
return; break;

case 4:
list("collab/index.php");
Shade(4);
return; break;

case 5:
Disp("papers/index.php","Scientific Publications by Lab Members");
Shade(5);
return; break;

case 6:
Disp("courses/index.php","Courses - ");
Shade(6);
return; break;

case 7:
Disp("links/index.php","Links & References");
Shade(7);
return; break;

case 8:
//list("misc/index.php");
Disp("misc/index.php","Miscellaneous");
Shade(8);
return; break;

case 9:
Disp("contact/index.php","Contact Infos");
Shade(9);
return; break;

case 10:
Disp("nestboxes/index.php","Nest Boxes - Bird Watch");
Shade(10);
return; break;
}
var lineW=(document.all)?wi-9:wi-10, lineH=(document.all)?he+2:he+1,
ifShaded=(document.getElementById(parm).style.backgroundColor!="")?
"<div id=subm style='position:absolute;left:"+(menuW-20)+";top:"+t+
";width:15;height:"+(H*0.08)+";z-index:301;background-color:white;'></div>":"";

document.getElementById("subMenuDiv").innerHTML=
"<div id=subm style='position:absolute;left:"+(menuW-5)+
";top:"+t+";width:"+wi+";height:"+he+";z-index:300;background-color:white;'>"+
"<table width="+wi+" height="+he+" border=0><tr><td>"+
c+"</td></tr></table></div>"+
"<div style='position:absolute;left:"+(menuW)+
";top:"+(t-1)+";width:"+(lineW+5)+";height:"+lineH+";z-index:299;"+
"border-style:solid;border-width:1;border-color:BLACK;"+
"border-left-style:none;background-color:white;'></div>"+ //outline
"<div style='position:absolute;left:"+(menuW+1)+
";top:"+(t+6)+";width:"+(wi-1)+";height:"+he+
";z-index:298;background-color:gray;'></div>"+ifShaded; //shadow
}

function Shade(parm) {
if (parm!=null&&!document.getElementById(parm)) {setTimeout("Shade("+parm+")",500);return;}
for (i=1;i<=10;i++) {
if (document.getElementById(i)) {
document.getElementById(i).style.backgroundColor="";
document.getElementById(i).style.color="";}}
if (parm==null) return;
if (parm==3 || parm==4) {
document.getElementById(parm).style.backgroundColor="silver";
document.getElementById(parm).style.color="black";}
else {
document.getElementById(parm).style.backgroundColor="222222";
document.getElementById(parm).style.color="eeeeee";}
}

function winOpen(parm) {
if (window.lnkWin) lnkWin.close();
lnkWin=window.open(parm,'','scrollbars=yes,status=yes,menubar=yes,'+
'toolbar=yes,location=yes,resizable=yes');
lnkWin.focus();}

function hideDisp() {
if (!document.getElementById("listSDiv")) Shade();
if (document.getElementById("disp").innerHTML!="")
document.getElementById("disp").innerHTML="";}

function Disp(p,q) {
if (p==null || p=="") return;
if (q==null) q=p;
hideDet(); // hideList(); maphide();
if (document.getElementById("boardholder").innerHTML!="")
document.getElementById("boardholder").innerHTML="";
var wi=W-menuW-1, L=menuW+1,
ifLinkFr=(p.indexOf("http://")!=-1||q.substr(0,10)=="Courses - ")?"id=LinkFr ":"id=DispFr ";
if (q=="Curricula Vitarum" || p.indexOf("http://")!=-1)
wi=(W-menuW>800)?W-menuW-1:W, L=(W-menuW>800)?menuW+1:0;
p=p.replace(/ /g, "%20");
if (q!="Lab HTTP Server") q=q.replace(/ /g, "&nbsp;");
else q+=" <span style='color:yellow'>- on connection problems, wait till the \"timeout\" screen and try again</span>";

document.getElementById("disp").innerHTML=
"<div id=DispDiv style='background-color:silver;position:absolute;left:"+L+";top:0;width:"+wi+
";height:"+H+";z-index:250'><table width="+wi+
" height=20 background='metalbg.jpg'>"+
"<tr><td id=dispttl style='padding-left:10;height:20;color:white'><b>"+q+"</b></td>"+
"<td align=right><img src=xs.gif style='cursor:pointer' onClick='hideDisp()' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'></td></tr></table>"+
"<iframe "+ifLinkFr+
"frameborder=0 src='"+p+"' width="+wi+" height="+(H-24)+
"></iframe></div>";
}

function hideList() {
if (document.getElementById("ListL").innerHTML!="") hideDet();
if (document.getElementById("ListS").innerHTML!="")
document.getElementById("ListS").innerHTML="";
if (document.getElementById("embeded"))
document.getElementById("disp").innerHTML="";}

function list(parm) {
//if (document.getElementById("ListFr") &&
//document.getElementById("ListFr").src.indexOf(parm)!=-1) return;
hideSub(); maphide();
if (document.getElementById("DispDiv")) hideDisp();
if (document.getElementById("ListL").innerHTML!="")
hideDet();
if (document.getElementById("boardholder").innerHTML!="")
document.getElementById("boardholder").innerHTML="";
switch(parm) {
  case 'members/index.php':
var ListTTL="<h3>Lab Members</h3>";
 break;
  case 'collab/index.php':
var ListTTL="<h3>Collaborators</h3>"+
"<span onClick=parent.mapshow() style='cursor:pointer'>"+
"<u>Click here to open the map</u></span>";
 break;
  case 'misc/index.php':
var ListTTL="<h3>Miscellaneous</h3>";
 break;
}
var shadowLPos=(document.all)?listW:listW+1;

document.getElementById("ListS").innerHTML=
"<div id=listSDiv style='position:absolute;padding:15;padding-left:0;left:"+
menuW+";top:0;width:"+listW+";height:"+H+";z-index:100;'>"+
"<table id=listTbl width="+(listW-15)+" height="+(H-30)+
" cellpadding=0 cellspacing=0 border=0>"+
"<tr><td height=30 align=center bgcolor=silver style='padding-top:10px' valign=center>"+
ListTTL+"</td></tr>"+
"<tr><td><iframe id=ListFr src="+parm+
" width=100% height=100% frameborder=0 scrolling='auto'>"+
"</iframe>"+
"</td></tr></table>"+
"<div style='background-color:white;position:absolute;left:0;"+
"top:0;width:"+listW+";height:"+H+";z-index:-1;"+
"border-right-style:solid;border-width:1;border-color:BLACK;'></div>"+
"<div style='background-color:gray;position:absolute;"+
"left:"+shadowLPos+";top:0;width:3;height:"+H+";z-index:-2;'></div></div>";
}

function winPDF(parm) {
if (!document.all) if (window.artwin) artwin.close();
artwin=window.open(parm,'','scrollbars=yes,status=yes,menubar=yes,'+
'toolbar=yes,location=no,resizable=yes');
artwin.focus();}

function hideDet() {
if (document.getElementById("ListL").innerHTML!="")
if (document.getElementById("DivListL").style.zIndex!=10000)
document.getElementById("ListL").innerHTML="";}

function closeDet() {
if (document.getElementById("boardholder").innerHTML!="")
document.getElementById("boardholder").innerHTML="";
if (frames["bwriteFr"])
if (frames["bwriteFr"].attList!=null) {
attList2=frames["bwriteFr"].attList;
document.getElementById("attRm").innerHTML=
"<iframe name=rmfr2 src='board/_preview/rmatt.php?do=get'></frame>";
dtRm2=window.setInterval('detectRm2()',2000);}
document.getElementById("disMenu").innerHTML="";
document.getElementById("ListL").innerHTML="";
if (frames["bwriteFr"]&&!document.all) delete frames["bwriteFr"];
if (frames["boardFr"]&&!document.all) delete frames["boardFr"];}

function ListDet(parm) {
var wi=400, he=300;
if (document.getElementById("bigMap")) {
var le=(document.getElementById("ListFr"))?
listL+listW+(mW-wi)/2:menuW+(mW-wi)/2;
var to=(mH+8+he>H)?H-he:mH+8;}
else{
var le=(document.getElementById("ListFr"))?
(listL+listW+W-wi)/2:(menuW+W-wi)/2;
var to=(H-15-he)/2;}
var scroll=(parm.substr(parm.length-4,4)==".php")?
"scrolling=no":"";
document.getElementById("ListL").innerHTML=
"<div id=DivListL style='background-color:white;position:absolute;width:"
+wi+";height:"+he+";left:"+le+";top:"+to+";z-index:150;'>"+
"<iframe "+scroll+" src='"+parm+
"' width=100% height=100% frameborder=0></iframe>"+
"<img src=xs.gif onClick=hideDet() style='position:absolute;left:"+
(wi-53)+";top:"+7+";z-index:151;cursor:pointer;' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'></div>";
}

function ListDetMem(parm,ln,txtpath) {
var wi=480, he=(ln>0)?320+20+(35*ln):320,
txt=(ln>0)?"?ln="+ln+"&txtfile="+txtpath:"";
if (document.getElementById("bigMap")) {
var le=(document.getElementById("ListFr"))?
listL+listW+(mW-wi)/2:menuW+(mW-wi)/2;
var to=(mH+8+he>H)?H-he:mH+8;}
else{
var le=(document.getElementById("ListFr"))?
(listL+listW+W-wi)/2:(menuW+W-wi)/2;
if (H-he>0) var to=(H-he)/2;
else {var to=0, he=H;}
}
var scroll=(parm.substr(parm.length-4,4)==".php")?
"scrolling=no":"";
if (to==0) scroll="";
document.getElementById("ListL").innerHTML=
"<div id=DivListL style='background-color:white;position:absolute;width:"
+wi+";height:"+he+";left:"+le+";top:"+to+";z-index:150;'>"+
"<iframe "+scroll+" src='"+parm+txt+
"' width=100% height=100% frameborder=0></iframe>"+
"<img src=xs.gif onClick=hideDet() style='position:absolute;left:"+
(wi-53)+";top:"+7+";z-index:1;cursor:pointer;' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'></div>";
}

function showLab() {
LabWin=window.open('http://journal.behecolpiotrsangim.org/','',
'left=0,top=0,status=yes,scrollbars=yes,'+
'menubar=yes,toolbar=yes,resizable=yes,location=yes');}

function globfocus(p) {
  if (!document.getElementById("globe").style.filter)
 document.getElementById("globe").style.filter='gray()';
  else document.getElementById("globe").style.filter="";}

function cleanmap() {
    document.getElementById("submenu").innerHTML="";}

function maphide() {
  document.getElementById("maparea").innerHTML="";
hideDet();}

function mapshow() {
if (frames["bwriteFr"]) return;
if (frames["boardFr"])
 if (frames["boardFr"].document.getElementById("lastrow").innerHTML!="") return;
hideSub(); hideDet(); //hideDisp();
//if (document.getElementById("boardholder").innerHTML!="")
//document.getElementById("boardholder").innerHTML="";
if (document.getElementById("ListFr")) LPos=listL+listW, TPos=0;
else LPos=menuW+1, TPos=0;
mW=(LPos+mapMaxW>W)?W-(LPos+8):mapMaxW-8,
mH=parseInt(mW*351/800);
  var bigmap=
"<div id='bigMap' style='position:absolute; color:#000000; left:"+LPos+
"px; top:"+TPos+"px; width:"+mW+"px; height:"+mH+"px; "+
"border-width:4px; border-color:#cccccc; border-style:ridge; z-index:130;' "+
"onClick='cleanmap()'>"+
"<span id=sites></span><span id='submenu'></span>"+
"<img src=xs.gif style='cursor:pointer;position:absolute;left:"+
(mW-48)+";top:"+5+";' onClick='maphide()' "+
"onMouseOver='this.src=\"xsf.gif\"' onMouseOut='this.src=\"xs.gif\"'>"+
"<img src='map.png' width="+mW+" height="+mH+"></div>";
document.getElementById("maparea").innerHTML=bigmap;

var wiegross=(document.all)?"":"<big><big>",
wiegrossend=(document.all)?"":"</big></big>";
  var sites=
"<div style='position:absolute;left:5;top:2'>"+
"<table style='font-weight:bold'>"+
"<tr><td align=center>"+wiegross+"\u25CF"+wiegrossend+
"</td><td>Locations of Collaborators</td></tr><tr><td align=center>"+
wiegross+"\u25A0"+wiegrossend+
"</td><td>Locations of Field Sites</td></tr></table></div>"+

"<div id='site1' style='position:absolute; color:#000000; left:"+
(mW*634/800)+"px; top:"+(mW*106/800)+"px; "+
"width:8px; height:8px; text-align:left; z-index:3;cursor:pointer'"+
" onClick=ListDet('collab/07.Seoul,%20Korea')>"+
"<img id=site1pic src='collab/07.gif' "+
"alt='Click for list of collaborators in\n Seoul, Korea' "+
"title='Click for list of collaborators in\n Seoul, Korea'></div>"+  // kr

"<div id='site2' style='position:absolute; color:#000000; left:"+
(mW*105/800)+"px; top:"+(mW*113/800)+"px;"+
" width:8px; height:8px; text-align:left; z-index:3;cursor:pointer'"+
" onClick=ListDet('collab/01.Arizona,%20USA')>"+
"<img id=site2pic src='collab/01.gif' "+
"alt='Click for list of collaborators in\n Arizona, USA' "+
"title='Click for list of collaborators in\n Arizona, USA'></div>"+ // AR

"<div id='site3' style='position:absolute; color:#000000; left:"+
(mW*396/800)+"px; top:"+(mW*70/800)+"px; "+
"width:8px; height:8px; text-align:left; z-index:3;cursor:pointer'"+
" onClick=ListDet('collab/06.Poland')>"+
"<img id=site3pic src='collab/06.gif' "+
"alt='Click for list of collaborators in\n Poland' "+
"title='Click for list of collaborators in\n Poland'></div>"+   // pl1

//"<div id='site6' style='position:absolute; color:#000000; left:"+
//(mW*396/800-14)+"px; top:"+(mW*70/800-3)+"px; "+
//"width:8px; height:8px; text-align:left; z-index:3;'"+
//" onClick='site(6)'"+
//" onMouseOver='sitesubmenu("+(mW*396/800-14-96)+","+(mW*70/800-3)+")'"+
//">"+
//"<img id=site6pic src='collab/04.Wroclaw, Poland.gif' "+
//"style='visibility:hidden; filter:revealTrans(Duration=2, Transition=12)' "+
//"alt='Wroclaw, Poland'></div>"+   // pl2

"<div id='site4' style='position:absolute; color:#000000; left:"+
(mW*192/800)+"px; top:"+(mW*95/800)+"px; "+
"width:8px; height:8px; text-align:left; z-index:3;cursor:pointer'"+
" onClick=ListDet('collab/02.Pennsylvania,%20USA')>"+
"<img id=site4pic src='collab/02.gif' "+
"alt='Click for list of collaborators in\n Pennsylvania, USA' "+
"title='Click for list of collaborators in\n Pennsyvania, USA'></div>"+   // PA

"<div id='site5' style='position:absolute; color:#000000; left:"+
(mW*200/800)+"px; top:"+(mW*87/800)+"px; "+
"width:8px; height:8px; text-align:left; z-index:3;cursor:pointer'"+
" onClick=ListDet('collab/03.New%20York,%20USA')>"+
"<img id=site5pic src='collab/03.gif' "+
"alt='Click for list of collaborators in\n New York, USA' "+
"title='Click for list of collaborators in\n New York, USA'></div>"+   // NY

"<div id='site6' style='position:absolute; color:#000000; left:"+
(mW*177/800)+"px; top:"+(mW*93/800)+"px; "+
"width:8px; height:8px; text-align:left; z-index:3;cursor:pointer'"+
" onClick=ListDet('collab/04.Michigan,%20USA')>"+
"<img id=site6pic src='collab/04.gif' "+
"alt='Click for list of collaborators in\n Michigan, USA' "+
"title='Click for list of collaborators in\n Michigan, USA'></div>"+   // MI

"<div id='site7' style='position:absolute; color:#000000; left:"+
(mW*200/800)+"px; top:"+(mW*177/800)+"px; "+
"width:8px; height:8px; text-align:left; z-index:3;cursor:pointer'"+
" onClick=ListDet('collab/05.Venezuela')>"+
"<img id=site7pic src='collab/05.gif' "+
"alt='Click for list of collaborators in\n Caracas, Venezuela' "+
"title='Click for list of collaborators in\n Caracas, Venezuela'></div>"+   // MI

"<div id='site8' style='position:absolute; color:#000000; left:"+
(mW*106/800)+"px; top:"+(mW*112/800)+"px;"+
" width:14px; height:14px; text-align:left; z-index:2;cursor:pointer'"+
" onclick=winOpen('http://research.amnh.org/swrs/')>"+
"<img id=site8pic src='collab/fs.gif' "+
"alt='Click for the website of\n SWR field site, Arizona, USA' "+
"title='Click for the website of\n SWR field site, Arizona, USA'></div>"+ // AR-SWR

"<div id='site9' style='position:absolute; color:#000000; left:"+
(mW*153/800)+"px; top:"+(mW*166/800)+"px; "+
"width:14px; height:14px; text-align:left; z-index:3;'"+
" onMouseOver='sitesubmenu("+(mW*153/800)+","+(mW*166/800)+")'>"+
"<img id=site9pic src='collab/fs.gif' "+
"alt='Costa Rica field site' title='field site, Costa Rica' "+
"title='Costa Rica field site' title='field site, Costa Rica'></div>";   // Costa Rica

  document.getElementById("sites").innerHTML= sites;
}

function site(p) {
  var sitename=document.getElementById("site"+p+"pic").alt;
  maphide();
  document.getElementById("textholder").innerHTML=
"<h2><font color=0000ff>Welcome to "+sitename+"</font></h2>";}

function sitesubmenu (p,q) {
// hideDet();
 var x =p-87, y=q;
  var sub_menu=
"<table id=sitesub"+p+" background='metalbgs.jpg' "+
"style='border-width:3px; border-style:outset; border-color:#aaaaaa;"+
"position:absolute; color:#000000; left:"+x+
"px; top:"+y+"px; width:85px; height:60px; text-align:left; z-index:160;'>"+
"<tr><td id=sm1 style='cursor:pointer' onMouseOver='submenufocuson(1)' "+
"onMouseOut='submenufocusoff(1)' onClick='sitedet("+p+",1)'>"+
"&nbsp;The Station</td></tr>"+
"<tr><td id=sm2 style='cursor:pointer' onMouseOver='submenufocuson(2)' "+
"onMouseOut='submenufocusoff(2)' onClick='sitedet("+p+",2)'>"+
"&nbsp;Map</td></tr>"+
"<tr><td id=sm3 style='cursor:pointer' onMouseOver='submenufocuson(3)' "+
"onMouseOut='submenufocusoff(3)' onClick='sitedet("+p+",3)'>"+
"&nbsp;Photos</td></tr></table>";
  document.getElementById("submenu").innerHTML=sub_menu;}

function submenufocuson(p) {
document.getElementById('sm'+p).style.backgroundColor='#005500';
document.getElementById('sm'+p).style.color='#ffffff';}
function submenufocusoff(p) {
document.getElementById('sm'+p).style.backgroundColor='';
document.getElementById('sm'+p).style.color='#000000';}

function sitedet(p,q) {
//  maphide();
//  var sitename=document.getElementById("site"+p+"pic").alt;
//  var msg= q+".submenu:  your text here";
//  if (document.getElementById("textholder"))
// document.getElementById("textholder").innerHTML="<h2>"+sitename+"</h2>";
//  if (document.getElementById("textholder"))
// document.getElementById("textholder").innerHTML=msg;
  switch(q) {
case 1:
if (p==mW*153/800) Disp('http://www.estacionbiologica.com/','Costa Rica - The Station');
break;
case 2:
if (p==mW*153/800) Disp('http://www.monteverdeinfo.com/maps/monteverde.htm','Costa Rica - Map');
break;
case 3:
if (p==mW*153/800) Disp('http://www.monteverdeinfo.com/photo_gallery.htm','Costa Rica - Photos');
break;
//case 4:
//if (p==mW*153/800) Disp('cr/papers.php','Costa Rica - Related Articles');
//break;
}
}

if (document.all) var obj;

function down(e) {if (document.all) {
obj = event.srcElement.parentElement.parentElement.parentElement.
parentElement.parentElement.parentElement.style;
X=event.offsetX;
Y=event.offsetY;}}

function move(e) {
if (obj && document.all) {
  obj.left = event.clientX-X-menuW + document.body.scrollLeft;
  obj.top = event.clientY-Y + document.body.scrollTop;
  return false;}}

function up() {obj = null;}

if (document.all) {
document.onmousemove = move;
document.onmouseup = up;}
