
// menu functions and global vars
var NumberOfDropMenus = 3;

var MenuBackground = "khaki";
var MenuForeground = "black";
var BorderStyle = "groove";
var BorderWidth = "thin";
var BorderColor = "gray";
var MenuFontSize = "0.8em";
document.write("<style>A {text-decoration: none;color:"+MenuForeground+";}</style>");
document.write("<style>A:hover {color:red; background:"+MenuBackground+"}</style>");
var MenuTop=30;
var DropTimer = new Array(NumberOfDropMenus);


function showDropMenu(DropMenuNumber,x,y) {
    hideAllPopups();
    var d = document.getElementById("Drop"+DropMenuNumber);
    d.style.left=x+"px";
    d.style.top=y+"px";
    d.style.color=MenuForeground;
    d.style.background=MenuBackground;
    d.style.borderStyle=BorderStyle;
    d.style.borderWidth=BorderWidth;
    d.style.borderColor=BorderColor;
    d.style.fontSize=MenuFontSize;
}

function initMenu(fgcolor,bgcolor,fgHover,bgHover,brderstyle,brderwidth,brdercolor,mfontsize) {
    MenuForeground = fgcolor;
    MenuBackground = bgcolor;
    BorderStyle=brderstyle;
    BorderWidth=brderwidth;
    BorderColor=brdercolor;
    MenuFontSize=mfontsize;
    document.write("<style>A {text-decoration: none;color:"+fgcolor+";}</style>");
    document.write("<style>A:hover {color:"+fgHover+" ; background:"+bgHover+"}</style>");
}

function timeDelayClose (DropMenuNumber,tx) {
    // tx is time in milliseconds
    var dname = "Drop"+DropMenuNumber+"Popup";
    //window.setTimeout("hideAllPopups();",tx);
    DropTimer[DropMenuNumber] = window.setTimeout("hideMenu("+DropMenuNumber+");",tx);
}

function hideMenu(DropMenuNumber) {
    var dname = "Drop"+DropMenuNumber;
    var cname = dname+"Popup";
    var d1=document.getElementById(dname);
    if (d1) {
	d1.style.left="-500px";
    }
    if (DropTimer[DropMenuNumber] != null) {
	window.clearTimeout(DropTimer[DropMenuNumber]);
	DropTimer[DropMenuNumber] = null;
    }
}
	
function hideAllPopups() {
    for (x=0; x<NumberOfDropMenus; x++) {
	var dname="Drop"+x;
	var d1 = document.getElementById(dname);
	if (d1) {
	    d1.style.left="-500px";
	}
	if (DropTimer[x] != null) {
	    window.clearTimeout(DropTimer[x]);
	    DropTimer[x] = null;
	}
    }
}

/*
onmouseout and onmousein run each time you enter or exit a link in the menu or cross
the border of the menu.
*/

function mouseOut(DropMenuNumber) {
    DropTimer[DropMenuNumber] = window.setTimeout("hideMenu("+DropMenuNumber+");",500);
}

function mouseOver(DropMenuNumber) {
    var dname = "Drop"+DropMenuNumber;
    var d = document.getElementById(dname);
    var x1 = d.style.left;
    var y1 = d.style.top;
    var x2 = x1 + d.style.width;
    var y2 = y1 + d.style.height;
    if (DropTimer[DropMenuNumber] != null) {
	window.clearTimeout(DropTimer[DropMenuNumber]);
    }
}


// iterate this div structure for additional menu drop-downs
// don't forget to set the var 'NumberOfDropMenus' at the top of the page
// ********** begin first drop-down box ***********************
document.write("<div name=\"Drop0\" id=\"Drop0\" style=\"position:absolute;top:"+MenuTop+"px;left:-500px;background:"+MenuBackground+";color:"+MenuForeground+";padding:10px;font-size:"+MenuFontSize+";font-family:sans-serif;z-index:200;border-style:"+BorderStyle+";border-width:"+BorderWidth+";border-color:"+BorderColor+";\" onmouseover='javascript:mouseOver(0);' onmouseout='javascript:mouseOut(0);'  >"); 
document.write("<a href=\"personnel.html\" >Current Personnel</a>");
document.write("</div>");
//***********************end first drop-down box *****************
// ********** begin second drop-down box ***********************
document.write("<div name=\"Drop1\" id=\"Drop1\" style=\"position:absolute;top:"+MenuTop+"px;left:-500px;background:"+MenuBackground+";color:"+MenuForeground+";padding:10px;font-size:"+MenuFontSize+";font-family:sans-serif;z-index:200;border-style:"+BorderStyle+";border-width:"+BorderWidth+";border-color:"+BorderColor+";\" onmouseover='javascript:mouseOver(1);' onmouseout='javascript:mouseOut(1);'  >"); 
document.write("<a href=\"research.html\" >Research focus</a>");
document.write("<br><a href=\"ShowPublications.jsp\" >Publications from Shrewsbury Lab</a>");
document.write("</div>");
//***********************end first drop-down box *****************

// ********** begin third drop-down box ***********************
document.write("<div name=\"Drop2\" id=\"Drop2\" style=\"position:absolute;top:"+MenuTop+"px;left:-500px;background:"+MenuBackground+";color:"+MenuForeground+";padding:10px;font-size:"+MenuFontSize+";font-family:sans-serif;z-index:200;border-style:"+BorderStyle+";border-width:"+BorderWidth+";border-color:"+BorderColor+";\" onmouseover='javascript:mouseOver(2);' onmouseout='javascript:mouseOut(2);'  >"); 
document.write("<a href=\"extension-program.html\" >Extension Program</a>");
document.write("<br><a href=\"extension-electronic.html\" >Electronic Information Delivery</a>");
document.write("<br><a href=\"extension-pubs.html\" >Extension Publications</a>");
document.write("<br><a href=\"extension-magazines.html\" >Articles in Professional Magazines</a>");
document.write("<br><a href=\"extension-training.html\" >Education / Training Programs</a>");
document.write("</div>");
//***********************end third drop-down box *****************
