// Detect DOM Type
// Initalize variables 
var isLayers = 0;
var isAll = 0;
var isID = 0;
var isDHTML = 0;

// Feature Sensing to detect DOM Type

if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.layers) {isLayers = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { 
			return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}
// Declare variables
var domSMenuA = null;
var domSMenuB = null;
var oldDomSMenuA = null; 
var oldDomSMenuB = null; 
var oldDomHMenu = null;

function popMenu(menuNum){

	if (isDHTML) {
	
//    Define the DOM for each menu
		
		var idSMenuA = 'menu' + menuNum + 'a';
		domSMenuA = findDOM(idSMenuA,1);
		
		var idSMenuB = 'menu' + menuNum + 'b';
		domSMenuB = findDOM(idSMenuB,1);
		
		var idHMenu = 'menuhead' + menuNum;
		domHMenu = findDOM(idHMenu,1);
	
//    Changes the state of the menus
		if (oldDomSMenuA != domSMenuA) {	
		
//    Hide old menu
			if (oldDomSMenuA) {
			oldDomSMenuA.visibility = 'hidden';
			oldDomSMenuB.visibility = 'hidden';
			oldDomHMenu.visibility = 'visible';
			}
//    Show selected menu					
			domSMenuA.visibility = 'visible';
			domSMenuB.visibility = 'visible';
			domHMenu.visibility = 'hidden';
			oldDomSMenuA = domSMenuA;
			oldDomSMenuB = domSMenuB;
			oldDomHMenu = domHMenu;
			
		}

//    Resets oldDom if it is the same as the current DOM
		else {oldDomSMenu = null; }
	}

//    Returns a 'null' value for non-DHTML Browsers 
	else { return null; }
}
