var Luefte = new Array ('Aufglanz', 'Wind', 'abschweb', 'Föhn|foehn', 'Tanze den Bart|tanze_den_bart', 
'Flug nach Roßhaupten|flug', 'hoch überm Dorf|dorf', 'üben|ueb');
var Freude = new Array ('5-er', 'Ducke Dumm|duckedumm', 'Weihnachten', 'Lasst uns genießen|fress', 'Ständchen|wieschoen');
 
var Liste = Luefte;
var Alternative = Freude;
var regulaer = true;
var gerastet = -1;









function Adresse_pur (KnopfNr)
{
if (KnopfNr < Liste.length)
    {
    var Strich = Liste [KnopfNr].indexOf ('|');
    return (Strich == -1) ? Liste [KnopfNr].toLowerCase() : Liste [KnopfNr].slice (Strich + 1);
    }
else
    {
    KnopfNr -= Liste.length;
    var Strich = Alternative [KnopfNr].indexOf ('|');
    return (Strich == -1) ? Alternative [KnopfNr].toLowerCase() : Alternative [KnopfNr].slice (Strich + 1);
    }
}






function Titel_pur (KnopfNr)
{
if (KnopfNr < Liste.length)
    {
    var Strich = Liste [KnopfNr].indexOf ('|');
    return (Strich == -1) ? Liste [KnopfNr] : Liste [KnopfNr].slice (0, Strich);
    }
else
    {
    KnopfNr -= Liste.length;
    var Strich = Alternative [KnopfNr].indexOf ('|');
    return (Strich == -1) ? Alternative [KnopfNr] : Alternative [KnopfNr].slice (0, Strich);
    }
}






function istSeite (KnopfNr)
{
return Adresse_pur (KnopfNr) == location.href.slice (location.href.lastIndexOf ('/') + 1, location.href.lastIndexOf ('.'));
}






var ist = -1;
for (var a = 0; a < Liste.length; a++)
    if (istSeite (a))
        ist = a;

if (ist == -1)
    {
    Liste = Freude;
    for (var a = 0; a < Liste.length; a++)
        if (istSeite (a))
            ist = a;
    Alternative = Luefte;
    }








function nimmSeite (KnopfNr)
{
location.href = Adresse_pur (KnopfNr) + '.htm';
}





function lass (Knopf)
{
with (Knopf.style)
    {
    backgroundColor = '#BBBBBB';
    borderStyle = 'outset';
    color = '#FFFFFF';
    }

if (document.getElementById ('gedrueckt'))
    with (document.getElementById ('gedrueckt').style)
        {
        backgroundColor = '#F7F2F8';
        borderStyle = 'inset';
        color = '#000000';
        }
}







function drueck (Knopf)
{
with (Knopf.style) 
    { 
    backgroundColor = '#FFFFFF';
    borderStyle = 'inset';
    color = '#000000';
    }

if (document.getElementById ('gedrueckt'))
    with (document.getElementById ('gedrueckt').style)
        {
        backgroundColor = '#BBBBBB';
        borderStyle = 'outset';
        color = '#FFFFFF';
        }
}






function Wechsel ()
{
with (document)
    if (regulaer)
        {
        getElementById ('Gruppe').firstChild.nodeValue = (Liste == Luefte) ? 'Sangesfreude:' : 'Lieder der Lüfte:';

        for (var a = 0; a < Liste.length; a++)
            if (a != ist)
                getElementById ('_' + a).style.display = 'none';

        getElementById ('gedrueckt').style.display = 'none';

        for (var b = 0; b < Alternative.length; b++)
            getElementById ('_' + (a + b)).style.display = 'inline';

        regulaer = false;
        }
    else
        {
        getElementById ('Gruppe').firstChild.nodeValue = (Liste == Luefte) ? 'Lieder der Lüfte:' : 'Sangesfreude:';

        for (var a = 0; a < Liste.length; a++)
            if (a != ist)
                getElementById ('_' + a).style.display = 'inline';

        getElementById ('gedrueckt').style.display = 'inline';

        for (var b = 0; b < Alternative.length; b++)
            getElementById ('_' + (a + b)).style.display = 'none';

        regulaer = true;
        }
}





