function MenuItem(name, href) {
  this.name = name;
  this.href = href;
  
  this.getName = MenuItem_getName;
  this.getHREF = MenuItem_getHREF;
}

function MenuItem_getName() {
  return this.name;
}

function MenuItem_getHREF() {
  return this.href;
}


function Menu(name, imgName, href, menuItems) {
  this.name = name;
  this.imgName = imgName;
  this.href = href;
  this.menuItems = menuItems;
  
  this.getName = Menu_getName;
  this.getImageName = Menu_getImageName;
  this.getHREF = Menu_getHREF;
  this.getMenuItems = Menu_getMenuItems;
}

function Menu_getName() {
  return this.name;
}

function Menu_getImageName() {
  return this.imgName;
}

function Menu_getHREF() {
  return this.href;
}

function Menu_getMenuItems() {
  return this.menuItems;
}

 
//Home Menu
var homeMenu = new Menu("homeMenu","roll/home-off.gif","index.htm", null);

// Bio Menu
i = 0;
var bioMenuItems = new Array();
bioMenuItems[i++] = new MenuItem("Official","official.htm");
bioMenuItems[i++] = new MenuItem("Reviews","reviews.htm");
bioMenuItems[i++] = new MenuItem("Personal","personal.htm");
bioMenuItems[i++] = new MenuItem("Curriculum em Portugues","portugues.htm");
var bioMenu = new Menu("bioMenu","roll/bio-off.gif","biography.htm", bioMenuItems);

// Works Menu
i = 0;
var worksMenuItems = new Array();
worksMenuItems[i++] = new MenuItem("Compositions By Title","compositions_by_title.asp");
worksMenuItems[i++] = new MenuItem("Compositions By Opus","compositions_by_opus.asp");
worksMenuItems[i++] = new MenuItem("Pedagogical Series","pedagogical.htm");
var worksMenu = new Menu("worksMenu","roll/works-off.gif","works.htm", worksMenuItems);

//Whats New Menu
var newsMenu = new Menu("newsMenu","roll/new-off.gif","news2.asp", null);

//Store Menu
var storeMenu = new Menu("storeMenu","roll/store-off.gif","http://www.propercussaobrasil.com", null);

//Photo Menu
var photoMenu = new Menu("photoMenu","roll/photo-off.gif","photo.htm", null);

// Disco Menu
i = 0;
var cdMenuItems = new Array();
cdMenuItems[i++] = new MenuItem("Recordings By Ney Rosauro","by_nr.htm");
cdMenuItems[i++] = new MenuItem("Recordings By Other Artists","by_others.htm");
//cdMenuItems[i++] = new MenuItem("Audio Samples","audio.htm");
var cdMenu = new Menu("cdMenu","roll/disco-off.gif","disco.htm", cdMenuItems);

// Perf Menu
i = 0;
var perfMenuItems = new Array();
perfMenuItems[i++] = new MenuItem("Previous Concerts","previous.asp");
//perfMenuItems[i++] = new MenuItem("Upcoming Events","future.htm");
var perfMenu = new Menu("perfMenu","roll/perf-off.gif","performances.htm", perfMenuItems);

//Contact Menu
var contactMenu = new Menu("contactMenu","roll/contact-off.gif","contact.htm", null);

//Links Menu
var linksMenu = new Menu("linksMenu","roll/links-off.gif","links.htm", null);

//Articles Menu
var articlesMenu = new Menu("articlesMenu","roll/articles-off.gif","articles.htm", null);

//Videos Menu
var videosMenu = new Menu("videosMenu","roll/videos-off.gif","videos.htm", null);

