<footer class="footer text-center">
    <div class="container footer-container">
        <?php if ($cfl == true) {
            require_once __DIR__ . "/cfl.php";
        } else { ?>
            <ul class="footer-ul default-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>
        <?php } ?>
        <div data-intgrtn-agreements="" data-intgrtn-type="4" class="container"></div>
        <img src="" alt="logo" class="js-project-logo logo lazyload">
    </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="js/video.js"></script>
<script type="text/javascript" src="js/intgrtn-i18n.js?v=2"></script>
<script type="text/javascript" src="js/lazysizes.min.js" async=""></script>
<script>
    var cryptoCurrencyItem = "";
    var priceBlock = $('#btc-widget-price-block');

    $.ajax({
        url: "https://api.binance.com/api/v3/ticker/24hr?symbol=BTCUSDT",
        method: "GET"
    }).done(function (response) {
        // Directly assign the Binance response to match your variable structure
        cryptoCurrencyItem = {
            name: "btcusdt",
            latestPrice: parseFloat(response.lastPrice),
            changePercent: parseFloat(response.priceChangePercent),
            bidPrice: parseFloat(response.bidPrice),
            askPrice: parseFloat(response.askPrice)
        };

        // Price movement logic
        if (Math.sign(cryptoCurrencyItem.changePercent) > 0) {
            priceBlock.addClass('js-price-up').append('$ ' + cryptoCurrencyItem.latestPrice.toFixed(2) + ' ' + '&#129105;');
        } else {
            priceBlock.addClass('js-price-down').append('$ ' + cryptoCurrencyItem.latestPrice.toFixed(2) + ' ' + '&#129107;');
        }

        // Display bid and ask prices (no need to divide by 100 for Binance data)
        $('[data-init="bid-price"]').text(cryptoCurrencyItem.bidPrice.toFixed(2));
        $('[data-init="ask-price"]').text(cryptoCurrencyItem.askPrice.toFixed(2));
    });
