var currentSubMenu = "";

function showSubMenu( menuid, position ){
	hideSubMenu(currentSubMenu);
	var menuname;
	menuname = "sub" + menuid;
	var elem, vis;
	if( document.getElementById ) // this is the way the standards work    
		elem = document.getElementById( menuname );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[menuname];  
	else if( document.layers ) // this is the way nn4 works    
		elem = document.layers[menuname];  
	
	if (elem) {
		currentSubMenu = menuid;
		vis = elem.style;   
		vis.display = 'block';
		position = (position * 75) + 	50; //pixels
		vis.left = position;
	}
}
	
function hideSubMenu( menuid ) {
	
	var menuname;	
	menuname = "sub" + menuid;
	if( document.getElementById ) // this is the way the standards work    
		elem = document.getElementById( menuname );
	else if( document.all ) // this is the way old msie versions work
		elem = document.all[menuname];  
	else if( document.layers ) // this is the way nn4 works    
		elem = document.layers[menuname];
		
	if (elem) {
		vis = elem.style;   
		vis.display = 'none';
	}
}

function isMouseLeaveOrEnter(e, handler)
{		
	if (e.type != 'mouseout' && e.type != 'mouseover') return false;
	var reltg = e.relatedTarget ? e.relatedTarget :
	e.type == 'mouseout' ? e.toElement : e.fromElement;
	while (reltg && reltg != handler) reltg = reltg.parentNode;
	return (reltg != handler);
}

