<!--

// ************************************************************************

// Global Parameters for Menu System
// These do not need to be updated unless the design/look and feel of
// the menus is changed in such a way that it requires it.

// menuElements Array
// Definition of the menuElements array. Do not change this definition 
// statement.

var menuElements   = new Array(1);


// navBarHeight
// The navBarHeight is fixed and determined by the height of the 
// images that make up the nav labels.

var navBarHeight   = 17;


// menuLineHeight
// The menuLineHeight is the height of each line in the dropdown menu.

var menuLineHeight = 18;

// fixedMenus
// This determines whether the menus float and are positioned according to 
// the menu anchor image, OR if they are positioned according to a fixed
// pixel height and width.
// 
// The top value is the distance from the page top of the menu bar, and the 
// left value is the distance from the left edge of the window.
//
// If the menus are not detemined by the position of menuAnchor then we can
// render menus in IE4 on a Mac. This feature is NOT implemented currently.
//
// Some flavors of IE5.0 on a PC wherein if you go two pages away from the page
// containing the DHTML, it forgets how to position the menu bar. No matter what,
// it can't find the anchor image. This means that there is essentially no 
// workaround unless you are using fixed (as opposed to dynamically) placed menus.
// Perhaps use a cookie to store the value of the menu anchor locations?

var fixedMenus     = 1;
var fixedMenusTop  = 41;
var fixedMenusLeft = 311;

// menu item spacer/bullet
// If a separator of some kind, bullet etc. is used to space the top nav 
// items then its width must be incorporated into the positioning of the
// layers.

var menuSpacer = 0;

// vertical menu adjust 
// in some instances there may be a bunch of white space below the top nav
// image. this pulls the menu up a little closer to the image.

var menuVerticalAdjust = 0;

// horizontal menu adjust
// in some instances you may want to offset the menu to the left or right
// of the menu image.

var menuHorizontalAdjust = 0;


// ************************************************************************

// Configure this script for your menu here following the instructions.

// DHTML Menu Configuration Information
// The following information creates the JavaScript topnav menu items. 
// The format below must be followed precisely for success in using these
// scripts.
//
// How to configure a menu:
// 1. Don't skip numbers in sequence or things will break.
// 2. Each menu item has an entry in the menuElements array, the order of
//    these items corresponds to the order in which the top nav items 
//    are listed.
//    Within each of these definition statements, you declare:
//    - the name of the element/layer as it will be used in functions
//    - the width of the image that anchors the dropdown menu 
//    - the width of the dropdown portion of the layer
//      this must be at LEAST the value of the menu image width itself
//    - 0 for align left and 1 for align right with topnav image
//
// 3. All measurements are in pixels.
// 4. All JavaScript arrays start at -0- (NOT 1).
// 5. For each menu item, define an item in the array of that menu item 
//    (ie, menuElements[0] is an array too) for each of the links in the menu
//    when it drops down.
//    - the index of the menuElement that is its parent
//    - the text that appears in the menu
//    - the URL relative to webroot of the item


menuElements[0]    = new    menuItem("home",      48, 120, 0);
menuElements[0][0] = new subMenuItem(0, "help", "javascript:help('/help/')");
menuElements[0][1] = new subMenuItem(0, "site index", "/about/site/index/");
menuElements[0][2] = new subMenuItem(0, "advanced search", "/about/site/search/");


menuElements[1]    = new    menuItem("about",     54, 160, 0);
menuElements[1][0] = new subMenuItem(1, "what is mutatis mutandis", "/about/whatismm.html");
menuElements[1][1] = new subMenuItem(1, "what is mmmux", "/about/whatismmmux.html");
menuElements[1][2] = new subMenuItem(1, "web site", "/about/site/");
menuElements[1][3] = new subMenuItem(1, "versions", "/about/versions/");
menuElements[1][4] = new subMenuItem(1, "legal", "/about/legal/");


menuElements[2]    = new    menuItem("news",      46, 140, 0);
menuElements[2][0] = new subMenuItem(2, "mux news and events", "/news/mux/");
menuElements[2][1] = new subMenuItem(2, "web news and events", "/news/web/");


