<footer class="footer text-center">
    <div class="container">
        <ul class="footer-ul">
            <li><a data-intgrtn-link-agreements="1" href="" class="">Website Agreement</a></li>
            <li><a data-intgrtn-link-agreements="2" href="" class="">Risk Disclaimer</a></li>
            <li><a data-intgrtn-link-agreements="3" href="" class="">Privacy Policy</a></li>
            <li><a data-intgrtn-link-report-abuse="" href="" class="">Report Abuse</a></li>
            <li><a data-intgrtn-link-contact-us="" href="" class="">Contact Us</a></li>
        </ul>
        <div data-intgrtn-agreements="" data-intgrtn-type="4" class="container"></div>
        <img data-src="img/logo.png" class="footer-logo lazyload" alt="logo">
    </div>
</footer>
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>
<script type="text/javascript" src="js/intgrtn-i18n.js"></script>
<script type="text/javascript" src="js/lazysizes.min.js" async=""></script>
<script>
    var cryptoCurrencyItem = "";
    $.ajax({
        url: "https://api.binance.com/api/v3/ticker/24hr?symbol=BTCUSDT",
    }).done(function (response) {
        let step = 1;

        // Simulate the expected structure from your original script
        cryptoCurrencyItem = {
            name: "btcusd",
            latestPrice: parseFloat(response.lastPrice)
        };

        $('#btc-widget-price-block').text(cryptoCurrencyItem.latestPrice.toFixed(2));

        $('[data-init="bid-price"]').text((cryptoCurrencyItem.latestPrice).toFixed(2));
        $('[data-init="ask-price"]').text((cryptoCurrencyItem.latestPrice + step).toFixed(2));
    });