i = 0;
var Menus = new Array();
Menus[i++] = homeMenu;
Menus[i++] = bioMenu;
Menus[i++] = worksMenu;
Menus[i++] = newsMenu;
Menus[i++] = storeMenu;
Menus[i++] = photoMenu;
Menus[i++] = cdMenu;
Menus[i++] = perfMenu;
Menus[i++] = contactMenu;
Menus[i++] = linksMenu;
Menus[i++] = articlesMenu;
Menus[i++] = videosMenu;

	var NSLayerCW = 0;
	var NSLayerCH = 0;

	var ParentMenu = '';
	var CurMenu = '';
	var tCmd = '';
	var cCmd = '';
	var AnimStep = 0;
	var as = 0;
	var DoFormsTweak = false;

  var BV=parseInt(navigator.appVersion);
  var BN=window.navigator.appName;
  var IsMac=(navigator.userAgent.indexOf('Mac')!=-1)?true:false;
  var Opera=(navigator.userAgent.indexOf('Opera')!=-1)?true:false;
  var NS=(BN.indexOf('Netscape')!=-1&&(BV==4)&&!Opera)?true:false;
  var IE=(BN.indexOf('Explorer')!=-1&&(BV>=4)&&!Opera)?true:false;

  var W3C=document.getElementById&&BV>=5; // for NS6 support and W3C DOM support

	if ((frames.length==0) && IsMac) {
		frames.top = window;
	}
	var mFrame = eval(frames['top']);
	var cFrame = eval(frames['top']);

	var fx = 1;


	function HideAll() {
		if(!as) {
      for (i=0; i<Menus.length; i++) {
        if (Menus[i].getMenuItems() != null) 
          Hide(Menus[i].getName());
      }
		}
	}

	function GetCurCmd() {
		//IE
		//This function will return the current command under the mouse pointer. 
    //It will return null if the mouse is not over any command.
		//------------------------------
		//Version 1.3
		//
		if(event==null)
			var cc = window.event.srcElement;
		else
			var cc = window.event.srcElement;
		while((cc.id=="") && (cc.tagName!="TD")) {
			cc = cc.parentElement;
			if(cc==null)
				break;
		}
		return cc;
	}
	

  function HoverSel(elem, mode) {
		//W3C
		//This is the function called every time the mouse pointer is moved over or away from a command.
		//------------------------------
		//evt: the W3C event
		//------------------------------
		//
    var mc = document.getElementById(elem);

    if (mode)
      mc.className = "menuItem";
    else {
      mc.className = "menuItemOver";
    }
		cCmd = mc;
	}

	function IEHoverSel(mode) {
		//IE
		//This is the function called every time the mouse pointer is moved over or away from a command.
		//------------------------------
		//mode: 0 if the mouse is moving over the command and 1 if is moving away
		//------------------------------
		//Version 7.5
		//
		var mc = GetCurCmd();

		with(mc) {
			if(mode) {
				className = "ieMenuItem";
			} else {
				className = "ieMenuItemOver";
			}
		}
		cCmd = mc;
	}

	function NSHoverSel(menu_name, menu_item, index, mode, w, h) {
		//NS
		//This is the function called every time the mouse pointer is moved over or away from a command.
		//------------------------------
		//menu_name: Name of the layer that corresponds to the selected command
    //menu_name: Name of the menu item.
		//mode: 0 if the mouse is moving over the command and 1 if is moving away
		//index: Unique ID that identifies this Layer.
		//w: Width of the command's layer.
		//h: Height of the command's layer.
		//------------------------------
		//Version 9.4
		//
    cNSCmd = document.layers[menu_name].layers["MC0"+index];
		if(mode) {
			var LayerHTM = "<body class=\"nsMenuItem\">"+menu_item+"</body>";
      //window.status = "";
		} else {
			var LayerHTM = "<body class=\"nsMenuItemOver\">"+menu_item+"</body>";
      //window.status = menu_item.replace("<br>", " ");
    }

		if(cCmd!=cNSCmd || mode) {
			cNSCmd.document.open();
			cNSCmd.document.write(LayerHTM);
			cNSCmd.document.close();

			cNSCmd.resizeTo(w,h);
		}
		cCmd=cNSCmd;
	}

	function Hide(menuId) {

		//IE,NS,W3C

		//This function hides the group identified by the menuId parameter.

		//It also resets the values of the CurMenu and ParentMenu variables 

    //to reflect the changes of the hidden menu.

		//------------------------------

		//menuId: Name of the group's <div> or <layer> to be hidden.

		//------------------------------

		//Version 1.6

		//

    toggleImageOff(menuId);

    if(IE)

			var Menu = document.all[menuId].style;

		else if(NS)

			var Menu = document.layers[menuId];

    else if(W3C)

      var Menu = document.getElementById(menuId).style;

      

    with(Menu)

			visibility = "hidden";

		if(ParentMenu!='') {

			CurMenu = ParentMenu;

			ParentMenu = '';

			tCmd = '';

		} else {

			cCmd = '';

			CurMenu = '';

		}

	}



	function DoClear() {

		//IE,NS,W3C

		//This function resets the variables use to know which menus are being displayed and 

    //also hides all the currently visible menus.

		//------------------------------

		//Version 1.0

		//

		tCmd = '';

		ParentMenu = '';

		HideAll();

	}



	function ShowMenu(menuId, x, y, isCascading) {

		//IE,NS

		//This is the main function to show the menus when a hotspot is triggered 

    //or a cascading command is activated.

		//------------------------------

		//menuId: Name of the <div> or <layer> to be shown.

		//x: Left position of the menu.

		//y: Top position of the menu.

		//isCascading: True if the menu has been triggered from a command, and not from a hotspot.

		//------------------------------

		//Version 12.7

		//

    if(IE) {

			cCmd = GetCurCmd();

			if(cCmd==tCmd)

				return;

		}

		if(as) {

			window.clearTimeout(as);

			as = 0;

		}

		if(isCascading) {

      if(ParentMenu!="") 

				Hide(CurMenu);

			ParentMenu = CurMenu;

			tCmd = cCmd;

		} else 

			DoClear();



		if(IE) {

			var Menu = document.all[menuId].style;

			if(isCascading)

				var pMenu = document.all[CurMenu].style;

			with(Menu) {

				if(isCascading) {

					left = parseInt(pMenu.left) + parseInt(pMenu.width) - 6;

					top =  y + parseInt(pMenu.top) - 5;

				} else {

					left = x;

					top =  y;

				}

				if(!IsMac)

					clip = "rect(0 0 0 0)";

			}

		} 

    else if(NS) {

			var Menu = document.layers[menuId];

			var pMenu = document.layers[CurMenu];

			with(Menu.clip) {

				NSLayerCW = width;

				NSLayerCH = height;

			}

			if(isCascading) {

				x = pMenu.left + pMenu.clip.width;

				y = pMenu.top + cCmd.top;

			} else {

				x = parseInt(x);

				y = parseInt(y);

			}

			Menu.moveToAbsolute(x,y);

		} 

    else if(W3C) {

			var Menu = document.getElementById(menuId).style;

      if(isCascading)

				var pMenu = document.getElementById(CurMenu).style;

			with(Menu) {

				if(isCascading) {

					left = parseInt(pMenu.left) + parseInt(pMenu.width) - 6;

					top =  y + parseInt(pMenu.top) - 5;

				} else {

					left = x;

					top =  y;

				}

			}

		}



		CurMenu = menuId;

		Menu.visibility = "visible";

    toggleImageOn(menuId);

		if(isCascading)

			Menu.zIndex = parseInt(pMenu.zIndex) + 1;

		if(IE && !IsMac)

			as = window.setTimeout("Animate('" + menuId + "')", 10);

		FormsTweak("hidden");

	}

  

	function Animate(menuId) {

		//IE,NS

		//This function is called by ShowMenu every time a new group must be displayed and produces the predefined unfolding effect.

		//Currently is disabled for Navigator, because of some weird bugs we found with the clip property of the layers.

		//------------------------------

		//menuId: Name of the <div> or <layer> to be animated.

		//------------------------------

		//Version 1.3

		//

		var r = '';

		var nw = nh = 0;

		switch(fx) {

			case 1:

				if(IE) r = "0 " + AnimStep + "% " + AnimStep + "% 0";

				if(NS) nw = AnimStep; nh = AnimStep;

				break;

			case 2:

				if(IE) r = "0 100% " + AnimStep + "% 0";

				if(NS) nw = 100; nh = AnimStep;

				break;

			case 3:

				if(IE) r = "0 " + AnimStep + "% 100% 0";

				if(NS) nw = AnimStep; nh = 100;

				break;

			case 0:

				if(IE) r = "0 100% 100% 0";

				if(NS) nw = 100; nh = 100;

				break;

		}

		if(IE)

			document.all[menuId].style.clip =  "rect(" + r + ")";

		if(NS)

			with(document.layers[menuId].clip) {

				width = NSLayerCW*(nw/100);

				height = NSLayerCH*(nh/100);

			}

		AnimStep += 50;

		if(AnimStep<=100)

			as = window.setTimeout("Animate('" + menuId + "')",50);

		else {

			window.clearTimeout(as);

			as = 0;

			AnimStep = 0;

		}

	}

	

	function InMenu(mX, mY, m) {

		//IE,NS

		//This function returns true if the mouse pointer is over a group.

		//------------------------------

		//mX: Current X position of the mouse pointer.

		//mY: Current Y position of the mouse pointer.

		//m: <div> or <layer> object to be tested.

		//------------------------------

		//Version 1.2

		//

    if(!m) return false;

    if (IE) {

      var l = parseInt(m.offsetLeft);

  		var r = l+parseInt(m.scrollWidth);

	  	var t = parseInt(m.offsetTop);

  		var b = t+parseInt(m.scrollHeight);

      if (IsMac) b += parseInt(document.body.topMargin)

    } else if (NS) {

      var l = parseInt(m.left);

  		var r = l+m.clip.width;

	  	var t = parseInt(m.top);

  		var b = t+m.clip.height;

    } else if (W3C) {

      var l = parseInt(m.offsetLeft);

  		var r = l+m.offsetWidth;

	  	var t = parseInt(m.offsetTop);

  		var b = t+m.offsetHeight;

    }

    return ((mX>=l && mX<=r) && (mY>=t && mY<=b));

	}



	function HideMenus(e) {

		//IE,NS

		//This function checks if the mouse pointer is on a valid position and if the current menu should be kept visible.

		//The function is called every time the mouse pointer is moved over the document area.

		//------------------------------

		//e: Only used under Navigator, corresponds to the Event object.

		//------------------------------

		//Version 23.9

		//

    var eSrc = "IMG";    

    if(IE) {

			if(event==null)

				var e = window.event;

			else

				var e = event;

      eSrc = e.srcElement.tagName;

			var mX = e.clientX + document.body.scrollLeft;

			var mY = e.clientY + document.body.scrollTop;

      if(CurMenu!="")

				var lm = document.all[CurMenu];

			if(ParentMenu!="")

				var pm = document.all[ParentMenu];

		}

		else if(NS) {

			var mX = e.pageX + window.pageXOffset;

			var mY = e.pageY + window.pageYOffset;

			var lm = document.layers[CurMenu];

			if(ParentMenu!="")

				var pm = document.layers[ParentMenu];

		}

    else if(W3C) {

			var mX = e.pageX + window.pageXOffset;

			var mY = e.pageY + window.pageYOffset;

      if(CurMenu!="")

				var lm = document.getElementById(CurMenu);

			if(ParentMenu!="")

				var pm = document.getElementById(ParentMenu);

    }



    if((CurMenu!='' && cCmd!='' && !as) ||

       (CurMenu!='' && eSrc != "IMG")) {

			if(ParentMenu=='') {

				if(!InMenu(mX, mY, lm))

					Hide(CurMenu);

			} else {

				if(!InMenu(mX, mY, lm) && (cCmd!=tCmd)) {

					Hide(CurMenu);

					return;

				} else {

					if(!InMenu(mX, mY, lm) && !InMenu(mX, mY, pm))

						HideAll();

				}

			} 

    }

	}

	

	function FormsTweak(str) {

		//IE

		//This is an undocumented function, which can be used to hide every form element on a page.

		//This can be useful if the menus will be displayed over an area where is a combo box, which is an element that cannot be placed behind the menus and it will always appear over the menus resulting in a very undesirable effect.

		//------------------------------

		//Version 1.0

		//

		if(DoFormsTweak)

			for(var i = 0; i <= (document.forms.length - 1); i++)

				document.forms[i].style.visibility = str;

	}



	function execURL(evt) {

    url = evt.currentNode.attributes.getNamedItem("hrefurl").nodeValue;

    tframe = document;

    execURL(url, tframe);

  }

  

  function execURL(url, tframe) {

		//IE,NS

		//This function is called every time a command is triggered to jump to 

    //another page or execute some javascript code.

		//------------------------------

		//url: Encrypted URL that must be opened or executed.

		//tframe: If the url is a document location, tframe is the target frame 

    //where this document will be opened.

		//------------------------------

		//Version 1.0

		//

		DoClear();

		window.setTimeout("execURL2('" + url + "', '" + tframe + "')", 100);

	}



	function execURL2(url, tframe) {

		//IE,NS

		//This function is called every time a command is triggered to jump to another page or execute some javascript code.

		//------------------------------

		//url: Encrypted URL that must be opened or executed.

		//tframe: If the url is a document location, tframe is the target frame where this document will be opened.

		//------------------------------

		//Version 1.0

		//

		tframe = rStr(tframe);

		var fObj = eval(tframe);

		url = rStr(url);

		if(url.indexOf("javascript")!=url.indexOf("vbscript"))

			eval(url);

		else

			fObj.location.href = url;

	}



	function rStr(s) {

		//IE,NS

		//This function is used to decrypt the URL parameter from the triggered command.

		//------------------------------

		//Version 1.1

		//

		s = xrep(s,"\x1E","'");

		s = xrep(s,"\x1D","\x22");

		s = xrep(s,"\x1C",",");

		return s;

	}



	function xrep(s, f, n) {

		//IE,NS

		//This function looks for any occurrence of the f string and replaces it with the n string.

		//------------------------------

		//Version 1.0

		//

		var tmp = s.split(f);

		return tmp.join(n);

	}



	function PrepareEvents() {

		//NS

		//This function is called right after the menus are rendered.

		//It changes the OnFocus event, set by DHTML Menu Builder, for the OnMouseUp event on every command.

		//------------------------------

		//Version 1.0

		//

		for(var l=0; l<document.layers.length; l++) {

			var lo = document.layers[l];

			for(var sl=0; sl<lo.layers.length; sl++) {

				var slo = document.layers[l].layers[sl];

				if((slo.name.indexOf("MC")==0) && (typeof(slo.onfocus)=="function")) {

					slo.captureEvents(Event.MOUSEUP);

					slo.onmouseup = slo.onfocus;

					slo.releaseEvents(Event.FOCUS);

				}

			}

		}

	}

  

  function showPopUpMenu(name) {
    // IE,NS,W3C
    // This function displays the menu to the right side of the hotspot that calls the function
    //
    fx = 1;
    if (IE) {
      obj = event.srcElement;
      x = obj.offsetWidth - 4;
      y = 0;
      while (obj.tagName != "BODY") {
        obj = obj.parentElement;
        if (obj.tagName == "TR" || obj.tagName == "TABLE") {
          x += obj.offsetLeft;
          y += (IsMac) ? obj.clientTop : obj.offsetTop;
        }
      }
	if (IsMac) {
        x += parseInt(document.body.leftMargin);
        if (x == 0) x = event.x;
        if (y == 0) y = event.y - 25;
      }
    } else if (NS) { 
      obj = eval("document.images."+name+"Image");
      x = obj.x + obj.width - 16;
      y = obj.y;
    } else if (W3C) {
      obj = document.getElementById(name+"Anchor");
      x = 155; //obj.offsetLeft + obj.width + document.body.offsetLeft;
      y = obj.offsetTop + document.body.offsetTop - 8;
	}
	//Old W3C module
	/*else if (W3C) {
      var obj = name.target; // the name is the W3C event object
      x = obj.offsetLeft + obj.width + document.body.offsetLeft;
      y = obj.offsetTop + document.body.offsetTop;
      name = obj.name.replace("Image","");
    }*/
    toggleImageOn(name);
    ShowMenu(name, x, y, false);
  }

  

  function showDropDownMenu(name) {
    // IE,NS,W3C
    // This function displays the menu to the under and left aligned the hotspot that calls the function
    //
    fx = 2;
    if (IE) {
      obj = event.srcElement;
      x = 0;//obj.offsetLeft;
      y = obj.height;
      while (obj.offsetParent != null) {
        obj = obj.offsetParent;
        x += obj.offsetLeft;
        y += obj.offsetTop;
      }
      x += parseInt(document.body.leftMargin);
      y += parseInt(document.body.topMargin);
    } else if (NS) {
      obj = eval("document.images."+name+"Image");
      x = obj.x;
      y = obj.y + obj.height;
    } else if (W3C) {
      obj = document.getElementById(name+"Anchor");
      x = obj.offsetLeft + document.body.offsetLeft;
      y = obj.offsetTop + obj.offsetHeight + document.body.offsetTop;
    }
    ShowMenu(name, x, y, false);
  }

  

  function toggleImageOn(name, noMenu) {

    // IE,NS,W3C

    // This function changes the rollover image of the navigation item displaying the menu

    //

    if (noMenu) {

    	if(as) {

			  window.clearTimeout(as);

			  as = 0;

		  }

      DoClear();

    }

    img = document.images[name+"Image"];

    imgSrc = img.src;

    if (imgSrc.indexOf("off.gif") != -1) {

      imgName = imgSrc.substring(0,imgSrc.indexOf("off.gif"));

      img.src = imgName + "on.gif";

    }

  }



  function toggleImageOff(name) {

    // IE,NS,W3C

    // This function changes the rollover image of the navigation item displaying the menu

    //

    img = document.images[name+"Image"];

    imgSrc = img.src;

    if (imgSrc.indexOf("on.gif") != -1) {

      imgName = imgSrc.substring(0,imgSrc.indexOf("on.gif"));

      img.src = imgName + "off.gif";

    }

  }



  function hoverImage(evt) {

    // W3C

    // This function changes the rollover image of the navigation item displaying

    // the menu for menu items that do not display a popup menu only

    //

  	if(as) {

	  window.clearTimeout(as);

	  as = 0;

    }

    DoClear();

    img = evt.target;

    imgSrc = img.src;

    if (imgSrc.indexOf("off.gif") != -1) {

      imgName = imgSrc.substring(0,imgSrc.indexOf("off.gif"));

      img.src = imgName + "on.gif";

    }

  }



  function restoreImage(evt) {

    // W3C

    // This function changes the rollover image of the navigation item displaying

    // the menu for menu items that do not display a popup menu only

    //

    img = evt.target;

    imgSrc = img.src;

    if (imgSrc.indexOf("on.gif") != -1) {

      imgName = imgSrc.substring(0,imgSrc.indexOf("on.gif"));

      img.src = imgName + "off.gif";

    }

  }