menuElements[3]    = new    menuItem("gameworld", 89,  89, 0);
menuElements[3][0] = new subMenuItem(3, "theme", "/gameworld/theme/");
menuElements[3][1] = new subMenuItem(3, "history", "/gameworld/history/");
menuElements[3][2] = new subMenuItem(3, "characters", "/gameworld/characters/");
menuElements[3][3] = new subMenuItem(3, "skills", "/gameworld/skills/");
menuElements[3][4] = new subMenuItem(3, "powers", "/gameworld/powers/");
menuElements[3][5] = new subMenuItem(3, "technology", "/gameworld/technology/");
menuElements[3][6] = new subMenuItem(3, "magic", "/gameworld/magic/");


menuElements[4]    = new    menuItem("gameplay",  75, 135, 0);
menuElements[4][0] = new subMenuItem(4, "apply for a character", "/gameplay/apply/");
menuElements[4][1] = new subMenuItem(4, "character guidelines", "/gameplay/characters/");
menuElements[4][2] = new subMenuItem(4, "roleplaying", "/gameplay/roleplay/");
menuElements[4][3] = new subMenuItem(4, "policy and rules", "/gameplay/rules/");
menuElements[4][4] = new subMenuItem(4, "administration", "/gameplay/admin/");


menuElements[5]    = new    menuItem("community", 84, 110, 0);
menuElements[5][0] = new subMenuItem(5, "roleplay logs", "/community/logs/");
menuElements[5][1] = new subMenuItem(5, "art gallery", "/community/gallery/");
menuElements[5][2] = new subMenuItem(5, "character pages", "/community/characters/");
menuElements[5][3] = new subMenuItem(5, "fan fiction", "/community/fiction/");
menuElements[5][4] = new subMenuItem(5, "code repository", "/community/code/");


menuElements[6]    = new    menuItem("contactus", 85, 140, 1);
menuElements[6][0] = new subMenuItem(6, "apply for a character", "/gameplay/apply/");
menuElements[6][1] = new subMenuItem(6, "play the game", "/contact/play/");
menuElements[6][2] = new subMenuItem(6, "give us your feedback", "/contact/feedback/");
menuElements[6][3] = new subMenuItem(6, "discussion boards", "/cgi-bin/discus/discus.cgi");
//menuElements[6][4] = new subMenuItem(6, "newsgroup", "/contact/newsgroup/");
menuElements[6][4] = new subMenuItem(6, "submit content", "/contact/submit/");


// Menu item widths
// 48 54 46 89 75 84 85


// ************************************************************************

// Preload topnav images.
//
var siteRoot = "/";

var topnavDown = "";
var snavDown   = "";

if (document.images) {
   home_on             = new Image();
   home_on.src         = siteRoot + "images/topnav/home_on.gif";
   about_on            = new Image();
   about_on.src        = siteRoot + "images/topnav/about_on.gif";
   news_on             = new Image();
   news_on.src         = siteRoot + "images/topnav/news_on.gif";
   gameplay_on         = new Image();
   gameplay_on.src     = siteRoot + "images/topnav/gameplay_on.gif";
   gameworld_on        = new Image();
   gameworld_on.src    = siteRoot + "images/topnav/gameworld_on.gif";
   community_on        = new Image();
   community_on.src    = siteRoot + "images/topnav/community_on.gif";
   contactus_on        = new Image();
   contactus_on.src    = siteRoot + "images/topnav/contactus_on.gif";

   home_off            = new Image();
   home_off.src        = siteRoot + "images/topnav/home_off.gif";
   about_off           = new Image();
   about_off.src       = siteRoot + "images/topnav/about_off.gif";
   news_off            = new Image();
   news_off.src        = siteRoot + "images/topnav/news_off.gif";
   gameplay_off        = new Image();
   gameplay_off.src    = siteRoot + "images/topnav/gameplay_off.gif";
   gameworld_off       = new Image();
   gameworld_off.src   = siteRoot + "images/topnav/gameworld_off.gif";
   community_off       = new Image();
   community_off.src   = siteRoot + "images/topnav/community_off.gif";
   contactus_off       = new Image();
   contactus_off.src   = siteRoot + "images/topnav/contactus_off.gif";

   home_down           = new Image();
   home_down.src       = siteRoot + "images/topnav/home_down.gif";
   about_down          = new Image();
   about_down.src      = siteRoot + "images/topnav/about_down.gif";
   news_down           = new Image();
   news_down.src       = siteRoot + "images/topnav/news_down.gif";
   gameplay_down       = new Image();
   gameplay_down.src   = siteRoot + "images/topnav/gameplay_down.gif";
   gameworld_down      = new Image();
   gameworld_down.src  = siteRoot + "images/topnav/gameworld_down.gif";
   community_down      = new Image();
   community_down.src  = siteRoot + "images/topnav/community_down.gif";
   contactus_down      = new Image();
   contactus_down.src  = siteRoot + "images/topnav/contactus_down.gif";
}


