
  /*
    these three functions are used for the image swapping when hovering 
    over the menu links
  */

  function restore_image() {
    var ri_i, ri_x, ri_a=document.MM_sr;
    for(ri_i=0; ri_a&&ri_i<ri_a.length&&(ri_x=ri_a[ri_i])&&ri_x.oSrc; ri_i++)
      ri_x.src = ri_x.oSrc;
  }

  function find_object(fo_n, fo_d) {
    var fo_p, fo_i, fo_x;
    if (!fo_d)
      fo_d=document;
    if ((fo_p=fo_n.indexOf("?"))>0&&parent.frames.length) {
      fo_d=parent.frames[fo_n.substring(fo_p+1)].document;
      fo_n=fo_n.substring(0,fo_p);
    }
    if (!(fo_x=fo_d[fo_n])&&fo_d.all)
      fo_x=fo_d.all[fo_n];
    for (fo_i=0;!fo_x&&fo_i<fo_d.forms.length;fo_i++)
      fo_x=fo_d.forms[fo_i][fo_n];
    for (fo_i=0; !fo_x&&fo_d.layers&&fo_i<fo_d.layers.length; fo_i++)
      fo_x=MM_findObj(fo_n,fo_d.layers[fo_i].document);
    return fo_x;
  }

  function swap_image() {
    var si_i, si_j=0, si_x, si_a=swap_image.arguments;
    document.MM_sr=new Array;
    for(si_i=0;si_i<(si_a.length-2);si_i+=3)
      if ((si_x=find_object(si_a[si_i]))!=null) {
        document.MM_sr[si_j++]=si_x;
        if (!si_x.oSrc)
          si_x.oSrc=si_x.src;
        si_x.src=si_a[si_i+2];
      }
  }


  /* 
    function to draw the menu at the top of the page depending on the page name
  */
  function draw_menu(url) {
    
    /* 
      extract the name of the page from the url
    */
    var docname = extract_filename(url);

    /* 
      cycle through the list of pages and draw the relevant black or red image
      depending on whether it is the current page or not
    */
    for (var i=0; i<a.length; i++) { 
      document.write('<a href="');
      document.write(a[i]);
      document.write('.html"');
      if (!(docname == a[i])) {
        document.write(' onMouseOut="restore_image()" onMouseOver="swap_image(\'');
        document.write(a[i]);
        document.write('\',\'\',\'images/menutext/');
        document.write(a[i]);
        document.write('55grey');
        document.write('.gif\',0)"');
      }
      document.write('>');
      document.write('<img name="');
      document.write(a[i]);
      document.write('" src="images/menutext/');
      document.write(a[i]);
      document.write('55');
      if (docname == a[i])
        document.write('red')
      else document.write('black');
      // just two spaces between words
      document.write('.gif"></a>&nbsp;&nbsp;');
    }
  }

