var lPrev='';
var lParent='';
var lTimeout=false;

function menuOver(pEv) {
	if(pEv.srcElement) lEl=pEv.srcElement;
	else lEl=pEv.target;
	chstyle(lEl);
	if(lTimeout) window.clearTimeout(lTimeout);
	lTimeout=setTimeout("menu(lEl)", 200);
}

function menu(pEl) {
	if(lEl=getEl(pEl, "menu_")) {
		var lBr=new Array();
		var lIndex=lEl.id.substr(5);

		if (lIndex.indexOf('_')==-1)
			lParent=document.getElementById('submenu_');
		else {
			lParent=document.getElementById('submenu_'+lIndex.substr(0, lIndex.lastIndexOf('_'))).rows[0].cells[0];
			if(lParent.childNodes[0].tagName=='TABLE')
				lParent=lParent.childNodes[0];
			else lParent=lParent.childNodes[1];
		}

		if (document.getElementById('submenu_'+lIndex) && document.getElementById('submenu_'+lIndex).style.display=='block')
			closeNode(lIndex, -1);
		openParentNode('_'+lIndex);

		if(lIndex.length==1 && lIndex!=lPrev && document.getElementById('submenu_'+lIndex))
			lPrev=lIndex;

		lCh=lParent.rows;
		for (var i=0;i<lCh.length;i++) {
			lC=lCh[i].cells;
			for (var j=0;j<lC.length;j++)
				if (lC[j].id.substr(0, 5)=='menu_' && lC[j].id!=lEl.id)
					lBr[lBr.length]=lC[j].id.substr(5);
		}
		for(var z=0;z<lBr.length;z++)
			if(document.getElementById('submenu_'+lBr[z]) && document.getElementById('submenu_'+lBr[z]).style.display=='block')
				closeNode(lBr[z], 1);
	}
	else if (lPrev!='') {
		closeNode(lPrev, 1);
		lPrev='';
	}
}

function closeNode(pIndex, pF) {
	if (pF==1) {
		document.getElementById('submenu_'+pIndex).style.display='none';
		document.getElementById('submenu_'+pIndex).style.visibility='hidden';
	}
	for (var i=1; document.getElementById('menu_'+pIndex+'_'+i);i++)
		if(document.getElementById('submenu_'+pIndex+'_'+i) && document.getElementById('submenu_'+pIndex+'_'+i).style.display=='block')
			closeNode(pIndex+'_'+i, 1);
}

function openParentNode(pIndex){
	while(pIndex.indexOf('_')!=-1){
		if(e=document.getElementById('submenu'+pIndex)) {
			e.style.display='block';
			e.style.visibility='visible';
		}
		pIndex=pIndex.substr(0, pIndex.lastIndexOf('_'));
	}
}

function getEl(el, pId) {
	if(el && el.tagName) {
		while (el.tagName.toLowerCase() != "body") {
			if (el.id.substr(0, pId.length) == pId)	return el;
			if (el.id.substr(0, 8) == "submenu_" && el.id.length>8)
				el=document.getElementById(pId+el.id.substr(8));
			else	el = el.parentNode;
		}
	} return false;
}



var lOver='';var ImgNum=2;
var ImgPrefix="/img_2/menu/menu";
var img_l=new Array();var img_l_a=new Array();var img_r=new Array();var img_r_a=new Array();var img_u=new Array();var img_u_a=new Array();

for (var i=1;i<=ImgNum;i++) {
	img_l[i]=new Image();img_l[i].src=ImgPrefix+i+'l.gif';
	img_l_a[i]=new Image();img_l_a[i].src=ImgPrefix+i+'l_a.gif';
	img_r[i]=new Image();img_r[i].src=ImgPrefix+i+'r.gif';
	img_r_a[i]=new Image();img_r_a[i].src=ImgPrefix+i+'r_a.gif';
	img_u[i]=new Image();img_u[i].src=ImgPrefix+i+'u.gif';
	img_u_a[i]=new Image();img_u_a[i].src=ImgPrefix+i+'u_a.gif';
}
var lPreve='';
function chstyle(pElem) {
	if (lObj=getEl(pElem, "menu_")) {
		var Id=lObj.id.substr(5);
		if(lObj.id!=lPreve){
			if (lPreve!='') setNoStyle(document.getElementById(lPreve));
			lOver=Id; lPreve=lObj.id;
			var lLevel=getLevel(lObj.id.substr(4));
			//lObj.className=lObj.className+'_a';
			lObj.style.backgroundImage='url('+img_u_a[lLevel].src+')';
			document.getElementById('img_'+Id+'_l').src=img_l_a[lLevel].src;
			document.getElementById('img_'+Id+'_r').src=img_r_a[lLevel].src;
		}
	}
	else 	if(lPreve!=''){
		setNoStyle(document.getElementById(lPreve));
		lPreve='';lOver='';
	}
}

function setNoStyle(pElmentO) {
	var lLevell=getLevel(pElmentO.id.substr(4));
//	pElmentO.className=pElmentO.className.substr(0, (pElmentO.className.length - 2));

	pElmentO.style.backgroundImage='url('+img_u[lLevell].src+')';
	document.getElementById('img_'+lOver+'_l').src=img_l[lLevell].src;
	document.getElementById('img_'+lOver+'_r').src=img_r[lLevell].src;
}


function getLevel(pP) {
	for (var i=0;pP.indexOf('_')!=-1;i++)
		pP=pP.substr(0,pP.lastIndexOf('_'));
	return i;
}
function lux_blu() {
window.showModalDialog('aks/l_blue.html', '', 'dialogWidth:30em; dialogHeight:24em; help:0');
}
function glas_blu() {
window.showModalDialog('aks/g_blue.html', '', 'dialogWidth:23em; dialogHeight:18em; help:0');
}
function salfet() {
window.showModalDialog('aks/salf.html', '', 'dialogWidth:25em; dialogHeight:28em; help:0');
}
function coppucino() {
window.showModalDialog('aks/coppuc.html', '', 'dialogWidth:30em; dialogHeight:20em; help:0');
}
function espresso() {
window.showModalDialog('aks/express.html', '', 'dialogWidth:30em; dialogHeight:20em; cursor:hand; help:0');
}
function cafcao() {
window.showModalDialog('aks/cafcao.html', '', 'dialogWidth:35em; dialogHeight:30em; help:0');
}
function stopar() {
window.showModalDialog('aks/stac.html', '', 'dialogWidth:26em; dialogHeight:28em; help:0');
}
function futbol() {
window.showModalDialog('aks/t_green.html', '', 'dialogWidth:33em; dialogHeight:41em; help:0');
}
function futbol_black() {
window.showModalDialog('aks/t_black.html', '', 'dialogWidth:35em; dialogHeight:41em; help:0');
}
function reclvnut() {
window.showModalDialog('aks/r_vnut.html', '', 'dialogWidth:35em; dialogHeight:26em; help:0');
}
function rvnesch() {
window.showModalDialog('aks/r_vnesh.html', '', 'dialogWidth:37em; dialogHeight:28em; help:0');
}
function fartuk() {
window.showModalDialog('aks/perednik.html', '', 'dialogWidth:28em; dialogHeight:27em; help:0');
}
