
function initNavi() {
	
	
	var navi = document.getElementById('navi-list');

	var showNavi = function() {
		this.className = this.className + ' showChilds';
	}

	var hideNavi = function() {
		this.className = this.className.replace(/showChilds/g, "");
	}

	for(var i in navi.childNodes) {
		if(typeof navi.childNodes[i].nodeName == 'string' && navi.childNodes[i].nodeName.toLowerCase() == 'li') {
			navi.childNodes[i].onmouseover = showNavi;
			navi.childNodes[i].onmouseout = hideNavi;

			var childs = navi.childNodes[i].getElementsByTagName('li');

			var ulChild = navi.childNodes[i].getElementsByTagName('ul');

			for(var j in childs) {
				childs[j].onmouseover = function() { 
					//var parent = navi.childNodes[i];
					this.className = this.className + ' hoverChild';
					this.parentNode.parentNode.className += ' hover';
				}
				childs[j].onmouseout = function() { 
					this.className = this.className.replace(/hoverChild/g, ""); 
					this.parentNode.parentNode.className = this.parentNode.parentNode.className.replace(/hover/g, ""); 
				}

				if(typeof childs[j].nodeName == 'string' && childs[j].nodeName.toLowerCase() == 'li') {
					childs[j].style.width = ulChild[0].clientWidth + 'px';

					var aChild = childs[j].getElementsByTagName('a')[0];

					//alert(ulChild[0].clientWidth +':'+ulChild[0].offsetWidth);
					//if(aChild.clientWidth > ulChild[0].clientWidth)
						aChild.style.width = ulChild[0].clientWidth + 'px';
				}
			}
		}
	}
}
window.onload = initNavi;