
function submenucheck(submenu, val){
    if (submenu == val){
      document.write('<img width=18 height=18 border=0 src=Images/Menus/menu-lit.gif>');
    }
    else {
      document.write('<img width=18 height=18 border=0 src=Images/Menus/menu-unlit.gif>');
    }
}  


function menus(menu, submenu){

  var tab1 = '<table border=0 cellspacing=0 cellborder=0 cellpadding=0 valign=top>'
  var tab2 = '<tr valign=top><td background="Images/Menus/menu-back.jpg">'
  var tab3 = '<tr><td bgcolor=#eeeeee><img width=115 height=12 border=0 src=Images/Menus/menu-top.gif></td></tr></table>'
  var tab4 = '<tr><td>'
  var tab5 = '</td></tr></table></td><td><img width=571 height=120 border=0 src=Images/Menus/head.gif><br>'
  var tab6 = '<table width=585 border=0 cellspacing=5 cellborder=0 cellpadding=5><tr valign=top><td>'
  var tab7 = '<table border=0 cellspacing=0 cellborder=0 cellpadding=0>'
  var tab8 = '<img width=11 height=18 border=0 src=Images/Menus/menu-right.gif><br>'
  
  document.write('<base href="http://wet.physics.iastate.edu/">');
  document.write('<meta name="MSSmartTagsPreventParsing" content="TRUE">');
  document.write('<link rel="stylesheet" type="text/css" href="http://wet.physics.iastate.edu/Scripts/wet.css">');
  document.write('<title>The Whole Earth Telescope</title>');
  document.write('<body bgcolor=#eeeeee background=Images/Graphics/back.jpg>');

  document.write(tab1);
  document.write(tab2);
  document.write(tab7);
  document.write(tab3);
  document.write(tab7);
  document.write(tab4);

// Home menu, no submenu for this!
// If the menu is selected, write the lit button graphic
  if (menu == 1){
    document.write('<a href="index.html"><img width=115 height=25 border=0 src=Images/Menus/home-lit.gif></a><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="index.html"><img width=115 height=25 border=0 src=Images/Menus/home.gif></a><br>');
  }

// About menu: submenus History, WET in the News, Video, Audio
// If the menu is selected, write the lit button graphic
  if (menu == 2){
    document.write('<a href="About/index.html"><img width=115 height=25 border=0 src=Images/Menus/about-lit.gif></a><br>');
// Check the submenus to see which one is active
// That one is lit, the others aren't
    submenucheck(submenu,1);
    document.write('<a href="About/history.html"><img width=86 height=18 border=0 src=Images/Menus/history.gif></a>');
    document.write(tab8);
    submenucheck(submenu,2);
    document.write('<a href="News/inthenews.html"><img width=86 height=18 border=0 src=Images/Menus/inthenews.gif></a>');
    document.write(tab8);
    submenucheck(submenu,3);
    document.write('<a href="Video/index.html"><img width=86 height=18 border=0 src=Images/Menus/video.gif></a>');
    document.write(tab8);
    submenucheck(submenu,4);
    document.write('<a href="Audio/index.html"><img width=86 height=18 border=0 src=Images/Menus/audio.gif></a>');
    document.write(tab8);
// Write the graphic to close the lit menu    
    document.write('<img width=115 height=17 border=0 src=Images/Menus/menu-end.gif><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="About/index.html"><img width=115 height=25 border=0 src=Images/Menus/about.gif></a><br>');
  }

// Community menu:
// If the menu is selected, write the lit button graphic
  if (menu == 3){
    document.write('<a href="Ast/community.html"><img width=115 height=25 border=0 src=Images/Menus/community-lit.gif><br>');
// Check the submenus to see which one is active
// That one is lit, the others aren't
    submenucheck(submenu,1);
    document.write('<a href="Ast/community.html"><img width=86 height=18 border=0 src=Images/Menus/astronomers.gif></a>');
    document.write(tab8);
    submenucheck(submenu,2);
    document.write('<a href="Ast/CoW.html"><img width=86 height=18 border=0 src=Images/Menus/cow.gif></a>');
    document.write(tab8);
    submenucheck(submenu,3);
    document.write('<a href="Ast/email_list.html"><img width=86 height=18 border=0 src=Images/Menus/email.gif></a>');
    document.write(tab8);
    submenucheck(submenu,4);
    document.write('<a href="Forum/simpleforum"><img width=86 height=18 border=0 src=Images/Menus/discussions.gif></a>');
    document.write(tab8);
    submenucheck(submenu,5);
    document.write('<a href="Ast/pics.html"><img width=86 height=18 border=0 src=Images/Menus/pics.gif></a>');
    document.write(tab8);
    submenucheck(submenu,6);
    document.write('<a href="Ast/upgrade.html"><img width=86 height=18 border=0 src=Images/Menus/upgrade.gif></a>');
    document.write(tab8);
// Write the graphic to close the lit menu    
    document.write('<img width=115 height=17 border=0 src=Images/Menus/menu-end.gif><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="Ast/community.html"><img width=115 height=25 border=0 src=Images/Menus/community.gif><br>');
  }

// Observatories menu:
// If the menu is selected, write the lit button graphic
  if (menu == 4){
    document.write('<a href="Obs/index.html"><img width=115 height=25 border=0 src=Images/Menus/obs-lit.gif><br>');
// Check the submenus to see which one is active
// That one is lit, the others aren't
    submenucheck(submenu,1);
    document.write('<a href="Obs/index.html"><img width=86 height=18 border=0 src=Images/Menus/sites.gif></a>');
    document.write(tab8);
    submenucheck(submenu,2);
    document.write('<a href="Obs/sitemap.html"><img width=86 height=18 border=0 src=Images/Menus/obsmap.gif></a>');
    document.write(tab8);
    submenucheck(submenu,3);
    document.write('<a href="Finders/index.html"><img width=86 height=18 border=0 src=Images/Menus/finder.gif></a>');
    document.write(tab8);
    submenucheck(submenu,4);
    document.write('<a href="Obs/deadlines.html"><img width=86 height=18 border=0 src=Images/Menus/deadlines.gif></a>');
    document.write(tab8);
    submenucheck(submenu,5);
    document.write('<a href="Obs/data.html"><img width=86 height=18 border=0 src=Images/Menus/needdata.gif></a>');
    document.write(tab8);
// Write the graphic to close the lit menu    
    document.write('<img width=115 height=17 border=0 src=Images/Menus/menu-end.gif><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="Obs/index.html"><img width=115 height=25 border=0 src=Images/Menus/obs.gif><br>');
  }

// Campaigns menu:
// If the menu is selected, write the lit button graphic
  if (menu == 5){
    document.write('<a href="campaign.html"><img width=115 height=25 border=0 src=Images/Menus/campaigns-lit.gif><br>');
// Check the submenus to see which one is active
// That one is lit, the others aren't
    submenucheck(submenu,1);
    document.write('<a href="campaign.html"><img width=86 height=18 border=0 src=Images/Menus/camplist.gif></a>');
    document.write(tab8);
    submenucheck(submenu,2);
    document.write('<a href="xcov15/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov15.gif></a>');
    document.write(tab8);
    submenucheck(submenu,3);
    document.write('<a href="xcov16/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov16.gif></a>');
    document.write(tab8);
    submenucheck(submenu,4);
    document.write('<a href="xcov17/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov17.gif></a>');
    document.write(tab8);
    submenucheck(submenu,5);
    document.write('<a href="xcov18/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov18.gif></a>');
    document.write(tab8);
    submenucheck(submenu,6);
    document.write('<a href="xcov19/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov19.gif></a>');
    document.write(tab8);
    submenucheck(submenu,7);
    document.write('<a href="xcov20/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov20.gif></a>');
    document.write(tab8);
    submenucheck(submenu,8);
    document.write('<a href="xcov21/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov21.gif></a>');
    document.write(tab8);
    submenucheck(submenu,9);
    document.write('<a href="xcov22/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov22.gif></a>');
    document.write(tab8);
    submenucheck(submenu,10);
    document.write('<a href="xcov23/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov23.gif></a>');
    document.write(tab8);
    submenucheck(submenu,11);
    document.write('<a href="xcov24/index.html"><img width=86 height=18 border=0 src=Images/Menus/xcov24.gif></a>');
    document.write(tab8);
// Write the graphic to close the lit menu    
    document.write('<img width=115 height=17 border=0 src=Images/Menus/menu-end.gif><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="campaign.html"><img width=115 height=25 border=0 src=Images/Menus/campaigns.gif><br>');
  }

// Publications mneu:
// If the menu is selected, write the lit button graphic
  if (menu == 6){
    document.write('<a href="Pubs/index.html"><img width=115 height=25 border=0 src=Images/Menus/pubs-lit.gif><br>');
// Check the submenus to see which one is active
// That one is lit, the others aren't
    submenucheck(submenu,1);
    document.write('<a href="Pubs/index.html"><img width=86 height=18 border=0 src=Images/Menus/papers.gif></a>');
    document.write(tab8);
    submenucheck(submenu,2);
    document.write('<a href="Pubs/Workshop/index.html"><img width=86 height=18 border=0 src=Images/Menus/workshop.gif></a>');
    document.write(tab8);
    submenucheck(submenu,3);
    document.write('<a href="Pubs/Newsletters/index.html"><img width=86 height=18 border=0 src=Images/Menus/newsletter.gif></a>');
    document.write(tab8);
    submenucheck(submenu,4);
    document.write('<a href="News/inthenews.html"><img width=86 height=18 border=0 src=Images/Menus/inthenews.gif></a>');
    document.write(tab8);
// Write the graphic to close the lit menu    
    document.write('<img width=115 height=17 border=0 src=Images/Menus/menu-end.gif><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="Pubs/index.html"><img width=115 height=25 border=0 src=Images/Menus/pubs.gif><br>');
  }

// Tools menu:
// If the menu is selected, write the lit button graphic
  if (menu == 7){
    document.write('<a href="Tools/index.html"><img width=115 height=25 border=0 src=Images/Menus/tools-lit.gif><br>');
// Check the submenus to see which one is active
// That one is lit, the others aren't
    submenucheck(submenu,1);
    document.write('<a href="Tools/time.html"><img width=86 height=18 border=0 src=Images/Menus/time.gif></a>');
    document.write(tab8);
    submenucheck(submenu,2);
    document.write('<a href="Tools/xqed/format.html"><img width=86 height=18 border=0 src=Images/Menus/formats.gif></a>');
    document.write(tab8);
    submenucheck(submenu,3);
    document.write('<a href="Tools/xqed/index.html"><img width=86 height=18 border=0 src=Images/Menus/xqed.gif></a>');
    document.write(tab8);
    submenucheck(submenu,4);
    document.write('<a href="Tools/usingqed/index.html"><img width=86 height=18 border=0 src=Images/Menus/qed.gif></a>');
    document.write(tab8);
    submenucheck(submenu,5);
    document.write('<a href="Tools/links.html"><img width=86 height=18 border=0 src=Images/Menus/links.gif></a>');
    document.write(tab8);
// Write the graphic to close the lit menu    
    document.write('<img width=115 height=17 border=0 src=Images/Menus/menu-end.gif><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="Tools/index.html"><img width=115 height=25 border=0 src=Images/Menus/tools.gif><br>');
  }

// Contact menu:
// If the menu is selected, write the lit button graphic
  if (menu == 8){
    document.write('<a href="About/contact.html"><img width=115 height=25 border=0 src=Images/Menus/contact-lit.gif><br>');
// Check the submenus to see which one is active
// That one is lit, the others aren't
    submenucheck(submenu,1);
    document.write('<a href="Ast/community.html"><img width=86 height=18 border=0 src=Images/Menus/astronomers.gif></a>');
    document.write(tab8);
    submenucheck(submenu,2);
    document.write('<a href="Ast/CoW.html"><img width=86 height=18 border=0 src=Images/Menus/cow.gif></a>');
    document.write(tab8);
    submenucheck(submenu,3);
    document.write('<a href="Ast/email_list.html"><img width=86 height=18 border=0 src=Images/Menus/email.gif></a>');
    document.write(tab8);
 // Write the graphic to close the lit menu    
    document.write('<img width=115 height=17 border=0 src=Images/Menus/menu-end.gif><br>');
  }
// Otherwise, write the unlit button graphic
  else {
    document.write('<a href="About/contact.html"><img width=115 height=25 border=0 src=Images/Menus/contact.gif><br>');
  }


  document.write(tab5);
  document.write(tab6);
}

function emailadd(name, domain, realname){
  output  = '<a href=mailto:' + name + '@' + domain + '>';
  output += realname + '</a>';
  document.write(output);
}

function footer(){
  document.write('<p></td></tr></table></td></tr><tr><td>');
  document.write('<img width=115 height=12 border=0 src=Images/Menus/menu-bottom.gif></td></tr></table>');
  document.write('<table width=700 border=0 cellpadding=2 valign=top><tr><td colspan=2><hr></td></tr><tr>');
  document.write('<td width=350 align=left valign=top>');
  document.write('<p>Contact the ');
  emailadd('wetmaster', 'wet.physics.iastate.edu', 'WETmaster');
  document.write('.<br>');
  document.write("Last updated: "+document.lastModified);
  document.write('</td><td width=350 align=right valign=bottom>');
  output = '<a href=' + location.href + '#top><i>Top of page</i></a>'
//  document.write(output);
  document.write('</td></tr></table></body>');
}

