var mouseOverElement = 0;
var mouseOverTopNavi = 0;
var topNaviOpened = 0;

function setMouseOver_menuItem(indexParam)
{
	mouseOverElement = indexParam;
}

function setMouseOut_menuItem(indexParam)
{
	mouseOverElement = 0;
}

function setTopNaviOver(toggleParam)
{
	mouseOverTopNavi = toggleParam;
}

function hasMouseOver(indexParam)
{
	if(mouseOverElement == indexParam) return true;
	else return false;
}

function showSubmenu_timeOut(indexParam)
{
	if(topNaviOpened==0)
	{
		showSubmenu(indexParam);
		topNaviOpened=1;
	} else setTimeout("showSubmenu(" + indexParam + ")",650);
}

// Timeout des hideTopNavi von 500 auf 3000 erhoeht  auf Wunsch von Herrn Boudieb

function hideTopNavi_TimeOut()
{
	setTimeout("hideTopNavi()",3000);
}

function hideTopNavi()
{
	if(mouseOverTopNavi==0)
	{
		hideAllSubMenus();
	}
}

function showSubmenu(indexParam)
{	
	// Change Image for Menu Item
	//menuitem = document.getElementById(id_param);
	//menuitem.className = class_param;	
	//document.getElementById('startcockpit-box').style.backgroundImage = bgImages[index_param];
	
	if(hasMouseOver(indexParam))
	{
		hideAllSubMenus();
			
		indexParam = indexParam-1;
		var nodes = ($$('div#top-navi-box .sub-item'));	
		nodes[indexParam].style.display = 'block';
		
		var topItemNodes = ($$('ul#top-navi-1stlvl .item a'));
//		topItemNodes[indexParam].className = 'act';
		topItemNodes[indexParam].style.color  = '#cc0000';
		
		var topnavibox = ($('top-navi-box'));
		
		topnavibox.className = 'top-navi-act';
	}
			
	//nodes[indexParam].style.display = 'block';

}

function hideAllSubMenus() {
	
	var nodes = ($$('div#top-navi-box .sub-item'));		
	for(i=0; i<nodes.length; i++)
	{
		nodes[i].style.display = 'none';
	}
	
	var topItemNodes = ($$('ul#top-navi-1stlvl .item a'));
	
	for(i=0; i<topItemNodes.length; i++)
	{
//		topItemNodes[i].className = 'no';
		topItemNodes[i].style.color  = '';
	}
		
	var topnavibox = ($('top-navi-box'));
	topnavibox.className = 'top-navi-notact';
	if(mouseOverTopNavi	== 0) topNaviOpened = 0;
}

function openLightBox(urlParam, urlParamBG)
{
	// document.getElementById('overlay').style.display = 'block';
	
	if(navigator.appVersion.indexOf("MSIE 6")>-1)
	{
		/*
		overlay = $('overlay');
		overlay.setStyle({ 
			'width' : document.viewport.getWidth(),
		})		*/
	}
	
	document.getElementById('overlay').style.display = 'block';	
	document.getElementById('lightbox_bg').style.display = 'block';
	document.getElementById('lightbox').style.display = 'block';
	document.getElementById('close-box').style.display = 'block';
	top.frames[0].location.replace(urlParamBG);	
	top.frames[1].location.replace(urlParam);
}

function doHoverIn(id_param,class_param,index_param)
{	
	// Change Image for Menu Item
	menuitem = document.getElementById(id_param);
	menuitem.className = class_param;	
	document.getElementById('startcockpit-box').style.backgroundImage = bgImages[index_param];
}

function doHoverOut(id_param, class_param) {
	
	// Change Image for Menu Item	
	menuitem = document.getElementById(id_param);
	menuitem.className = class_param;
 
}

function closeLightbox()
{
	document.getElementById('overlay').style.display='none';
	document.getElementById('lightbox').style.display='none';
	document.getElementById('lightbox_bg').style.display='none';
	document.getElementById('close-box').style.display='none';
	top.frames[1].location.replace('/fileadmin/res/html/loading.html');
}

