<div class="TimeContainer">
    <div id="clockdiv">
        <div>
            <span class="countdownNummer" id="day"></span>
            <div class="smalltext">Tage</div>
        </div>
        <div>
            <span class="countdownNummer" id="hour"></span>
            <div class="smalltext">Stunden</div>
        </div>
        <div>
            <span class="countdownNummer" id="minute"></span>
            <div class="smalltext">Minuten</div>
        </div>
        <div>
            <span class="countdownNummer" id="second"></span>
            <div class="smalltext">Sekunden</div>
        </div>
    </div>
    <br />
    <div id="messagebox">
        <img id="imgmessage">
		<br>
    </div>
</div>

    <script>

    <?php
        $js_array = json_encode($images);
        echo "var images = ".$js_array.";\n";
        $js_array = json_encode($videos);
        echo "var videos = ".$js_array.";\n";

    ?>

    console.log(images);
    var deadline = new Date("Nov28, 2021 00:00").getTime();

    var x = setInterval(function() {

        var now = new Date().getTime();
        var t = deadline - now;
        var days = Math.floor(t / (1000 * 60 * 60 * 24));
        var hours = Math.floor((t % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
        var minutes = Math.floor((t % (1000 * 60 * 60)) / (1000 * 60));
        var seconds = Math.floor((t % (1000 * 60)) / 1000);

        // Teste datum

        document.getElementById("day").innerHTML = days;
        document.getElementById("hour").innerHTML = hours;
        $("#minute").html(minutes);
        $("#second").html(seconds);

        if (days == 0) {
            $("#day").parent().hide();
            if (hours == 0) {
                $("#hour").parent().hide();
                if (minutes == 0) {
                    $("#minute").parent().hide();
                    $("#second").parent().addClass("pulsieren")
                    $("#second ~ div").hide();
                    $("#textmessage").hide();
                }
            }
        }


        document.getElementById("textmessage").innerHTML = textmessage;
        if (t <= 0) {
            clearInterval(x);
            $("#clockdiv").hide();
            $("#messagebox").hide();
            $("header b").html("Frohe Weihnachten!!!")
            imageLoopFunc();

        }
    }, 1000);
    </script>


<h2 id="kstart">Bis der Kalender Startet !!!</h2>
</div>

<p>

<?php include ("kalender.php") ?>
