
var activeSub = null;
var menuTimeout = null;

function initMenuSub() {
	if (document.getElementById && document.getElementById("menu-sub")) {
		var navRoot = document.getElementById("menu-sub");
		for (var i=0; i<navRoot.childNodes.length; i++) {
			var node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				if(node.className == "active") node.id = "default";
				node.onmouseover = function() {
					activeSub = this;
					if(menuTimeout) window.clearTimeout(menuTimeout);
					menuTimeout = window.setTimeout("setActiveSub()", 300);
  				}
   		}
  		}
		navRoot.onmouseout = function() {
			if(menuTimeout) window.clearTimeout(menuTimeout);
			menuTimeout = window.setTimeout("setDefaultSub()", 300);
		}
 	}
}

function setActiveSub() {
	resetMenuSub();
	activeSub.className = "active";
}

function resetMenu(id) {
	
	var navRoot = document.getElementById("div0");
	for (i=0; i<navRoot.childNodes.length; i++) {
		var node = navRoot.childNodes[i];
		if (node.nodeName == "DIV") {
			if (node.id!= "div"+id) { node.style.display = "none";}
			
  		}
 	}
	
	
	var navRoot2 = document.getElementById("menu_main");
	for (i=0; i<navRoot2.childNodes.length; i++) {
		var node = navRoot2.childNodes[i];
		if (node.nodeName == "A") {
			if (node.id != id ) { node.className = "link00";}
			
  		}
 	}
	
}


function externalLinks() { 
 if (!document.getElementsByTagName) return; 
 var anchors = document.getElementsByTagName("a"); 
 for (var i=0; i<anchors.length; i++) { 
   var anchor = anchors[i]; 
   if (anchor.getAttribute("href") && 
       anchor.getAttribute("rel") == "external") 
     anchor.target = "_blank"; 
 } 
}

var hideTimeout;

function initMenu() {
	if(document.getElementById && document.getElementById("menu_main")) {
		var menu = document.getElementById("menu_main");
		for (i=0; i<menu.childNodes.length; i++) {
			node = menu.childNodes[i];
			if (node.nodeName == "A") {
				node.onmouseover = function() {
								
window.setTimeout("showMenu('" + this.id + "')", 300);
  				}
   		}
  		}
 	}
}

function showMenu(id) {
	//alert (id);
	resetMenu(id);
	if(document.getElementById && document.getElementById("div_"+id)) {
	var boxas = document.getElementById("div_"+id);
	boxas.style.display = "block";
	}
	var menbox = document.getElementById("menbox");
	menbox.className = "td_"+id;
	
	var linkas = document.getElementById(id);
	linkas.className = id;

	
}




window.onload = function() {
	//externalLinks();
	initMenu();
	//initMenuSub();
	//preloadImages();
}