if(document.images)
    {
    var lampe1 = new Image(1350,1050);
    lampe1.src = "taschenlampe_01.gif";
    var hoehle1 = new Image(600,450);
    hoehle1.src = "hoehle_02.jpg";
    var hoehle2 = new Image(600,450);
    hoehle2.src = "hoehle_03.jpg";
    var not1 = new Image(60,32);
    not1.src = "notausgang_02.jpg";
    var not2 = new Image(60,32);
    not2.src = "notausgang_03.jpg";
    }

function fnBildTauschen(BildName,TauschBildQuelle) {
    if(document.images)
        {
        document.images[BildName].src= eval(TauschBildQuelle+".src");
        }
}

// Fürs Flackern:
var Aktiv;
var Sichtbar = 1;
var Anzahl = 0;

function fnLeuchten(ElementID,JaNein)
    {
    if(JaNein == 1)
        {
        document.getElementById(ElementID).style.color = "#CCCC00";
        document.getElementById(ElementID).style.textDecoration = "underline";
        }
    else
        {
        document.getElementById(ElementID).style.color = "#999999";
        document.getElementById(ElementID).style.textDecoration = "none";
        }
    }

function fnFlutlicht(JaNein,taschenlampeJaNein)
    {
    if(document.images)
        {
        var taschenlampe = document.getElementById('taschenlampe').style.visibility;
        if(JaNein == 1)
            {
            document.getElementById('taschenlampe').style.visibility = "hidden";
	   document.getElementById('erlaeuterung').style.visibility = "hidden";
            document.getElementById('anfang').style.visibility = "hidden";

            //Flackern
            //window.setTimeout("fnHoehleFlackern()",1000);

            fnBildTauschen('malerei','hoehle1');
            fnHoehleFlackern();
            window.setTimeout("fnHoehleSichtbar(1)",1000);

            if(taschenlampe == "visible")
                {
                window.setTimeout("fnFlutlicht(0,1)",2500);
                }
            else
                {
                window.setTimeout("fnFlutlicht(0,0)",2500);
                }
            }
        else
            {
            if(taschenlampeJaNein == 1)
                {
                fnBildTauschen('malerei','hoehle2');
                document.getElementById('taschenlampe').style.visibility = "visible";
                }
            else
                {
	       fnHoehleSichtbar(0);
                }
            }
        }
    }

function fnLichterAus()
    {
    if(document.images)
        {
        fnHoehleSichtbar(0);
        document.getElementById('taschenlampe').style.visibility = "hidden";
        }
    }

function fnTaschenlampe()
    {
    if(document.images)
        {
        fnBildTauschen('malerei','hoehle2');
        document.getElementById('taschenlampe').style.visibility = "visible";
        fnHoehleSichtbar(1);
        }
    }

function fnTaschenlampeBewegenGross()
    {
    if(document.images)
        {
        if(fnBrowserCheck() == "IE")
            {
            var xwert = window.event.clientX - 150;
            var ywert = window.event.clientY - 50;
            var koords = xwert + " / " + ywert;
            xwert = xwert - 525; // - 675 + 150
            ywert = ywert - 475; // - 525 + 50
            window.status = koords;
            document.getElementById('taschenlampe').style.left = xwert;
            document.getElementById('taschenlampe').style.top = ywert;
            }
        }
    }

function fnMausDraussen()
    {
    if(fnBrowserCheck() == "NN")
        {
        document.onmousemove = fnNichts();
        }
    window.status = ' ';
    }

function fnHoehleSichtbar(JaNein)
    {
    if(document.images)
        {
        if(JaNein == 1)
            {
            document.getElementById('hoehle').style.visibility = "visible";
	   document.getElementById('erlaeuterung').style.visibility = "hidden";
            document.getElementById('anfang').style.visibility = "hidden";
            }
        else
            {
            document.getElementById('hoehle').style.visibility = "hidden";
            }
        }
    }

function fnAusblenden(ElementID)
    {
    document.getElementById(ElementID).style.visibility = "hidden";
    }

function fnErlaeuterungEinblenden()
    {
    document.getElementById('erlaeuterung').style.visibility = "visible";
    document.getElementById('anfang').style.visibility = "hidden";
    document.getElementById('hoehle').style.visibility = "hidden";
    document.getElementById('taschenlampe').style.visibility = "hidden";
    // document.getElementsByTagName("p")[0].firstChild.data = InfoText; */
    }

function fnBrowserCheck()
    {

    var BrowserName = navigator.appName;

    if(BrowserName.indexOf("Microsoft Internet Explorer") != -1)
        {
        return "IE";
        }
    else if(BrowserName.indexOf("Netscape") != -1)
        {
        return "NN";
        }
    else
        {
        return "XX";
        }
    }

function fnNetscapeLampe()
    {
    if(fnBrowserCheck() == "NN")
        {
        document.onmousemove = fnLayerPos;
        }
    }

function fnLayerPos(Ereignis)
    {
    if(document.layers)
        {
        document.layers[0].left = Ereignis.pageX;
        document.layers[0].top = Ereignis.pageY;
        }
    else if(window.netscape)
        {
        xwert = Ereignis.pageX - 150;
        ywert = Ereignis.pageY - 50;
        koords = xwert + " / " + ywert;
        window.status = koords;
        xwert = xwert - 525; // - 675 + 150
        ywert = ywert - 475; // - 525 + 50
        document.getElementById('taschenlampe').style.left = xwert;
        document.getElementById('taschenlampe').style.top = ywert;
        }
    }

function fnNichts()
    {
    // nur für Netscape
    // es passiert nichts.
    }

function fnFlackern()
    {
    if(Sichtbar == 1)
        {
        document.getElementById('hoehle').style.visibility = "visible";
        Sichtbar = 0;
        }
    else
        {
        document.getElementById('hoehle').style.visibility = "hidden";
        Sichtbar = 1;
        }
    Anzahl = Anzahl + 1;

    //alert(Anzahl);
    if(Anzahl >= 5)
        {
        window.clearInterval(Aktiv);
        }
    }

function fnHoehleFlackern()
    {
    Aktiv = window.setInterval("fnFlackern()",100);
    }

// Nicht benutzte Funktionen

function fnPosition(xwert,ywert)
    {
    document.getElementById('taschenlampe').style.left = xwert;
    document.getElementById('taschenlampe').style.top = ywert;
    }

function fnHallo()
    {
    alert("Hallo!");
    }