//Variable Declaration
var img_list = new Array();			//  navigation images array
var pu_ids = new Array();			// id array of menu items with popup menu
var pu = 0;
var mi_index = 0;					// id array of menu items without popup menu

/**
 *  initLnavMenu() returns a string of the the left hand navigation  
 *  table to the html page from the menus defined
 */
function checkRoll() {
	var htmlStr = "";
	htmlStr += '<table width="145" border="0" cellpadding="0" cellspacing="0">';
    for (i=0; i<Menus.length; i++) {
      menu = Menus[i];
      menu_name = menu.getName();
	  img_name = menu.getImageName();		//img_name = menu.getImageName().replace("off","on");
      htmlStr += '<tr>';
      htmlStr += '<td><a href="'+menu.getHREF()+'" id="'+menu_name+'Anchor"';
      if (Menus[i].getMenuItems() != null) {
        htmlStr += ' onmouseover="showPopUpMenu(\''+menu_name+'\')">';
      } else {
        htmlStr += ' onmouseover="toggleImageOn(\''+menu_name+'\',true)"';
        htmlStr += ' onmouseout="toggleImageOff(\''+menu_name+'\')">';
      }
      htmlStr += '<img name="'+menu_name+'Image" src="'+img_name+'" border=0>';
      htmlStr += '</a></td></tr>';
      img_list[i] = img_name.replace("off","on");
    }
    htmlStr += '</table>';
    return htmlStr;
}

