/* define variables for "if n4 (Netscape 4), if IE (IE 4.x), 
and if n6 (if Netscape 6/W3C-DOM compliant)" */
 
var n4, ie, n6;
 
/* detecting browser support for certain key objects/methods and 
assembling a custom document object */
 

var doc,doc2,doc3,sty;
 
if (document.layers) {
  doc = "document.";
  doc2 = ".document.";
  doc3 = "";
  sty = "";
  n4 = true;
  }
else if (document.all) {
  doc = "document.all.";
  doc2 = "";
  doc3 = "";
  sty = ".style";
  ie = true;
}
 
else if (document.getElementById) {
  doc = "document.getElementById('";
  doc2 ="')";
  doc3 ="')";
  sty = "').style";
  n6 = "true";
 } 
 
 
//position the element on the page.
 
function placeIt(elem,leftPos,topPos) {
docObj = eval(doc + elem + sty);
if (n4 || n6) {
docObj.left = leftPos;
docObj.top= topPos;
 }
if (ie) {
docObj.pixelLeft = leftPos;
docObj.pixelTop = topPos;
 }
}
 
// preload navigation images
 
var loaded = 0;
var navdir = "graphics/";
 
function preload() {
 
top_a_off = new Image;
top_a_off.src = navdir + "about.gif";
 
top_a_on = new Image;
top_a_on.src = navdir + "about1.gif";
 
top_b_off = new Image;
top_b_off.src = navdir + "pubs.gif";
 
top_b_on = new Image;
top_b_on.src = navdir + "pubs1.gif";
 
top_c_off = new Image;
top_c_off.src = navdir + "prog.gif";
 
top_c_on = new Image;
top_c_on.src = navdir + "prog1.gif";
 
top_d_off = new Image;
top_d_off.src = navdir + "net.gif";
 
top_d_on = new Image;
top_d_on.src = navdir + "net1.gif";
 
top_e_off = new Image;
top_e_off.src = navdir + "news.gif";
 
top_e_on = new Image;
top_e_on.src = navdir + "news1.gif";

top_f_off = new Image;
top_f_off.src = navdir + "links.gif";
 
top_f_on = new Image;
top_f_on.src = navdir + "links1.gif";
 
loaded = 1;
}
 
// img src swap function
function onoff (elemparent,elem,state) {
if (loaded) {
newstate = eval(elem+"_"+state);
if (n4) {
menuObj = eval (doc + elemparent + doc2 + elem);
 }
else if (ie || n6) {
menuObj = eval (doc + elem + doc2);
 }
menuObj.src = newstate.src;
 }
}
 

// mouse over (on) and mouseoff(off) color values
var oncolor = "#0000FF";
var offcolor = "#CCCCCC";
 
function changecolor(divname,colorname) {
stopall();
if (!n4) {
menuObj = eval(doc + divname + sty);
menuObj.backgroundColor = colorname;
  }
}
 
// show or hide DIV element
function showhide(divname,state) {
if (n4) {
divObj = eval (doc + divname);
 }
else {
divObj = eval (doc + divname + sty);
}
divObj.visibility = state;
}
 

// variables that hold the value of the currently active (open) menu
var active_submenu1 = null;
var active_menuelem = null;
var active_topelem = null;
 
// function closes all active menus and turns back to 'off' state
function closeallmenus() {
if(active_submenu1 != null) {
  showhide(active_submenu1,'hidden');
  }
 
if(active_menuelem != null) {
  changecolor(active_menuelem,offcolor);
  }
if(active_topelem != null) {
  onoff('mainmenu',active_topelem,'off');
  }
}
 
// the menu close timeout variable
var menu_close_timeout = 0;
 
// delay in miliseconds until the open menus are closed
var delay = 500;
 
// function calls the closeallmenus() function after a delay
function closeall() {
menu_close_timeout = setTimeout('closeallmenus()',delay);
}
 
// stop all timeout functions (stops menus from closing)
function stopall() {
clearTimeout(menu_close_timeout);
}
 
// function controls submenus 
function controlsubmenu(submenu1,menuelem,topelem) {
stopall();
closeallmenus();
if (submenu1 != null) {
  showhide(submenu1,'visible');
  active_submenu1 = submenu1;
  }
if (menuelem != null) {
 changecolor(menuelem,oncolor);
 active_menuelem = menuelem;
 }
if (topelem != null) {
 onoff('mainmenu',topelem,'on');
 active_topelem = topelem;
 }
}
 

function initialize() {
preload();
closeallmenus();
stopall();
 
placeIt('mainmenu',10,262);
placeIt('a',150 ,240);
placeIt('b',150 ,290);
placeIt('c',150 ,340);
placeIt('d',150 ,390);
placeIt('e',150 ,440);
placeIt('f',150 ,490);
 
}    