// Predefine bullet for mouseovers
//
if (document.images) {
   bullet_off     = new Image();
   bullet_off.src = "/images/t.gif";
   bullet_on      = new Image();
   bullet_on.src  = "/images/layout/link_arrows_dhtml.gif";
}



// ************************************************************************


// DO NOT CHANGE ANYTHING BELOW THIS LINE...


// unless you know JavaScript well enough. Any changes made below will not
// be supported.

// These two functions create the JavaScript objects for topnav menu items
// and the list of submenu items that appear under them. Changing these two
// function definitions will break the menus.

// boolean to track whether menuItem has been called
var madeMenuItem = false;


function menuItem(name, mWidth, width, align) {
   // window.status = "Creating " + name + " menu...";
   this.name     = name;
   this.mName    = name + "Menu";
   this.mLeft    = 0;
   this.left     = 0;
   this.top      = 0;
   this.mWidth   = mWidth;
   if ( madeMenuItem ) { this.mWidth += menuSpacer; }
   this.width    = width;
   this.height   = 0;
   this.children = 0;
   this.align    = align;
   madeMenuItem  = true;
}

function subMenuItem(parent, name, href) {
   this.name     = name;
   this.href     = href;
   this.parent   = menuElements[parent];

   this.parent.children++;
   this.parent.height = this.parent.children * menuLineHeight;
}

// window.status    = "Done.";


// ************************************************************************


// Browser detection variables and other initializations
//
// Convert all characters to lowercase to simplify testing
//
var agt        = navigator.userAgent.toLowerCase();
var is_major   = parseInt(navigator.appVersion);

var is_ie      = ((agt.indexOf("msie")       != -1) && (agt.indexOf("opera")   == -1));
var is_nav     = ((agt.indexOf('mozilla')    != -1) && (agt.indexOf('spoofer') == -1)
               && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')   == -1)
               && (agt.indexOf('webtv')      == -1) && (agt.indexOf('hotjava') == -1));

var is_ie4     = (is_ie  && (is_major == 4));
var is_ie4up   = (is_ie  && (is_major >= 4));
var is_nav4up  = (is_nav && (is_major >= 4));
var is_nav6up  = (is_nav && (is_major >= 5));

var is_win     = ((agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1));
var is_mac     = (agt.indexOf("mac")!=-1);


// Cross-browser Notes
//
// * Netscape				* IE
//   eventObj				  event
//   pageX				  clientX
//   pageY				  clientY
// 
// Debugging : Use window.status for ourput!
//


