var lastOver = '';

var timer1 = 0;
var timer2 = 0;
var menueLock      = '';
var itemHeight     = 18;
var menueTop       = 116
var menueWidth     = 136;

function menueOut(mId) {
    for(var x in menueList) {
        if (menueList[x] == mId && menueLock != mId) {
            timer1 = window.setTimeout('hideMenue(\'' + mId + '\')',200);
        }
    }
}

function menueOut2(parentId, mId) {
    if (menueLock == parentId)
	{
        menueLock = '';
    }
    for(var x in menueList2) {
        if (menueList2[x] == mId) 
		{
            timer2 = window.setTimeout('hideMenue2(\'' + parentId + '\',\'' + mId + '\')',200);
        }
    }
}

function hideMenue(mId) 
{
    if(document.getElementById(mId) != null) document.getElementById(mId).className = 'off';
}

function hideMenue2(parentId, mId) 
{
    if(document.getElementById(mId) != null) document.getElementById(mId).className = 'off';
    var lId = 'l' + mId.substr(1,2);
    if(document.getElementById(mId) != null) document.getElementById(lId).style.color = '#F6C602';
	if (lastOver != parentId) 
	{
        hideMenue(parentId);
    }

}

function menueOver(mId) {
    window.clearTimeout(timer1);
    lastOver = mId;
}

function menueOver2(parentId, mId) {
    window.clearTimeout(timer2);
    window.clearTimeout(timer1);
    lastOver = mId;
}

function showMenue(mId) {
    for(var x in menueList) {
        if (mId == menueList[x]) {
//			alert(document.body.clientWidth);
//			var posX = menueOffset[mId] + getSiteXy();
			
			if(ns6){
				posLeft = document.getElementById('xy').offsetLeft;  
				posTop = document.getElementById('xy').offsetTop;
				//alert(posLeft);
			  } else { 
				posLeft = xy.offsetLeft;  
				posTop = xy.offsetTop; 
			  }
			  if(bw.opera5) {
				  posTop += 8;
				  posLeft += 14;
			  }
			
			
			
			//var posX = menueOffset[mId] + (doc_width()/2);
			//var posY = menueTop;
            document.getElementById(mId).className = 'on';
            document.getElementById(mId).style.top  = (posTop+menueTop)+'px';
            document.getElementById(mId).style.left = (posLeft+menueOffset[mId])+'px';
        } else {
            hideMenue(menueList[x]);
        }
    }
}

function showMenue2(parentId, mId) {
    menueLock = parentId;
    var lId = 'l'+mId.substr(1,2);
	for(var x in menueList2) {
        if (mId == menueList2[x]) {
			var posX = menueOffset[parentId] + menueWidth + (doc_width()/2);
            var posY = menueTop + (menueOffsetTop[mId]*(itemHeight+1));
            if(document.getElementById(mId) != null){
				document.getElementById(mId).className = 'on';
				document.getElementById(mId).style.left = posX+'px';
				document.getElementById(mId).style.top  = posY+'px';
				document.getElementById(lId).style.color = '#fff';
			}
        } else {
            hideMenue(menueList2[x]);
        }
    }
}

function getSiteXy() {
//	return (document.body.clientWidth\2);
//    return document.getElementById('center')['offsetLeft'];
}

function doc_width()
{
	//opera Netscape 6 Netscape 4x Mozilla 
	if (window.innerWidth || window.innerHeight)
	{ 
		docwidth = window.innerWidth; 
		docheight = window.innerHeight; 
	} 
	//IE Mozilla 
	if (document.body.clientWidth || document.body.clientHeight)
	{ 
		docwidth = document.body.clientWidth; 
		docheight = document.body.clientHeight; 
	}
	return docwidth;
}
function doc_height()
{
	//opera Netscape 6 Netscape 4x Mozilla 
	if (window.innerWidth || window.innerHeight)
	{ 
		docwidth = window.innerWidth; 
		docheight = window.innerHeight; 
	} 
	//IE Mozilla 
	if (document.body.clientWidth || document.body.clientHeight)
	{ 
		docwidth = document.body.clientWidth; 
		docheight = document.body.clientHeight; 
	} 
	return docheight;
}