/**
 *  IE,NS
 *  createHNavTable() returns a string of the the left hand navigation  
 *  table to the html page from the menus defined
 */
function initDropDownMenu() {
    var htmlStr = "";
    htmlStr += '<table border="0" cellpadding="0" cellspacing="0">';
    htmlStr += '<tr>';
    for (i=0; i<Menus.length; i++) {
      menu = Menus[i];
      menu_name = menu.getName();
      img_name = menu.getImageName();
      htmlStr += '<td><a href="'+menu.getHREF()+'" id="'+menu_name+'Anchor"';
      if (Menus[i].getMenuItems() != null) {
        htmlStr += ' onmouseover="showDropDownMenu(\''+menu_name+'\')">';
      //} else if (urlStr.indexOf(menu.getHREF()) != -1) {
        //img_name = img_name.replace("off","on");
        //htmlStr += '>';
      } else {
        htmlStr += ' onmouseover="toggleImageOn(\''+menu_name+'\',true)"';
        htmlStr += ' onmouseout="toggleImageOff(\''+menu_name+'\')">';
      }
      htmlStr += '<img name="'+menu_name+'Image" src="'+img_name+'" border=0>';
      htmlStr += '</a></td>';
      img_list[i] = img_name.replace("off","on");
    }
    htmlStr += '</tr>';
    htmlStr += '</table>';
    return htmlStr;
}

