function menuItem(text, link, target){
	this.text = text;
	this.link = link;
	this.target = target;
}
function menuTrigger(name, text, link){
	this.name = name;
	this.text = text;
	this.link = link;
}
function menu(){
	var itemArray = new Array();
	var args = menu.arguments;
	this.name = args[0];
	this.tblcolor = args[1];
	this.highlight = args[2];
	this.trigger = args[3];
	for(i=4; i<args.length; i++){
		itemArray[i-4] = args[i];				
	}
	
	this.menuItems = itemArray;
	if( this.menuItems.name != null){
		document.getElementById(this.menuItems.name).style.visibility = 'hidden';				
		}
		
	this.write = writeMenu;
	this.position = positionMenu;
}
function writeMenu(){	
	var menuText = '<div id="';
	menuText += this.trigger.name;
	menuText += '" class="trigger" style="top: ';
	menuText += this.top;
	menuText += '; left: ';
	menuText += this.left;
	menuText += ';"';
	menuText += 'onMouseOver="showMenu(\'';
	menuText += this.name;
	menuText += '\')" onMouseOut="hideMenu(mnuSelected)">';
	menuText += '<table border="0" cellspacing="0" cellpadding="0" width="158">';
	menuText += '<tr onMouseOver="this.style.backgroundColor = \''+ this.highlight +'\'" onMouseOut="this.style.backgroundColor = \'\'">';
	menuText += '<td width="5">&nbsp;</td><td valign="middle" height="16" width="141"><a href="'+ this.trigger.link +'">' + this.trigger.text + '</a></td><td valign="bottom" width="14"><img src="images/sidenavarrow.gif" width="14" height="8"></td></tr>';
	menuText += '<tr bgcolor="#000000"><td valign="top" colspan="3"><img src="images/blank.gif" width="5" height="1"></td></tr>';
	menuText += '</table></div>';
	menuText += '<div style="visiblity:hidden" id="';	
	menuText += this.name;
	menuText += '" class="menu" style="top: ';
	menuText += (this.top);
	menuText += ';left: 156';
	menuText += ';" '
	menuText += 'onMouseOver="showMenu(mnuSelected)" ';
	menuText += 'onMouseOut="hideMenu(mnuSelected)">';
	
	menuText += '<table border="0" style="border: 1px #000000 solid;" cellpadding="0" cellspacing="0" bgcolor="'+ this.tblcolor +'" width="158">';
	for(i=0; i<this.menuItems.length; i++){
		menuText += '<tr onMouseOver="this.style.backgroundColor = \''+ this.highlight +'\'" onMouseOut="this.style.backgroundColor = \'\'">';
		menuText += '<td width="5">&nbsp;</td><td valign="middle" height="16" width="141">';
		menuText += '<a href="' + this.menuItems[i].link + '"';		
		if( this.menuItems[i].target != "") menuText += ' target="'+ this.menuItems[i].target +'"' ;	
		menuText += '>';
		menuText += this.menuItems[i].text + '</a></td><td valign="bottom" width="14"><img src="images/sidenavarrow.gif" width="14" height="8"></td>';
		menuText += '</tr>';
		if(i!=this.menuItems.length-1){
			menuText += '<tr bgcolor="#000000"><td valign="top" colspan="3"><img src="images/blank.gif" width="5" height="1"></td></tr>';
		}
	}
	menuText += '</table></div>';
	document.write(menuText);
	document.close();
}
function positionMenu(top,left,width){	
	this.top = top;
	this.left = left;
	this.width = width;
}
var mnuSelected = '';
function showMenu(menu){	
	hideMenu(mnuSelected);
	document.getElementById(menu).style.visibility = 'visible';
	mnuSelected = menu;
}
function hideMenu(menu){
	if(mnuSelected!='')
		document.getElementById(menu).style.visibility = 'hidden';
}