var menuLabelsLength=0;
var menuHeadings=0;
var menuIsOpen=false;
var openMenuID='';
function trace(txt) {
	var obj = document.getElementById('content01');
	if (obj != null) {
		var str = txt + '<br />' + obj.innerHTML;
		obj.innerHTML = str;
	}
}
function openMenu(id,com) {
	openMenuID = id;
	menuIsOpen = true;
	showMenu(id);
	/* and process the supplied command */
	if (com) {
	document.location=com;
	}
}
function showMenu(id) {
	if (!menuIsOpen) return;
	var obj = null;
	var obj1 = null;
	openMenuID = '';
	window.clearTimeout(menuTimeout);
	for (var i=0; i<menuLabelsLength; i++) {
		obj1 = document.getElementById('menuContent'+i);
		if (obj1 != null && id != 'menuContent'+i) {
			obj1.style.height='0px';
			obj1.style.paddingBottom="0px";
			obj1.style.paddingTop="0px";
		} else {
			//trace('menuContent'+i);
		}
	}
	if (id != null) {
		obj = document.getElementById(id);
		if (obj !=null) {
			openMenuID = id;
			if (obj.style != null) {
				obj.style.height = 'auto';
				obj.style.paddingBottom="10px";
				obj.style.paddingTop="10px";
			} 
		}
	}
}
function colorMenuHead(id) {
	if (id != null) {
		obj = document.getElementById('menuHead'+id);
		if (obj !=null) {
			obj.style.backgroundColor="#666666";
		}
	}
	for (var i=0; i<menuHeadings+1; i++) {
		obj = document.getElementById('menuHead'+i);
		if (obj!=null && obj.style !=null && i!=id) {
			obj.style.backgroundColor="transparent";
		}
	}
}
function closeMenu() {
	menuIsOpen=false;
	var obj1 = null;
	var obj2 = null;
	openMenuID = '';
	for (var i=0; i<menuLabelsLength+1; i++) {
		obj1 = document.getElementById('menuContent'+i);
		if (obj1 != null) {
			obj1.style.height='0px';
			obj1.style.paddingBottom="0px";
			obj1.style.paddingTop="0px";
		}
	}
	for (var i=0; i<menuHeadings+1; i++) {
		obj2 = document.getElementById('menuHead'+i);
		if (obj2 != null) {
			obj2.style.backgroundColor="transparent";
		}
	}
	
	window.clearTimeout(menuTimeout);
}
var menuTimeout=0;
function closeMenus() {
	if (openMenuID) {
		menuTimeout=window.setTimeout("closeMenu()",4000);
	}
}
