ns4 = (document.layers)? true:false;

//Global Menu List
var M = new Array();

//Main Menu Definition
var MenuItems = new Array('Research Areas','research.html', 'Group','group.html', 'Links','links.html' , 'Downloads','downloads.html' );
document.write(MakeMainMenu(MenuItems));

//Define choices for  each menu here
var ResearchItems = new Array('cslm.html', 'NASA: Coarsening in solid-liquid mixtures', 'dendrites.html', 'Dendrites', '3D.html', '3D grain growth', 'cfps.html', 'Coarsening Following Phase Separation',  'SOFC.html', 'Solid Oxide Fuel Cells', 'thin_films.html', 'Thin Films', '<hr>', 'serial_sectioning.html', 'Serial Sectioning');
var GroupItems = new Array('Voorhees/Voorhees-vita.pdf','Peter Voorhees vitae','current_members.html', 'Current Members', 'alumni.html', 'Alumni');
var LinksItems = new Array('research_links.html', 'Research Related', 'northwestern_links.html', 'Northwestern');
var DownloadsItems = new Array('FILES/Voorhees_Group.pdf','Group Poster', 'animations.html', 'Animations', 'publications.html', 'Publications', 'thesis.html', 'Thesis');



//Only draw menus if client browser is not Netscape 4
if (!ns4){
   //Write the Menus to the HTML document
   WriteMenu(ResearchItems,240,10);
   WriteMenu(GroupItems,150,150);
   WriteMenu(LinksItems,130,218);
   WriteMenu(DownloadsItems,90,280);
}


function hide(menus){
   for (x=0; x<menus.length; x++)
      document.getElementById(menus[x]).style.visibility="hidden";
}


function show_Menu(menu,index){
   document.getElementById(menu[index/2]).style.visibility="visible";
}


function MakeMainMenu(items){
	var Menu = '<div><table border="0" bgColor="#660066" height="10" cellspacing="0" cellpadding="2">';
	Menu += '<tr>';

	for (x=0; x<items.length; x+=2){
		Menu += '<TD align="center" nowrap><a href="' + items[x+1] + '" onMouseOver="hide(M); show_Menu(M,' + x + ');">';
		Menu += '<font color="white"><font size=4><b>';
		Menu += items[x];
		Menu += '</b></font></a></td>';
		Menu += '<td width="10" align="center"><font color="white"><font size=4>|</font></td>';
	}
	Menu += '<td width="100%" align="right"><a href="index.html"><font color="white"><font size = 4><b>Home</b></a></td></tr>';
	Menu += '</Table></div>';
return(Menu);
}


function WriteMenu(items_array,width,offset){
        var index = M.length;
        var divID = 'DIV' + index;
        M[index] = divID;
        var HTML = '<div id="' + divID + '" onMouseLeave="hide(M);"';
        HTML += ' style="position: absolute; left: ' + offset + 'px; visibility: hidden;">';
        HTML += MakeMenu(items_array,width);
        HTML += '</div>';
        document.write(HTML);
}



function MakeMenu(items, width){
   var first_item=1;
   var Menu = '<table bgColor="#660066" style="width:' + width + '; border: none;" cellspacing=3 cellpadding=0>';

   for(x=0; x<items.length; x++){
   	 if (first_item == 1){	
            Menu += '<tr><td valign="top" style="border-collapse: collapse; border-top-style: solid; border-top-width: 1;">';
            first_item=0;
         }
         else
           Menu += '<tr><td>';

   	 if (items[x] == '<hr>')
   	 	Menu += '<hr>';
   	 else{
	  	Menu += '<A class="menu" href="' + items[x++] + '">';
    		Menu += '<font color="white" size="2"><b>';
		Menu += items[x];
    		Menu += '</b></font></a>';
    	}
	Menu += '</td></tr>';
   }
   Menu += '</table>';

   Menu += '<table height="10" border=0 cellspacing=0 cellpadding=0>';
   Menu += '<tr><td width=';
   Menu += width-15;
   Menu += ' bgColor="#660066"></td>';
   Menu += '<td><img src="images/Menu-Corner.gif" width="15" height="10"></td></tr>';
   Menu += '</table>';
return(Menu);
}















