var menuSelected = '';
function show(o)
{
	if(menuSelected!='')
		hide(menuSelected);

	var m = document.getElementById(o+'items');
	m.style.display = '';
	menuSelected = o;
}
function hide(o)
{
	var m = document.getElementById(o+'items');
	m.style.display = 'none';
	menuSelected = '';
}

function MenuBar()
{
	var _menus = new Array();
	var _width = 500;
	
	this.getMenus = function(){return _menus;}
	this.getWidth = function(){return _width;}
	this.setWidth = function(newWidth){_width = newWidth;}
	this.AddMenu = function(menu)
	{

		//_menus[_menus.length] = menu;
		_menus.push(menu);
	}
	this.Show = function()
	{
	
		document.write('<div class=dl_menubar>');
		document.write('<table class=dl_menubar border=0><tr>');
		for(i = 0; i < _menus.length; i++){	
			_menus[i].Show();
		}
		document.write('</tr></table>');
		document.write('</div>');
	}
}

function Menu(name,url)
{
	var _name = name;
	var _url = url;
	var _menuitems = new Array();
	
	this.AddMenuItem = function(menuItem)
	{
		_menuitems[_menuitems.length] = menuItem;
	}
	this.getName = function(){return _name;}
	this.getUrl = function(){return _url;}
	this.getMenuItems = function(){return _menuitems;}
	
	this.Show = function()
	{
		var top = '30px'; //top = '33px';
		if(navigator.appName=='Netscape')
		{
			//top = '26px';
			top = '30px';			
		}

		document.write('<td nowrap>');
		document.write('<div id="'+_name+'" onmouseover="show(\''+_name+'\')" onmouseout="hide(\''+_name+'\')">');
		document.write('<a href="'+_url+'" class=dl_menubar style="width=100%;text-decoration:none;">'+_name+'</a><br>');
		document.write('<div id="'+_name+'items" style="position:absolute;top:'+top+';display:none;background:#333;">');
		document.write('<div class=dl_menu style="position:relative;top:-3px;left:-3px;">');
		//document.write('<table width=100% cellpadding=0 cellspacing=0 border=0>');
		for(i2 = 0; i2 < _menuitems.length;i2++){
			_menuitems[i2].Show();
		}
		//document.write('</table>');
		document.write('</div>');
		document.write('</div>');				
		document.write('</div>');
		document.write('</td>');
	}
}

function MenuItem(name,url)
{
	var _name = name;
	var _url = url;
	
	this.getName = function(){return _name;}
	this.getUrl = function(){return _url;}
	
	this.Show = function()
	{
		//document.write('<tr><td>');
		document.write('<a href="'+_url+'" class=dl_menuitem style="padding: 4px 4px;">'+_name+'</a>');
		//document.write('</td></tr>');
	}
}