
var aitem, atimer;

function menuItemShow(){
	if (atimer) clearTimeout(atimer);
	this.className = "sel";
	
	if ((this.parentNode.className == 'menu')&&(!this.sizeUpdated)&&(this.childNodes[2])) {
		var ul = this.childNodes[2];
		this.sizeUpdated = 1;
		var ulSize = ul.offsetWidth;
		for(var i=0;i<ul.childNodes.length;i++){
			it = ul.childNodes[i];
			if (it.tagName == 'LI')
            {
			    it.style.width = ulSize;
 		    } 

		}
	}
}

function menuItemHide(){
	this.className = "";
}

function menuItemOut(ev){
	atimer = setTimeout("window.aitem.hide();", 10);
}

function menuItemOver(ev){
	if(aitem) if(aitem!=this) aitem.hide();
	this.show();
	aitem = this;
}

function xinit(menu_id) {
	var menu = document.getElementById(menu_id);

	for(var i=0;i<menu.childNodes.length;i++){
		it=menu.childNodes[i];
		it.show = menuItemShow;
		it.hide = menuItemHide;
		it.onmouseover = menuItemOver;
		it.onmouseout = menuItemOut;
	}
}

function xmenu_init() {
	if (getE('xmenu1')) xinit('xmenu1');
	if (getE('xmenu2')) xinit('xmenu2');
}

