var ns = (document.layers)? true:false;
var visibleVar='null';
var layersList = new Array(3);
var i
layersList[0] = 'menu1';
layersList[1] = 'menu2';
layersList[2] = 'empty';




if (navigator.appName == 'Netscape') {
	layerStyleRef='layer.';
	layerRef='document.layers';
	styleSwitch='';
	visibleVar='show';
} else{
	layerStyleRef='layer.style.';
	layerRef='document.all';
	styleSwitch='.style';
	visibleVar='visible';
}

function menuSwitch(layerName,hideifshowed){
	if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility == visibleVar')) {
		if (hideifshowed) hideLayer(layerName);
	} else {
		showLayer(layerName);
		for (i=0; i<3; i++) {
			if (layerName.lastIndexOf(layersList[i])==-1) {
				hideLayer(layersList[i]);
			}
		}
	}
}

function showLayer(layerName){
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
}

function hideLayer(layerName){
	eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
}

function hideAll(){
	for (i=0; i<3; i++) {
			hideLayer(layersList[i]);
	}
}

function submenuSwitch(layerName,hideifshowed){
	if (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility == visibleVar')) {
		if (hideifshowed) hideLayer(layerName);
	} else {
		showLayer(layerName);
		for (i=0; i<3; i++) {
			if (layerName.lastIndexOf(layersList[i])==-1) {
				hideLayer(layersList[i]);
			}
		}
	}
}

if(ns) document.captureEvents(Event.MOUSEDOWN)
if(ns) document.onmousedown = hideAll
else document.onclick = hideAll
function winStat(bla){
	window.status = bla;
}