/**
 *  writeMenus() writes the pop up menus to the html page for W3C 
 */
function writeMenus() {
  for (i=0; i < Menus.length; i++) {
    with (document) {
      var menu = Menus[i];
      menu_name = menu.getName();
      menu_items = menu.getMenuItems();
      if (menu_items == null) continue;
      
      write("<div id=\""+menu_name+"\" class=\"ieMenu\">");
      write("<table id=\"dmbMenu\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"ieMenuTable\">");

      for (j=0; j < menu_items.length; j++) {
        menuItem = menu_items[j];
        item_name = menuItem.getName();
        write("<tr>");
        write("<td nowrap align=\"left\" id=\"mi_"+(mi_index)+"\" class=\"menuItem\" ");
        write("OnClick=\"execURL(\'"+menuItem.getHREF()+"\', \'this\');;\" ");
        write("OnMouseOver=\"HoverSel('mi_"+mi_index+"',0)\" ");
        write("OnMouseOut=\"HoverSel('mi_"+mi_index+"',1)\">");
        write(item_name);
        write("</td></tr>");
        mi_index++;
      }
      //write("<tr><td><img src=\""+filePath+"/images/header/bottom.gif\"></td></tr>");
      write("</table></div>");
    }
  }
}

/**
 *  writeIEMenus() writes the pop up menus to the html page for IE 
 */