</script>
<!-- BEGIN intgrtn -->
<script>
    window.availableLanguages = <?php echo json_encode(scandir(__DIR__ . '/../i18n')); ?> ;
    window.flowType = "<?php echo $lpType != null ? $lpType : "3steps"; ?>";

    window.intgrtnInit = function () {
        var wrapper = $('.testim-wrapper');
        var maleArray = [];
        var femaleArray = [];
        var cities = [];
        var path = "/";
        if (window.location.pathname.split("/")[1]) {
            path = "/" + window.location.pathname.split("/")[1] + "/";
        }
        window.intgrtn.setOptions({
            cookies: {
                path: path
            },
            forms: {
                signup: {
                    buttons: {
                        generatePassword: {
                            show: true,
                        },
                    },
                    fields: {
                        passwordConfirm: {
                            show: false,
                            required: false,
                        },
                    },
                }
            }
        });

        window.intgrtn.events.on("get.project.details.success", function (response) {
            $('.js-project-logo').attr({
                'src': response.data.project.softwareDashboardPageLogoPath,
                'alt': response.data.project.name,
            });

            $(document).prop('title', response.data.project.name);
            $('meta[name=description]').attr("content", response.data.project.name);
            if (!window.intgrtn.lookup("language")) {
                var language = response.data.client.location.countryIsoCode ? response.data.client.location.countryIsoCode.toLowerCase() : null;
                window.intgrtnI18n.translateAll(language, response.data.project.name);
            }

            $(".form-container").css("opacity", '1');
            initUiFlags(response);
        });

        function customFormSetupByWhitelabelId(form) {
            window.intgrtn.getProjectDetails(function (response) {
                $(form).find(".intgrtn-input-holder-password").css("display", "block");

                if (window.intgrtn.lookup("language") == "gr" || window.intgrtn.lookup("language") == "ro") {
                    $("body .video-form-section .video-header").css("font-size", "3.2rem")
                }
                if (window.intgrtn.lookup("language") == "ru") {
                    $(".open-free-account-btn").css("bottom", "-143px")
                }
                if (window.intgrtn.lookup("language") == "fr") {
                    $(".as-seen-on-wrapper h3").css("font-size", "1.3rem")
                }

                videojs('my-video', {"autoplay": true, "muted": true, "controls": true, "preload": "auto", "controlBar": true, "fluid": true, "poster": "img/videothumbnail.jpg"}).src({type: 'video/mp4', src: 'media/en-1.mp4'});
            });
        }

        window.intgrtn.events.on("parse.data.tags.form.signup-3-steps.success", function (form) {
            customFormSetupByWhitelabelId(form);
        });

        window.intgrtn.events.on("parse.data.tags.form.signup.success", function (form) {
            customFormSetupByWhitelabelId(form);
        });

        window.intgrtn.events.on("parse.data.tags.form.optin.success", function (form) {
            customFormSetupByWhitelabelId(form);
        });

        window.intgrtn.events.on('send.optin.request.success', function (response) {
            $('.gtd-form-step-1').addClass('hidden');
            var signupFormSelector = $('.gtd-form-step-2').removeClass('hidden');

            signupFormSelector.toArray().forEach(function (element) {
                window.intgrtn.generateSignupForm({}, element);
                <?php if ($lpType == "2steps") { ?>
                $('.intgrtn-input-holder-password').show();
                <?php } ?>
            });
        });

        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 = 5 * 60 + 31;

        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 rotateTestimonials(peopleArray) {
            let maleTestimonialContent = "";
            let femaleTestimonialContent = "";

            peopleArray.forEach(function (element) {
                if (element.gender == 'male') {
                    maleArray.push(element);
                } else if (element.gender == 'female') {
                    femaleArray.push(element);
                }
            })

            $(wrapper).toArray().forEach(function (testimonial, index) {
                let maleArrayIndex = Math.floor(Math.random() * maleArray.length);
                let femaleArrayIndex = Math.floor(Math.random() * femaleArray.length);

                if (window.intgrtn.lookup(`testimonialMale${index}`)) {
                    maleTestimonialContent = decodeURI(window.intgrtn.lookup(`testimonialMale${index}`));
                } else {
                    maleTestimonialContent = maleArray[maleArrayIndex].name + ' ' + maleArray[maleArrayIndex].surname.charAt(0) + '.';
                    window.intgrtn.store(`testimonialMale${index}`, encodeURIComponent(maleTestimonialContent));
                }
                $(testimonial).find('[data-male-name]').text(maleTestimonialContent);

                if (window.intgrtn.lookup(`testimonialFemale${index}`)) {
                    femaleTestimonialContent = decodeURI(window.intgrtn.lookup(`testimonialFemale${index}`));
                } else {
                    femaleTestimonialContent = femaleArray[femaleArrayIndex].name + ' ' + femaleArray[femaleArrayIndex].surname.charAt(0) + '.';
                    window.intgrtn.store(`testimonialFemale${index}`, encodeURIComponent(femaleTestimonialContent));
                }
                $(testimonial).find('[data-female-name]').text(femaleTestimonialContent);
            })

            window.intgrtn.getProjectDetails(function (response) {
                var country = response.data.client.location.country ? response.data.client.location.country : null;
                var countryIso = response.data.client.location.countryIsoCode ? response.data.client.location.countryIsoCode : null;
                let testimonialCountryContent = "";
                $.ajax({
                    type: "get",
                    url: "js/world-cities.json",
                    success: function (response) {
                        let currentCountryCityArray = response.filter(function (countryResponse) {
                            return countryResponse.country === country;
                        });

                        $(wrapper).toArray().forEach(function (testimonialWrapper, index) {
                            if (window.intgrtn.lookup(`citie${index}`)) {
                                testimonialCountryContent = decodeURI(window.intgrtn.lookup(`citie${index}`));
                            } else {
                                testimonialCountryContent = currentCountryCityArray[Math.floor(Math.random() * currentCountryCityArray.length)].name;
                                window.intgrtn.store(`citie${index}`, encodeURIComponent(testimonialCountryContent));
                            }
                            $(testimonialWrapper).find('[data-current-city]').text(testimonialCountryContent);
                            $(testimonialWrapper).find('[data-current-country]').text(countryIso);
                        });
                    }
                });
            })
        }

        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>' + name + " just won trade</td>";
            var td2 = '<td>' + 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');
        }

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

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

        function initUiFlags(projectDetailsResponse) {
            var currencySymbol = projectDetailsResponse.data.client.location.currency.symbol ? projectDetailsResponse.data.client.location.currency.symbol : "$";
            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'],
                "BE": ['#000000', '#fdda24'],
                "CA": ['#ff0000', '#ff0000'],
                "CH": ['#ff0000', '#ff0000'],
                "CL": ['#0036a7', '#d62718'],
                "CZ": ['#d7141a', '#11457e'],
                "DE": ['#000000', '#dd0000'],
                "DK": ['#c60c30', '#c60c30'],
                "FI": ['#003580', '#003580'],
                "FR": ['#0050a4', '#ef4135'],
                "GA": ['#4997d0', '#4997d0'],
                "GB": ['#ff0000', '#00008b'],
                "GR": ['#001489', '#001489'],
                "IE": ['#169b62', '#ff883e'],
                "IT": ['#009246', '#ce2b37'],
                "MY": ['#1534cb', '#59292e'],
                "MX": ['#006847', '#ce1126'],
                "NL": ['#ae1c28', '#21468b'],
                "NO": ['#ef2b2d', '#002868'],
                "NZ": ['#00247d', '#cc142b'],
                "PH": ['#0038a8', '#ce1126'],
                "PK": ['#01411c', '#01411c'],
                "PL": ['#ff0000', '#ff0000'],
                "SE": ['#006aa7', '#fecc00'],
                "SG": ['#ee2536', '#ee2536'],
                "SK": ['#034da3', '#ef1620'],
                "ZA": ['#FFB612', '#007A4D']
            };

            $("[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);
                rotateTestimonials(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 () {
                    region = 'England';
                    $.ajax({
                        type: "get",
                        url: url + '&region=' + region,
                        success: function (response) {
                            initSocialProof(response);
                        },
                    });
                },
            });
        }

        var language = window.intgrtn.lookup("language");
        if (language) {
            window.intgrtn.getProjectDetails(function (response) {
                window.intgrtnI18n.translateAll(language, response.data.project.name);
            });
        }
    };
    (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>