// Event handler function for mouse move event.
//
function handleMouseMove(eventObj) {
   var aboveNavBar = menuElements[0].top - navBarHeight - getScrollY();

   // Check to see if we are on the nav bar -- if so, we're moving
   // horizontally from one item to the next. Hide current menu to 
   // show next.
   if (is_nav6up) {
      // window.status = eventObj.clientX + ":" + eventObj.clientY;
      // window.status = "offNavBar: " + offNavBar(eventObj);
      // window.status = "ClientY: " + eventObj.clientY + " test: " + aboveNavBar;
      if ( !(offNavBar(eventObj)) && eventObj.ClientY <= aboveNavBar ) {
         hideMenu(menuState);
         return;
      }
   } else if (is_nav4up) {
      if ( !(offNavBar(eventObj)) && eventObj.PageY <= aboveNavBar ) {
         hideMenu(menuState);
         return;
      }
   } else if (is_ie4up) {
      // window.status = event.clientX + ":" + event.clientY;
      // window.status = "ClientY: " + event.clientY + " test: " + aboveNavBar;
      if ( !(offNavBar(event)) && event.clientY <= aboveNavBar ) {
         hideMenu(menuState);
         return;
      }
   }

// Manage the event. If the cursor is outside the menuState image
// then hide the layer...
   if (is_nav6up) {
      // window.status = eventObj.clientX + ":" + eventObj.clientY;
      // window.status = "offNavBar: " + offNavBar(eventObj);
      if ( (!(onLayer(eventObj, menuState)) &&
              document.getElementById( menuState ).style.visibility == "visible" ) ) {
         if ( offNavBar(eventObj) || belowLayer(eventObj, menuState) ) {
            hideMenu(menuState);
            document.removeEventListener("mousemove", handleMouseMove, true);
            menuState = "";
         }
      }
   } else if (is_nav4up) {
      if ( (!(onLayer(eventObj, menuState)) && 
              document.layers[menuState].visibility == "show" ) ) {
         if ( offNavBar(eventObj) || belowLayer(eventObj, menuState) ) {
            hideMenu(menuState);
            document.releaseEvents(Event.MOUSEMOVE);
            menuState  = "";
         }
      }
   } else if (is_ie4up) {
      if ( (!(onLayer(event, menuState)) && 
            document.all[menuState].style.visibility == "visible" ) ) {
         if ( offNavBar(event) || belowLayer(event, menuState) ) {
            hideMenu(menuState);
            window.event.returnValue = false;
            event.cancelBubble = true;
         }
      }
   }
}


// Determine whether the eventObj occurs on the topnav bar. Thus 
// "off" the topnav bar corresponds to any one of the following:
// * y coordinate above bar
// * x coordinate right of bar
// * x coordinate left of bar
// We discount any movement down from the bar as that occurs over
// the appropriate menu.
// We also use scrollY and scrollOffset to determine if the scrollbar
// has moved (thus the image moved).
//
function offNavBar(eventObj) {
   var menuIndex = getMenuIndex(menuState);
   var aboveNavBar = menuElements[0].top - navBarHeight - getScrollY();

   if (is_nav6up || is_ie4up) {
      // window.status = "Current event: " + eventObj.currentTarget;
      if ( (eventObj.clientX < menuElements[menuIndex].left) ||
           (eventObj.clientX > menuElements[menuIndex].left + menuElements[menuIndex].mWidth ) ||
           (eventObj.clientY < aboveNavBar) ) {
         return 1;
      } else {
         return 0;
      }
   } else if (is_nav4up) {
      if ( (eventObj.pageX < menuElements[menuIndex].left) ||
           (eventObj.pageX > menuElements[menuIndex].left + menuElements[menuIndex].mWidth ) ||
           (eventObj.pageY < aboveNavBar) ) {
         return 1;
      } else {
         return 0;
      }
   }
}


// Determine if the eventObj is on the menu in question.
//
function onLayer(eventObj, menu) {
   // Grab the index of the current menu in menuElements array to be able
   // to reference its other object properties.
   var menuIndex = getMenuIndex(menu);
   var aboveNavBar = menuElements[0].top - navBarHeight - getScrollY();

   // Check location of event object compared to location of menu
   if (is_ie4up || is_nav6up) {
      if ( (eventObj.clientX < menuElements[menuIndex].left ) ||
       (eventObj.clientX > menuElements[menuIndex].left + menuElements[menuIndex].width ) ||
       (eventObj.clientY < aboveNavBar ) || belowLayer(eventObj, menu) ) {
         return 0;
      } else {
         return 1;
      }
   } else if (is_nav4up) {
      if ( (eventObj.pageX < menuElements[menuIndex].left ) ||
       (eventObj.pageX > menuElements[menuIndex].left + menuElements[menuIndex].width ) ||
       (eventObj.pageY < aboveNavBar ) || belowLayer(eventObj, menu) ) {
         return 0;
      } else {
         return 1;
      }
   }
}


// Determine whether event is below the menu layer.
//
function belowLayer(eventObj, menu) {
   var menuIndex = getMenuIndex(menu);

   if (is_nav4up) {
      if (eventObj.pageY > menuElements[menuIndex].top  + menuElements[menuIndex].height + 5 ) {
         return 1;
      } else {
         return 0;
      }
   } else if (is_ie4up) {
      if (eventObj.clientY > menuElements[menuIndex].top + menuElements[menuIndex].height + 5  - getScrollY()) {
         return 1;
      } else {
         return 0;
      }
   }
}


