window.onload=rollup;


function rollout(objMenuitem, objEvent)
{
    var iKeyCode;

    // Check if from a keyboard - non IE, but
    // irrelevant as tab doesn't trigger the 
    // keypress event in IE
    if (objEvent && objEvent.type == 'keypress')
    {
        if (objEvent.keyCode)
            iKeyCode = objEvent.keyCode;
        else if (objEvent.which)
            iKeyCode = objEvent.which;

        // If it's not the enter key or space key, 
        // pass control back to the browser
        if (iKeyCode != 13 && iKeyCode != 32)
            return true;
    }
        //var strLocation = window.location;
		//alert(objMenuitem.href)
		var objMenuitem0 = objMenuitem;
//alert("aktiviert")
		//window.location=objMenuitem0.href
//**************************************************************
    //if (objMenuitem.nextSibling.style.display == 'block')
     //   objMenuitem.nextSibling.style.display = 'none';
    //else
     //   objMenuitem.nextSibling.style.display = 'block';

    // Stop the browser requesting the link
    //return false;
	
	//var objMenuitem2=objMenuitem.nextSibling
//**************************************************************
	//alert("Hallo")
    //alert(objMenuitem.tagName)
	//alert(objMenuitem.firstChild.data)
	//alert(objMenuitem.parentNode.childNodes[0].tagName)
var alists = objMenuitem.parentNode; // li-Element
var objsubNested = alists.getElementsByTagName('ul');
dum=objsubNested[0]
//Oeffnen & Schliessen der uls durch Anklicken
if (dum.style.display == 'block')
	var strDisplay = 'none';
else
	var strDisplay = 'block';

//Schließen aller uls, die nicht gerade durch ihr oberes li-Element angeklickt wurden	
var objMenu = document.getElementById('Navigation');
var objNested = objMenu.getElementsByTagName('ul');

for (var i=0; i<objNested.length; i++)
	if (objNested[i].style.display == 'block')
		objNested[i].style.display = 'none';
		
dum.style.display = strDisplay;

//darüberliegende Listen sollen offen bleiben
//alert(objMenuitem.parentNode.parentNode.tagName)
while (objMenuitem.parentNode.parentNode.id != 'Navigation')
{
	var objMenuitem = objMenuitem.parentNode.parentNode;
	objMenuitem.style.display = 'block';
}

//if (objMenuitem0.href == window.location)
//{alert('ja')
//window.location=objMenuitem0.href
//window.location='#'
//dum.style.display = 'block';
//}

return true;

}

function rollup()
{
    // Check we're working with a DOM compliant browser
    if (document.getElementById && document.createElement)
    {
        var strLocation = window.location;
        //alert(strLocation)
		var objMenu = document.getElementById('Navigation');

        var objNested = objMenu.getElementsByTagName('ul');
        //var objNested = document.getElementsByTagName('ul');

        // Hide each of the nested unordered list
        //alert(objNested.length)
		for (var i=0; i<objNested.length; i++)
        {   //alert(i)
            // Only hide, if the current location is not found in the list
            bRollup = true;
            objLinks = objNested[i].getElementsByTagName('a');
			
            for (var j=0; j<objLinks.length; j++)
            {
                if (objLinks[j].href == strLocation)
                    {
						bRollup = false;
						//objLinks[j].style.fontStyle="italic"
						objLinks[j].style.fontWeight="bold"
						//objLinks[j].style.color="#EE9955"
					}
			}

			
            //if (bRollup == true)
            //    objNested[i].style.display = 'none';
            //else
            //    objNested[i].style.display = 'block';
				
			//if (objNested[i].className == 'offenlassen')
			//{
				//alert('Sonderfall')
			//	objNested[i].style.display = 'block';
			//}
			
		
			objNode = objNested[i].parentNode;  //Listenelement ueber ul-Element
			
			if (objNode.childNodes[0].tagName == 'A')
			{
				var objAnchor = objNode.childNodes[0];
			}
			else
			{
				var objAnchor = objNode.childNodes[1];
			}
			
			//if (objAnchor.href == strLocation)
			//{

			//	objNested[i].style.display = 'block';
			//}
            if ((bRollup == true) != (objAnchor.href == strLocation))
                objNested[i].style.display = 'none';
            else
                objNested[i].style.display = 'block';
			
			//var aktLink=objAnchor.firstChild;
			//alert(aktLink.color)
			//aktLink.setAttribute('color','red');
			//aktLink.className="aktuellerlink";
			//alert(aktLink.style.color)
			
			objAnchor.onclick = function(event){return rollout(this, event);}
            objAnchor.onkeypress = function(event){return rollout(this, event);}
		}
    }
}