
var lastSubMenu = 0;
var hasSubMenu = false;
function toggleMenu(idsubmenu, obj)
{

	var e;
	if (lastSubMenu != 0)
	{
		e = document.getElementById('submenu'+lastSubMenu);
		if (e!=null)
			e.style.visibility = 'hidden';
	}
	e = document.getElementById('submenu'+idsubmenu);
	if (e!=null)
	{
		e.style.visibility = 'visible';
	}
	lastSubMenu = idsubmenu;
	hasSubMenu = true;


}

function hideLastMenu()
{   //  delay
  hasSubMenu = false;
  self.setTimeout('hideLastMenuDelayed()', 500)  
}
function hideLastMenuDelayed()
{
  if (hasSubMenu == true) return; // do not hide
  hideMenu(lastSubMenu );
}

function inSubMenu()
{
	hasSubMenu = true;
}

function hideMenu(idsubmenu)
{
var e;

e = document.getElementById('submenu'+idsubmenu);
if (e!=null)
{
e.style.visibility = 'hidden';
}
lastSubMenu = 0;
hasSubMenu = false;
// hide logoImage
  var url = "../../images/"+idLogoImage;
  e = document.getElementById('logoImage');
  if (e!=null)
    e.src=url;
}




function onSubMenu(obj)
{ // <div onMouseOver="onSubMenu(this)"><nobr><a href="...">{nodeValue}
  if(!obj) return;
  if(!obj.firstChild) return;
  if(!obj.firstChild.firstChild) return;
  if(!obj.firstChild.firstChild.firstChild) return;
  var val = obj.firstChild.firstChild.firstChild.nodeValue;
  if (val == null) return;

}






function assignMouseOverInit()
{
	var e = document.getElementsByTagName('A');
	for (var i = 0; i < e.length; i++) 
	{
		assignMouseOver(e[i]);
	}
}


function assignMouseOver(a)
{
	if (!a.lastChild) return;
	if (!a.lastChild.nodeValue) return;

	var lbl = a.lastChild.nodeValue;
	if(lbl.indexOf("VW Nutzfahrzeuge")!=-1) 
		a.onmouseover = function() { setLogoFor( "VWNF") ; };
	else if(lbl.indexOf("Volkswagen")!=-1)
		a.onmouseover = function() { setLogoFor( "VW") ; };
	else if(lbl.indexOf("VW")!=-1)
		a.onmouseover = function() { setLogoFor( "VW") ; };
	
	if(lbl.indexOf("VW Nutzfahrzeuge")!=-1) 
		a.onmouseout = function() { setLogoBack() ; };
	else if(lbl.indexOf("Volkswagen")!=-1)
		a.onmouseout = function() { setLogoBack() ; };
	else if(lbl.indexOf("VW")!=-1)
		a.onmouseout = function() { setLogoBack() ; };
	
}


function setLogoBack()
{
    if(logoimgsrc == '') return;

    var bilde = document.getElementById('logoImage');
    if(bilde) 
    {
        bilde.src = logoimgsrc;

    }
}


function setLogoFor(n)
{

    var bilde = document.getElementById('logoImage');
    if(bilde) 
    {
       logoimgsrc = bilde.src;
       if(n=="VW")
        bilde.src = '../../images/103145.gif';
       if(n=="VWNF")
        bilde.src = '../../images/103146.gif';

    }
}



function repeatThis() 
{
  var e;
  var url;
  imageNo++;
  if (imageNo >= imageNoMax) imageNo = 0;
  url = imageArray[imageNo];
  e = document.getElementById('topImage');
  if (e!=null)
    e.src=url;

  setTimeout('repeatThis()',4000);
}