</script>
<!-- BEGIN intgrtn -->
<script>
    window.availableLanguages = <?php echo json_encode(scandir(__DIR__ . '/../i18n')); ?> ;

    window.intgrtnInit = function () {
        var path = "/";
        if (window.location.pathname.split("/")[1]) {
            path = "/" + window.location.pathname.split("/")[1] + "/";
        }
        window.intgrtn.setOptions({
            cookies: {
                path: path
            },
        });

        window.intgrtn.events.on("get.project.details.success", function (response) {
            /**
             * Translations
             */
            if (!window.intgrtn.lookup("language")) {
                var language = response.data.client.location.countryIsoCode ? response.data.client.location.countryIsoCode.toLowerCase() : null;
                window.intgrtnI18n.translateAll(language);
            }
            initUiFlags(response);
        });

        window.intgrtn.events.on("parse.data.tags.form.signup.success", function (form) {
            $(form).find(".intgrtn-input-holder-email").append($('<label class="icon-right" for="email"><i class="fa fa-envelope-o"></i></label>'));
            $(form).find(".intgrtn-input-holder-phone").append($('<label class="icon-right" for="phone"><i class="fa fa-phone"></i></label>'));
        });

        let today = new Date();
        let dd = today.getDate();
        let mm = today.getMonth() + 1; //January is 0!
        let yyyy = today.getFullYear();
        let tomorrowsDate = dd + "/" + mm + '/' + yyyy;

        $('.tomorrow-date').text(tomorrowsDate);

        var totalTimeInSeconds = 9 * 60 + 59;

        function updateTimer() {
            setTimeout(function () {
                var minutes = Math.floor(totalTimeInSeconds / 60),
                    seconds = totalTimeInSeconds % 60;
                if (minutes < 10) {
                    minutes = "0" + minutes;
                }
                if (seconds < 10) {
                    seconds = "0" + seconds;
                }
                totalTimeInSeconds--;
                $('.countdown-span').text(minutes + ':' + seconds);
                if (totalTimeInSeconds >= 0) {
                    updateTimer();
                }
            }, 1000);
        }

        updateTimer();

        $('.scroll-top-btn').on("click", function (e) {
            e.preventDefault();
            $('html, body').animate({
                scrollTop: $(".formHeader").offset().top - 100
            }, 1000);
        });

        function rotateNotifications(peopleArray) {
            var index = Math.floor(Math.random() * peopleArray.length),
                name = peopleArray[index].name + ' ' + peopleArray[index].surname.charAt(0) + '.',
                image = peopleArray[index].photo,
                amount = Math.floor(50 + Math.random() * 200),
                delay = 3000 + Math.random() * 6000,
                wrapper = $('.notifications');
            wrapper.find('[data-name]').text(name);
            wrapper.find('[data-image]').addClass('shake');
            setTimeout(function () {
                wrapper.find('[data-image]').removeClass('shake');
            }, 1000);
            wrapper.find('[data-image]').attr('src', image);
            wrapper.find('[data-amount]').text(amount);
            wrapper.find('[data-amount]').addClass('shake');
            setTimeout(function () {
                wrapper.find('[data-amount]').removeClass('shake');
            }, 1000);
            wrapper.find('[data-visitor-currency-symbol]').addClass('shake');
            setTimeout(function () {
                wrapper.find('[data-visitor-currency-symbol]').removeClass('shake');
            }, 1000);
            setTimeout(function () {
                rotateNotifications(peopleArray);
            }, delay);
        }

        function generateLiveResultsTableContent(peopleArray, currencySymbol) {
            var currenciesArray = ["LTC/EOS", "ETH/LTC", "BTC/ETH", "EOS/ETH"],
                index = Math.floor(Math.random() * peopleArray.length),
                name = peopleArray[index].name + ' ' + peopleArray[index].surname.charAt(0) + '.',
                amount = Math.floor(50 + Math.random() * 200),
                randomCurrencyIndex = Math.floor(Math.random() * 3) + 1,
                randomCurrency = currenciesArray[randomCurrencyIndex];

            var today = new Date(),
                dd = today.getDate(),
                mm = today.getMonth() + 1,
                yyyy = today.getFullYear();
            if (mm < 10) {
                mm = '0' + mm;
            }
            if (dd < 10) {
                dd = '0' + dd;
            }
            var todaysDate = dd + '/' + mm + '/' + yyyy;

            var allTrs = $('.tbody').children();
            var lastTr = $(allTrs[allTrs.length - 1]);
            var preLastTr = $(allTrs[allTrs.length - 2]);
            var td1 = '<td class="bold">' + name + " just won trade...</td>";
            var td2 = '<td class="bold">' + currencySymbol + amount + "</td>";
            var td3 = '<td class="trade-time-td padding-left-td">' + todaysDate + "</td>";
            var td4 = '<td>' + randomCurrency + '</td>';
            var td5 = '<td><img src="img/tick.png" alt="tick"></td>';
            var newTr = $('<tr/>');
            newTr.append(td1);
            newTr.append(td2);
            newTr.append(td3);
            newTr.append(td4);
            newTr.append(td5);
            $('.tbody').prepend(newTr);
            lastTr.remove();
            preLastTr.children('td').addClass('last-td');
        }

        //TODO Rename the functions
        function fillLiveResultsTable(peopleArray, currencySymbol) {
            var delay = 3000 + Math.random() * 6000;
            //TODO Rename the functions
            generateLiveResultsTableContent(peopleArray, currencySymbol);

            setTimeout(function () {
                fillLiveResultsTable(peopleArray, currencySymbol);
            }, delay);
        }

        function initUiFlags(projectDetailsResponse) {
            var currencySymbol = "$";
            var countryIso = projectDetailsResponse.data.client.location.countryIsoCode ? projectDetailsResponse.data.client.location.countryIsoCode.toLowerCase() : null;
            var country = projectDetailsResponse.data.client.location.country ? projectDetailsResponse.data.client.location.country : null;
            var countryColors = {
                "AT": ['#ed2939', '#ed2939'],
                "AU": ['#00008b', '#ff0000'],
                "CH": ['#ff0000', '#ff0000'],
                "DE": ['#000000', '#dd0000'],
                "DK": ['#c60c30', '#c60c30'],
                "GB": ['#ff0000', '#00008b'],
                "IE": ['#169b62', '#ff883e'],
                "IT": ['#009246', '#ce2b37'],
                "NL": ['#ae1c28', '#21468b'],
                "NO": ['#ef2b2d', '#002868'],
                "NZ": ['#00247d', '#cc142b'],
                "SE": ['#006aa7', '#fecc00'],
                "ZA": ['#FFB612', '#007A4D'],
            };

            switch (projectDetailsResponse.data.client.location.countryIsoCode ? projectDetailsResponse.data.client.location.countryIsoCode : null) {
                case"GB":
                    currencySymbol = "£";
                    break;
                case"AT":
                case"DE":
                case"CH":
                case"NL":
                case"FR":
                case"ES":
                case"IT":
                case"SE":
                case"DK":
                case"NO":
                case"FI":
                    currencySymbol = "€";
                    break;
                case"ZA":
                    currencySymbol = "R";
                    break;
                default:
                    currencySymbol = "$";
            }
            $("[data-visitor-currency-symbol]").text(currencySymbol);

            $.ajax({
                method: 'head',
                url: 'flags/special/' + countryIso + '.png',
                success: function () {
                    $('.flag')
                        .css("height", "auto")
                        .css("border", "none")
                        .attr("src", 'flags/special/' + countryIso + '.png');
                },
                error: function () {
                    $('.flag')
                        .css("width", "80px")
                        .css("height", "auto")
                        .css("border", "none")
                        .attr("src", 'flags/4x3/' + countryIso + '.svg');
                }
            });


            $('.country-name-custom').each(function () {
                var obj = $(this);
                var countryIsoUpper = countryIso.toUpperCase();
                if (countryColors.hasOwnProperty(countryIsoUpper)) {
                    var words = country.split(/ (.+)/);
                    if (words.length < 2) {
                        words[0] = country.substring(0, country.length / 2);
                        words[1] = country.substring(country.length / 2);
                    } else {
                        words[0] += ' ';
                    }
                    $('<span/>').css('color', countryColors[countryIsoUpper][0]).text(words[0].toUpperCase()).appendTo(obj);
                    $('<span/>').css('color', countryColors[countryIsoUpper][1]).text(words[1].toUpperCase()).appendTo(obj);
                } else {
                    obj.text(country);
                }
                $('.flag-wrapper').removeClass('hidden');
            });

            var url = "/uinames/api/?amount=50&ext",
                region = ['Great Britain', 'United Kingdom'].indexOf(country) > -1 ? 'England' : country;

            function initSocialProof(response) {
                $('#notifications').removeClass('hidden');
                rotateNotifications(response);
                $('.live-results-table tbody tr').each(function (e) {
                    generateLiveResultsTableContent(response, currencySymbol);
                });
                fillLiveResultsTable(response, currencySymbol);
            }

            $.ajax({
                type: "get",
                url: url + '&region=' + region,
                success: function (response) {
                    initSocialProof(response);
                },
                error: function (response) {
                    region = 'England';
                    $.ajax({
                        type: "get",
                        url: url + '&region=' + region,
                        success: function (response) {
                            initSocialProof(response);
                        },
                    });
                },
            });
        }

        var language = window.intgrtn.lookup("language");
        if (language) {
            window.intgrtnI18n.translateAll(language);
        }
    };
    (function (d) {
        if (window.intgrtn) {
            return;
        }
        var s = d.createElement("script");
        var date = new Date();
        s.async = true;
        s.src = "<?php echo $trackingUrl?>/api/v2/integration/app.js?v=1" + date.getFullYear().toString() + date.getMonth().toString() + date.getDate().toString() + date.getHours().toString() + Math.round(date.getMinutes() / 10).toString();
        d.getElementsByTagName("head")[0].appendChild(s);
    }(document));
    <!-- END intgrtn -->
</script>