function checkMaus (e)
{ 
var Oberkante = 60;

if (navigator.appName.indexOf ("Microsoft") == -1)
    { 
    Maus_x = e.pageX;
    Maus_y = e.pageY;

    var gescrollt = e.pageY != e.screenY
    }
else
    { 
    Maus_x = event.clientX + document.body.scrollLeft;
    Maus_y = event.clientY + document.body.scrollTop;

    var gescrollt = document.body.scrollTop > 0;
    }

if (navigator.appName.indexOf ("Microsoft") == -1)
    {
    rel_x = e.screenX;
    rel_y = e.screenY - 100;
    }
else
    {
    rel_x = event.clientX;
    rel_y = event.clientY;
    }

if (document.getElementById ('Leiste').style.top == '0px' && rel_y < Oberkante)
    {
    document.getElementById ('Leiste').style.top = document.body.scrollTop + 'px';
    }
else if (document.getElementById ('Leiste').style.top != '0px')
    if (rel_y > Oberkante)
        {
        document.getElementById ('Leiste').style.top = '0px';
        }

if (status == '' && gescrollt && document.getElementById ('Leiste').style.top == '0px')
    status = 'Zum Aktivieren der Navigationsleiste führen Sie bitte die Maus zum Oberrand'
else if (document.getElementById ('Leiste').style.top != '0px' || !gescrollt)
    status = '';


//status = 'x = ' + Maus_x + '   y = ' + Maus_y + '    rel_x = ' + rel_x + '   rel_y = ' + rel_y;


if (Leiste_onMouseMove != null)
    Leiste_onMouseMove ();
}





function InitMaus ()
{
if (Leiste_onLoad != null)
    Leiste_onLoad ();

Leiste_onMouseMove = document.onmousemove;
document.onmousemove = checkMaus;
}








function Init ()
{
InitMaus ();
}




var Leiste_onMouseMove;
var Leiste_onLoad = window.onload;
window.onload = Init;





with (document)
    {
    write ('<div class="latent" onMouseOver="touch ()"></div>');

    write ('<div id="Leiste" class="Leiste" style="top:0px">');
    write ('<div class="Geier">');
    Geier ('../grafik/geierchen.gif');
    write ('</div>');

    write ('<div id="Gruppe" class="Sammlung" onClick="Wechsel ()">');
    write ((Liste == Luefte) ? 'Lieder der L&uuml;fte:' : 'Sangesfreude:');
    write ('</div>');

    for (var a = 0; a < Liste.length; a++)
        {
        var Titel = Titel_pur (a);

        if (!istSeite (a))
            {
            write ('<a id="_');
            write (a);
            write ('" href="javascript:nimmSeite (' + a + ')" class="Knopf" ');
            write ('onMouseOver="this.style.backgroundColor = ');
            write ("'#DDDDDD'; this.style.color = '#000000'");
            write ('" ');
            write ('onMouseOut="lass (this)" ');
            write ('onMouseDown="drueck (this)" ');
            write ('>');
            write (Titel);
            write ('</a>');
            }
        else
            {
            write ('<span id="gedrueckt" class="Knopf_gedrueckt">');
            write (Titel);
            write ('</span>');

            gerastet = a;
            top.Datei = Adresse_pur (a);
            }
        }


    for (var b = 0; b < Alternative.length; b++)
        {
        var Titel = Titel_pur (a + b);
        write ('<a id="_');
        write (a + b);
        write ('" href="javascript:nimmSeite (' + (a + b) + ')" class="Knopf" ');
        write ('onMouseOver="this.style.backgroundColor = ');
        write ("'#DDDDDD'; this.style.color = '#000000'");
        write ('" ');
        write ('onMouseOut="lass (this)" ');
        write ('onMouseDown="drueck (this)" ');
        write ('style="display:none"');
        write ('>');
        write (Titel);
        write ('</a>');
        }


    write ('</div>');
    }