// Get the index of the menu item from the menuElements array.
//
function getMenuIndex(menuName) {
   var i, j=-1;
   for ( i = 0; i < menuElements.length; i++ ) {
      if ( menuElements[i].mName == menuName) {
         j = i;
      }
   }
   return j;
}


// Show menu function 
//
function showMenu(menu) {
   // if skipMenus is true, we just bail out now.
   if ( skipMenus ) return;

   var menuLayer = menu + "Menu";

   // Highlight the topnav menu image if needed.
   imgOn(menu);

   // Hide all menus, overkill for idiosyncratic behavior
   // hideAllMenus( );

   // Hide shown menu if different from requested
   // If a menu is already displayed but it is not equal to the currently
   // requested menu, we hide the menu currently displayed.
   if ( (menuState != menuLayer) && (menuState != "") && (menuState != null) ) {
      hideMenu(menuState);
   }

   // We reset the menuState to the requested menu. Must be done after hideMenu.
   menuState = menuLayer;

   // Show the menu requested.
   if (is_nav6up) {
      var elm = document.getElementById( menuLayer );
      elm.style.visibility = "visible";
      document.addEventListener("mousemove", handleMouseMove, true);
   } else if (is_nav4up) {
      document.layers[menuLayer].visibility = "show";
      document.captureEvents(Event.MOUSEMOVE);
      document.onmousemove = handleMouseMove;
   } else if (is_ie4up) {
      document.all[menuLayer].style.visibility = "visible";
      document.onmousemove = handleMouseMove;
   }

   // window.status = menu;
}


// Compute scroll y
//
function getScrollY() {
   if (is_ie4up) {
      return document.body.scrollTop;
   } else if (is_nav6up) {
      // there isn't a way to determine the scroll position in DOM. 
      // http://lists.w3.org/Archives/Public/www-dom/2000JulSep/0002.html 
      // so it seems that any amount that is bigger than the distance from the top
      // of the page down to the menu works. Dunno why.
      return 100;
   }
   return 0;
}



// **********************************************************************


// Hide all menus function
//
function hideAllMenus( ) {
   // Restore the topnav menu image if needed.
   for ( i = 0; i < menuElements.length; i++ ) {
      if ( menuState != menuElements[i].mName ) {
         imgOff(menuElements[i].name);
      }
      if (is_nav6up) {
         elm = document.getElementById(menuElements[i].mName);
         elm.style.visibility = "hidden";
      } else if (is_nav4up) {
         document.layers[menuElements[i].mName].visibility = "hide";
      } else if (is_ie4up) {
         document.all[menuElements[i].mName].style.visibility = "hidden";
      }
   }
}


// Hide function for non-pointer layer/objects
//
function hideMenu(menu) {
   // We only hide if menu is not null, of course. Some times it 
   // forgets what menu is... so we make sure a menu is showing.
   if ( menu != "" ) {
      // Restore the topnav menu image if needed.
      var menuImage = menu.substring(0, menu.indexOf('Menu'));
      imgOff(menuImage);

      if (is_nav6up) {
         document.getElementById( menu ).style.visibility = "hidden";
      } else if (is_nav4up) {
         document.layers[menu].visibility = "hide";
      } else if (is_ie4up) {
         document.all[menu].style.visibility = "hidden";
      }
   }
}


// Show/Hide functions for mouseovers
//
function showBullet(imgName, menu) {
   if (document.images) {
      if (is_nav6up || is_ie4up) {
         document.images[imgName].src = bullet_on.src;
      } else if (is_nav4up) {
         document.layers[menu].document.images[imgName].src = bullet_on.src;
      }
   }
}

function hideBullet(imgName, menu) {
   if (document.images) {
      if (is_nav6up || is_ie4up) {
         document.images[imgName].src = bullet_off.src;
      } else if (is_nav4up) {
         document.layers[menu].document.images[imgName].src = bullet_off.src;
      }
   }
}


// Functions for handling state changes in menu images.
//
function imgOn(imgName) {
   if ( (document.images) && (topnavDown != imgName) && (snavDown != imgName) ) {
      document[imgName].src = eval(imgName + "_on.src");
   }
}

function imgOff(imgName) {
   if ( (document.images) && (topnavDown != imgName) && (snavDown != imgName) ) {
      document[imgName].src = eval(imgName + "_off.src");
   }
}

