
function enableMenu()
{
	uls = document.getElementsByTagName('UL');

	for(i = 0; i < uls.length; i++){
		if (uls[i].className == 'dropdown'){
			var lis = uls[i].getElementsByTagName('li');

			for (j = 0; j < lis.length; j++){
				if (lis[j].firstChild.nodeName.toLowerCase() == '#text') lis[j].removeChild(lis[j].firstChild);
				if (lis[j].firstChild.className != 'disabled' && lis[j].firstChild.className != 'system'){
					if (document.all){
						if (lis[j].lastChild.tagName == 'UL'){
							lis[j].onmouseover = function() { this.lastChild.style.display = 'block'; }
							lis[j].onmouseout = function() { this.lastChild.style.display = 'none'; }
							lis[j].onmouseover = function() { if (this.firstChild.className != 'currentTop') this.firstChild.className = 'selectedTop'; }
							lis[j].onmouseout = function() { if (this.firstChild.className != 'currentTop') this.firstChild.className = ''; }
						}else if (lis[j].lastChild.previousSibling && lis[j].lastChild.previousSibling.tagName == 'UL'){
							lis[j].onmouseover = function() { if (this.firstChild.nextSibling.className != 'currentTop') this.firstChild.nextSibling.className = 'selectedTop'; }
							lis[j].onmouseout = function() { if (this.firstChild.nextSibling.className != 'currentTop') this.firstChild.nextSibling.className = ''; }
						}
					}else{
						if (lis[j].lastChild.previousSibling && lis[j].lastChild.previousSibling.tagName == 'UL'){
							lis[j].onmouseover = function() { if (this.firstChild.nextSibling.className != 'currentTop') this.firstChild.nextSibling.className = 'selectedTop'; }
							lis[j].onmouseout = function() { if (this.firstChild.nextSibling.className != 'currentTop') this.firstChild.nextSibling.className = ''; }
						}
					}
				}else if (lis[j].firstChild.className == 'disabled'){
					if (lis[j].firstChild.href){
						lis[j].firstChild.href = 'javascript: void(0);';
						//lis[j].firstChild.removeAttribute('href');
						//lis[j].onmouseover = null;
						//lis[j].onmouseout = null;
						var objs = lis[j].childNodes;
						for (var k = 0; k < objs.length; k++){
							if (objs[k].nodeName.toLowerCase() == 'ul'){
								lis[j].removeChild(objs[k]);
								break;
							}
						}
					}
				}
			}
		}
	}
}

function selectCurrent(menuId, currentItem, selectFirstIfNone){
	if (selectFirstIfNone == undefined){
		selectFirstIfNone = true;
	}
	var foundSelected = false;
	if (currentItem != undefined){
		var links = document.getElementById(menuId).getElementsByTagName('a');
		for (var i = 0; i < links.length; i ++){
			var action = '';
			if (links[i].href){
				var temp = links[i].href.split('/');
				temp = temp.reverse();
				if (temp[0] != ''){
					temp = temp[0].split('.');
				}else{
					temp = temp[1].split('.');
				}
				action = temp[0];
			}
			if (action == currentItem){
				foundSelected = true;
				links[i].className = 'currentTop';
				var parentLink = links[i].parentNode;
				while (parentLink){
					if (parentLink.nodeName.toLowerCase() == 'ul'){
						if (parentLink.previousSibling){
							if (parentLink.previousSibling.previousSibling){
								if (parentLink.previousSibling.previousSibling.nodeName){
									if (parentLink.previousSibling.previousSibling.nodeName.toLowerCase() == 'a'){
										parentLink.previousSibling.previousSibling.className = 'currentTop';
									}
								}
							}
						}
					}
					parentLink = parentLink.parentNode;
				}
				break;
			}
		}
		if (!foundSelected && selectFirstIfNone){
			links[0].className = 'currentTop';
		}
	}
}
