// ------------------------------------------------------------------
// HautpMenus einfärben, damit der User weiss wo er ist
// ------------------------------------------------------------------
function topmenuMarkActiveMenu( ) {
    // Hauptmenus einf�rben falls der MenuLink mit dem aktuellen Link uebereinstimmt
    var div = document.getElementById( "topmenu" );
    if ( div !== null ) topmenuMarkActiveMenuDo(div);
    // das gleich auf für das UnterMenü
    div = document.getElementById( "topmenuSub" );
    if ( div !== null ) topmenuMarkActiveMenuDo(div);
}

function topmenuMarkActiveMenuDo( thisDiv ) {
    // div-Tag prüfen ob Links enthalten sind, die den gleichen 'parent' haben als 
    // der aktuelle Link - falls ja -> einfä�rben, damit der User
    // weiss wo er steht.
    var i = 0;
    var menuHref = null ;
    var myLocation = self.location.toString() ;    
    myLocation = myLocation.toLowerCase() + '/ ' ;
    var htmlTag = null ;
    var homeLink = null ;
    var markiert = false ;
    var childs = thisDiv.childNodes ;
        
    for ( i = 0; i < childs.length; i++ ) {
        o = childs[i] ;
        if ( o.innerHTML > '' ) {
            htmlTag = o.tagName.toLowerCase() ;
            //alert(htmlTag);
            if ( htmlTag == 'a'  ) {
                // wir interessieren uns nur f�r Links 
                menuHref = o.href.toString() ;
                menuHref = menuHref.toLowerCase() ;
                // alert( ' >noselect<  >' + o.id  + '<' + menuHref + ' pathname: ' + o.pathname.toString() );
                // Anm: patname ist der Teile nach der RechnerAdresse; HomePath = ''  oder / (?) und soll erst mal nicht eingef�rbt werden !
                if ( o.pathname.length <= 1  ) homeLink = o ;
//alert(myLocation + ' # o.pathname:' + o.pathname );
                if ( myLocation.indexOf( menuHref ) > -1   &&  o.pathname.length > 1 && o.id.toString() !== 'noselect' )  {
                     // kommt nicht ?? alert(111);
                     o.style.color = 'black'; 
                     o.style.fontWeight = '700'; 
                     //o.style.background = '//url(/images/nav_active.png) repeat-x'; 
                     o.style.backgroundColor = '#D9DEE3';
                     markiert = true ;
                }
            }
        }
    }
    // falls es den Home-Link gibt und sonst nichts markiert wurde - dann den HomeLink einf�rben.
    // nicht markieren / es gibt span-Tags im TopMenu !  if ( markiert == false  &&  homeLink !== null ) homeLink.style.color = '#00ADEF' ; 
}