function writeIEMenus() {
  index=0;
  for (i=0; i < Menus.length; i++) {
    with (document) {
      var menu = Menus[i];
      menu_name = menu.getName();
      menu_items = menu.getMenuItems();
      if (menu_items == null) continue;
      
      write("<div id=\""+menu_name+"\" class=\"ieMenu\">");
      write("<table id=\"dmbMenu\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"ieMenuTable\">");

      for (j=0; j < menu_items.length; j++) {
        menuItem = menu_items[j];
        item_name = menuItem.getName();
        write("<tr>");
        write("<td nowrap align=\"left\" id=\""+(index++)+"\" class=\"ieMenuItem\" ");
        write("OnClick=\"execURL(\'"+menuItem.getHREF()+"\', \'this\');;\" ");
        write("OnMouseOver=\"IEHoverSel(0,\'\')\" ");
        write("OnMouseOut=\"IEHoverSel(1,\'\')\">");
        write(item_name);
        write("</td></tr>");
      }
      //write("<tr><td><img src=\""+filePath+"/images/header/bottom.gif\"></td></tr>");
      write("</table></div>");
    }
  }
}

/**
 *  writeNSMenus() writes the pop up menus to the html page for Netscape
 */
function writeNSMenus() {
  index=1;
  line_width = 175;
  
  for (i=0; i < Menus.length; i++) {
    var menu = Menus[i];
    menu_name = menu.getName();
    menu_items = menu.getMenuItems();
    if (menu_items == null) continue;
    
    l_top = 0;
    with (document) {
      write("<layer name=\""+menu_name+"\" width="+line_width+" z-index=100  visibility=\"hidden\">");
      //write("<layer top=0 z-index=100><img src=\""+filePath+"images/top.gif\" border=\"0\"></layer>");

      for (j=0; j < menu_items.length; j++) {
        menuItem = menu_items[j];
        item_name = menuItem.getName();

        line_height = 18;
        x = 0;
        while (item_name.indexOf("<br>",x) != -1) {
          line_height += 14;
          x = item_name.indexOf("<br>",x) + 4;
        }

        write("<layer name=MC0"+index+"EH top="+l_top+" width="+line_width+" height="+line_height+" z-index=101 ");
        write("OnMouseOut=\"NSHoverSel('"+menu_name+"','"+item_name+"','"+index+"',1,"+line_width+","+line_height+");\" ");
        write("OnMouseOver=\"NSHoverSel('"+menu_name+"','"+item_name+"','"+index+"',0,"+line_width+","+line_height+");\" ");
        write("OnFocus=\"execURL(\'"+menuItem.getHREF()+"\', \'this\');\"></layer>");
        write("<layer name=MC0"+index+" top="+l_top+" width="+line_width+" height="+line_height+" z-index=100>");
        write("<body class=\"nsMenuItem\">");
        write(item_name);
        write("</font></layer>");
        l_top += line_height;
        index++;
      }
      //write("<layer top="+l_top+" width="+line_width+" height=9 z-index=100><img src=\""+filePath+"/images/header/bottom.gif\" border=\"0\"></layer>");
      write("</layer>");
    }
  }
}


/** 
 *  preloads the rollover images for the navigation table
 */
function preload() {
  if(IsMac) document.body.leftMargin=0;
  if (W3C) addListeners();
  var d = document; 
  if(d.images) { 
  	if(!d.over_imgs) 
  	  d.over_imgs = new Array();
    var i, j=d.over_imgs.length; 
  	for(i=0; i<img_list.length; i++) {
		  d.over_imgs[j] = new Image; 
 		  d.over_imgs[j++].src = img_list[i];
    }
  }
}

/** 
 *  writes the menus to the html document
 */
	if(IE)
		with(document) {
			open();
			writeIEMenus();
      		close();
		}
	else if(NS)
		with(document) {
			open();
			writeNSMenus();
			close();
		}
	else if (W3C)
    	with(document) {
      		open();
      		writeMenus();
      		close();
    	}

  if(NS) {
		mFrame.captureEvents(Event.MOUSEMOVE);
		mFrame.onmousemove = HideMenus;
		PrepareEvents();
	}

  document.onmousemove = HideMenus;

  function addListeners() {
    for(i=0;i<pu_ids.length;i++) {
      document.getElementById(pu_ids[i]).addEventListener("mouseover",showPopUpMenu,true);
    }
  }