function imgDown(imgName, locale) {
   if (document.images) {
      if (locale == "topnav") {
         topnavDown = imgName;
      } else if (locale == "snav") {
         snavDown = imgName;
      }
      document[imgName].src = eval(imgName + "_down.src");
   }
}


// In Netscape 4x, if the window is resized the dynamic layers disappear. In other browsers
// the menus end up no longer being under their menu tops.
//
// This function handles the resize event when it occurs
//
function handleResize() {
   if (is_nav6up) {
      document.removeEventListener("resize", handleResize, true);
   } else if (is_nav4up && !is_nav6up) {
      if (saveInnerWidth  < window.innerWidth  ||
          saveInnerWidth  > window.innerWidth  ||
          saveInnerHeight > window.innerHeight ||
          saveInnerHeight < window.innerHeight ) {
         document.releaseEvents(Event.RESIZE);
      }
   } else if (is_ie4up) {
      window.event.returnValue = false;
      event.cancelBubble       = true;
   }
   setTimeout("resizeAlert()", 1000);
}


// Alert message delivery
//
function resizeAlert() {
// TOO SPAMMY!
//   alert("The window has been resized.\n\nIn order to properly dispaly the dynamic menus within this document,\nthe document will now be reloaded.");
   location.reload();
}


// This portion of the menus reads in the layers and initializes event
// tracking for netscape resize problem.
//
// We want to execute the layers only if it satisfies ie4+, ns4+ and is
// not ns6+. Later need to extend to ns6+.
//
if ( ( is_nav4up || is_ie4up ) && !skipMenus) {

// HTML variables to control formatting of dropdown menus.
   var spacerGif    = "/images/t.gif";
   var menuItemHeight = menuLineHeight - 2;

   var bulletRowOp  = "<tr><td valign=\"middle\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"100\%\" class=\"dhtmlMenuItem\"><tr><td valign=\"top\"><img src=\"" + spacerGif + "\" width=\"7\" height=\"13\" alt=\"*\" border=\"0\" hspace=\"1\" vspace=\"2\" name=\"bullet_";
   var bulletRowJn  = "</td>\n<td valign=\"middle\" width=\"100\%\">";
   var bulletRowCl  = "</td>\n<td><img src=\"" + spacerGif + "\" + width=\"1\" height=\"1\" alt=\"clear image\" border=\"0\"></td></tr></table></td></tr>";


// Miscellaneous initializations.
var menuState  = "";
var skipMenus  = (is_mac && is_ie4);
var anchorName = "menuAnchor";

// Determine the position of the menus using anchor if dynamic, fixed if not.
   if (fixedMenus) {
      menuAnchorLeft = fixedMenusLeft;
      menuAnchorTop  = fixedMenusTop;
   } else {
      if (is_nav6up) {
         //alert( menuAnchorLeft + ":" + menuAnchorTop );
         var elm = document.getElementById(anchorName);
         var menuAnchorLeft = elm.x + elm.width;
         var menuAnchorTop  = elm.y + elm.height;
      } else if (is_nav4up) {
         var menuAnchorLeft = document.images[anchorName].x
                            + document.images[anchorName].width;
         var menuAnchorTop  = document.images[anchorName].y 
                            + document.images[anchorName].height;
      } else {
         var menuAnchorLeft = document.all[anchorName].offsetLeft
                            + document.all[anchorName].width;
         var menuAnchorTop  = document.all[anchorName].offsetTop 
                            + document.all[anchorName].height;
      }
   }
   // account for height of nav bar
   menuAnchorTop += navBarHeight;

   // window.status   = menuAnchorLeft + ":" + menuAnchorTop;
   // alert( menuAnchorLeft + ":" + menuAnchorTop );

   // Adjust the menu anchor position according to the horizontal and
   // vertical adjustments
   menuAnchorTop   = menuAnchorTop  + menuVerticalAdjust;
   menuAnchorLeft  = menuAnchorLeft + menuHorizontalAdjust;


// Write the layers.
// alert("Writing the layers.");
   for ( i = 0; i < menuElements.length; i++ ) {
      menuElements[i].left = menuElements[i].left + menuAnchorLeft;
      menuElements[i].top  = menuElements[i].top  + menuAnchorTop;
      if ( i > 0 ) { 
         menuElements[i].left += menuSpacer; 
         // alert( "Adding to " + menuElements[i].name ); 
      }

      for ( k = 0; k < i; k ++ ) {
         menuElements[i].left = menuElements[i].left + menuElements[k].mWidth;
      }
      // alert("A" + menuElements[i].left + ":" + menuElements[i].top);

      // Anchor menu images.
      menuElements[i].mLeft   = menuElements[i].left;

      // Take into consideration alignment for the image.
      if ( menuElements[i].align == 1 ) {
         menuElements[i].left = menuElements[i].left 
                              + menuElements[i].mWidth - menuElements[i].width
                              - menuSpacer;
      }

      if ( is_nav6up && i > 0 ) {
         lLeft = menuElements[i].left - menuElements[i-1].left;
         lTop  = menuElements[i].top  - menuElements[i-1].top;
      } else {
         lLeft = menuElements[i].left;
         lTop  = menuElements[i].top;
      }

      if (is_nav6up) {
        // str = "<div id=\"" + menuElements[i].mName + "\" name=\"" + menuElements[i].mName + "\" style=\"position: absolute; left: " + menuElements[i].left + "px; top: " + menuElements[i].top + "px; width: " + menuElements[i].width + "px; height: " + menuElements[i].height + "px; visibility:hidden\">";
        // alert( str );

        document.writeln("<div id=\"" + menuElements[i].mName + "\" name=\"" + menuElements[i].mName + "\" style=\"position: absolute; left: " + lLeft + "px; top: " + lTop + "px; width: " + menuElements[i].width + "px; height: " + menuElements[i].height + "px; visibility:hidden\">");
      } else if (is_ie4up) {
         document.writeln("<div id=\"" + menuElements[i].mName + "\" style=\"position: absolute; left: " + menuElements[i].left + "px; top: " + menuElements[i].top + "px; width: " + menuElements[i].width + "px; height: " + menuElements[i].height + "px; visibility:hidden\">");
      } else { 
         document.writeln("<layer id=\"" + menuElements[i].mName + "\" left=\"" + menuElements[i].left  + "\" top=\"" + menuElements[i].top + "\" width=\"" + menuElements[i].width + "\" height=\"" + menuElements[i].height + "\" visibility=\"hidden\">");
      }

      document.writeln("<table border=\"0\" width=\"" + menuElements[i].width + "\" cellspacing=\"0\" cellpadding=\"1\" name=\"" + menuElements[i].mName + "\" class=\"dhtmlMenuBox\">");
      if (menuElements[i][0]) {
         document.writeln(bulletRowOp + i + "_0\">" + bulletRowJn + "<a href=\"" + menuElements[i][0].href + "\" class=\"dhtmlMenuLink\" onMouseOver=\"showBullet('bullet_" + i + "_0', '" + menuElements[i].mName + "')\" onMouseOut=\"hideBullet('bullet_" + i + "_0', '" + menuElements[i].mName + "')\">" + menuElements[i][0].name + "</a>" + bulletRowCl);

         for ( j = 1; j < menuElements[i].children; j++ ) {
            document.writeln(bulletRowOp + i + "_" + j + "\">" + bulletRowJn + "<a href=\"" + menuElements[i][j].href + "\" class=\"dhtmlMenuLink\" onMouseOver=\"showBullet('bullet_" + i + "_" + j + "', '" + menuElements[i].mName + "')\" onMouseOut=\"hideBullet('bullet_" + i + "_" + j + "', '" + menuElements[i].mName + "')\">" + menuElements[i][j].name + "</a>" + bulletRowCl);

         }
      }
      document.writeln("</table>\n");
      if (is_nav4up) {
         document.writeln("</layer>");
      } else {
         document.writeln("</div>");
         //alert(document.all[menuElements[i].mName]);
      }
   }

}


// Initiate handling of resize of window
//
if (is_nav4up || is_nav6up) {
   if (!window.saveInnerWidth) {
      window.onresize        = handleResize;
      window.saveInnerWidth  = window.innerWidth;
      window.saveInnerHeight = window.innerHeight;
   }
} else if (is_ie4up) {
   window.onresize          = handleResize;
}


// ************************************************************************

//-->
