        const d1 = document.getElementById("download1");
        const d2 = document.getElementById("download2");
        const d3 = document.getElementById("download3");
        <?php
        $img = '';
        if ($img1 != '') {
            $img = $img1;
        }
        if ($img2 != '') {
            $img = $img2;
        }
        if ($img3 != '') {
            $img = $img3;
        }
        ?>

        function controlAnimation() {
            const box = document.querySelector(".coming-box");
            const img = document.getElementById("resultImage");
            const imgbox = document.getElementById("result-image-box1");
            const btn1 = document.getElementById("btn1");
            const btn2 = document.getElementById("btn2");
            const btn3 = document.getElementById("btn3");
            const now = new Date();
            const hours24 = now.getHours();
            const minutes = now.getMinutes();
            let hour12 = hours24 % 12;
            hour12 = hour12 ? hour12 : 12;
            let animate = false;
            let button1 = false;
            let button2 = false;
            let button3 = false;
            /* 12:05 – 12:15 */
            if ((hours24 === 12 && minutes >= 5 && minutes <= 15) ||
                (hour12 === 12 && minutes >= 5 && minutes <= 15)) {
                animate = true;
                button1 = true;
            }
            /* 05:05 – 05:15 PM */
            if ((hours24 === 17 && minutes >= 5 && minutes <= 15) ||
                (hour12 === 5 && minutes >= 5 && minutes <= 15)) {
                animate = true;
                button2 = true;
            }
            /* 09:35 – 09:45 PM */
            if ((hours24 === 21 && minutes >= 35 && minutes <= 45) ||
                (hour12 === 9 && minutes >= 35 && minutes <= 45)) {
                animate = true;
                button3 = true;
            }
            if (animate) {
                box.classList.add("animate");
                box.style.display = "inline-block";
                img.style.display = "none";
                imgbox.style.display = "none";
                if (button1 == true) {
                    btn1.classList.add("animate");
                }
                if (button2 == true) {
                    btn2.classList.add("animate");
                }
                if (button3 == true) {
                    btn3.classList.add("animate");
                }

                d1.style.pointerEvents = "none";
                d2.style.pointerEvents = "none";
                d3.style.pointerEvents = "none";

                d1.style.opacity = "0.5";
                d2.style.opacity = "0.5";
                d3.style.opacity = "0.5";

            } else {
                box.classList.remove("animate");
                box.style.display = "inline-block";
                <?php
                if ($img1 == '' or $img2 == '' or $img3 == '') {
                ?>
                    img.style.display = "none";
                    imgbox.style.display = "none";
                <?php
                } else {
                ?>
                    img.style.display = "block";
                    imgbox.style.display = "block";
                <?php
                }
                ?>
                if (button1 == false) {
                    btn1.classList.remove("animate");
                }
                if (button2 == false) {
                    btn2.classList.remove("animate");
                }
                if (button3 == false) {
                    btn3.classList.remove("animate");
                }
                img.src = '<?php echo '../hongkong_result/output/' . $img; ?>';

                d1.style.pointerEvents = "auto";
                d2.style.pointerEvents = "auto";
                d3.style.pointerEvents = "auto";

                d1.style.opacity = "1";
                d2.style.opacity = "1";
                d3.style.opacity = "1";
            }
        }
        controlAnimation();
        setInterval(controlAnimation, 20000);
        controlAnimation();
        setInterval(controlAnimation, 20000);
        controlAnimation();
        /* check every 20 seconds */
        setInterval(controlAnimation, 20000);