<footer class="footer text-center">
    <div class="container container-custom">
        <ul class="footer-ul">
            <li><a href="#" class="scroll-to-form">Home</a></li>
            <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" style="font-size: 12px; padding-top: 20px"></div>
    </div>
</footer>
<script src="js/jquery-3.6.0.js"></script>
<script src="js/ion.rangeSlider.min.js"></script>
<script src="js/swiper-bundle.min.js"></script>
<script src="js/video.js"></script>


<script type="text/javascript">
    var swiper = new Swiper('.swiper-container', {
        slidesPerView: 1,
        spaceBetween: 30,
        loop: true,
        navigation: {
            nextEl: '.swiper-next',
        },
    });
    start = new Date(2001, 0, 1)
    end = new Date()

    date = new Date();
    timezone = new Date().toString().match(/([A-Z]+[\+-][0-9]+)/)[1]
    y = date.getFullYear();
    m = date.getMonth() + 1;
    d = date.getDate();

    document.getElementById("date").innerHTML = y + "/" + m + "/" + d;

    function showTime() {
        date = new Date();
        h = date.getHours();
        m = date.getMinutes();
        s = date.getSeconds();


        h = (h < 10) ? "0" + h : h;
        m = (m < 10) ? "0" + m : m;
        s = (s < 10) ? "0" + s : s;

        var time = h + ":" + m + ":" + s + " ";
        document.getElementById("DigitalCLOCK").innerText = time;
        document.getElementById("DigitalCLOCK").textContent = time;

        setTimeout(showTime, 1000);
    }

    showTime();

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

</script>
<script>
    window.intgrtnInit = function () {
        var path = "/";
        if (window.location.pathname.split("/")[2]) {
            path = "/" + window.location.pathname.split("/")[1] + "/";
        }
        window.intgrtn.setOptions({
            cookies: {
                path: path
            },
            forms: {
                signup: {
                    buttons: {
                        generatePassword: {
                            show: true,
                            text: "Generate",
                        },
                    },
                },
            },
        });
        window.intgrtn.events.on("get.project.details.success", function (response) {
            initUiFlags(response);
        });

        function generateLiveResultsTableContent(peopleArray, currencySymbol) {
            var directionArray = ["CALL", "PUT"],
                index = Math.floor(Math.random() * peopleArray.length),
                name = peopleArray[index].name + ' ' + peopleArray[index].surname.charAt(0) + '.',
                investedAmount = Math.floor(50 + Math.random() * 200),
                profitAmount = Math.floor(50 + Math.random() * 200) + 200,
                randomDirectionIndex = Math.floor(Math.random() * 2),
                randomDirection = directionArray[randomDirectionIndex];

            var today = new Date();
            var dd = today.getDate();
            var mm = today.getMonth() + 1;
            var yyyy = today.getFullYear();

            if (mm < 10) {
                mm = '0' + mm;
            }
            if (dd < 10) {
                dd = '0' + dd;
            }
            var todaysDate = yyyy + '/' + mm + '/' + dd;

            var currentTime = new Date();
            var randomMinutes = Math.floor(Math.random() * 30);
            var randomTime = new Date(currentTime - randomMinutes * 60 * 1000);
            var pastHour = randomTime.getHours();
            var pastMinutes = (randomTime.getMinutes() < 10 ? '0' : '') + randomTime.getMinutes();


            var allTrs = $('.tbody').children();
            var lastTr = $(allTrs[allTrs.length - 1]);
            var preLastTr = $(allTrs[allTrs.length - 2]);
            var td1 = '<td class="active px-6 sm:px-3 py-4 whitespace-no-wrap border-b text-blue-900 border-gray-500 leading-5 text-lg sm:text-xs">' + name + '</td>';
            var td2 = '<td class="px-6 sm:px-3 py-4 whitespace-no-wrap border-b text-blue-900 border-gray-500 sm:text-xs leading-5 text-lg sm:hidden">' + randomDirection + '</td>';
            var td3 = '<td class="px-6 sm:px-3 py-4 whitespace-no-wrap border-b text-blue-900 border-gray-500 sm:text-xs leading-5 text-lg">' + currencySymbol + investedAmount + '</td>';
            var td4 = '<td class="px-6 sm:px-3 py-4 whitespace-no-wrap border-b text-blue-900 border-gray-500 sm:text-xs leading-5 text-lg sm:hidden">' + todaysDate + " " + pastHour + ":" + pastMinutes + '</td>';
            var td5 = '<td class="px-6 sm:px-3 py-4 whitespace-no-wrap border-b text-blue-900 border-gray-500 sm:text-xs leading-5 text-lg font-bold sm:hidden">ПРИБЫЛЬ</td>';
            var td6 = '<td class="px-6 sm:px-3 py-4 whitespace-no-wrap border-b text-blue-900 border-gray-500 sm:text-xs leading-5 text-lg font-bold">' + currencySymbol + profitAmount + '</td>';
            var newTr = $('<tr/>');
            newTr.append(td1);
            newTr.append(td2);
            newTr.append(td3);
            newTr.append(td4);
            newTr.append(td5);
            newTr.append(td6);

            $('.tbody').prepend(newTr);
            lastTr.remove();
            preLastTr.children('td').addClass('last-td');
        }


        function initUiFlags(projectDetailsResponse) {
            let currencySymbol = projectDetailsResponse.data.client.location.currency.symbol ? projectDetailsResponse.data.client.location.currency.symbol : "$";
            let countryIso = projectDetailsResponse.data.client.location.countryIsoCode ? projectDetailsResponse.data.client.location.countryIsoCode.toLowerCase() : null;
            let country = projectDetailsResponse.data.client.location.country ? projectDetailsResponse.data.client.location.country : null;
            let currentCity = projectDetailsResponse.data.client.location.city ? projectDetailsResponse.data.client.location.city : "";
            let currentSubDivision = projectDetailsResponse.data.client.location.subdivision ? projectDetailsResponse.data.client.location.subdivision : "";
            let cityLocaleNames = projectDetailsResponse.data.client.location.cityLocaleNames;
            let cityLocaleNamesArray = [];
            let currentCityLocaleName = "";
            let currentCityLocaleNameByIsoCode = "";
            let currentCityLocaleNameByLanguage = "";
            let language = window.intgrtn.lookup("language")

            if (currentCity === null || currentCity === undefined || currentCity === "") {
                currentCity = currentSubDivision;
            } else {
                cityLocaleNamesArray = Object.entries(cityLocaleNames).map(([isoCode, value]) => ({isoCode, value}));

                for (let i = 0; i < cityLocaleNamesArray.length; i++) {
                    if (cityLocaleNamesArray[i].isoCode === language) {
                        currentCityLocaleNameByLanguage = cityLocaleNamesArray[i].value;
                    }
                }

                for (let i = 0; i < cityLocaleNamesArray.length; i++) {
                    if (cityLocaleNamesArray[i].isoCode === countryIso) {
                        currentCityLocaleNameByIsoCode = cityLocaleNamesArray[i].value;
                    }
                }

                if (currentCityLocaleNameByLanguage === "") {
                    currentCity = currentCityLocaleNameByIsoCode;
                } else {
                    currentCity = currentCityLocaleNameByLanguage;
                }
            }

            $(".currentCity").text(currentCity);


            $("[data-visitor-currency-symbol]").text(currencySymbol);

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

            function initSocialProof(response) {
                $('.live-results-table').css('opacity', '1');
                $('.live-results-table tbody tr').each(function (e) {
                    generateLiveResultsTableContent(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);
                        },
                    });
                },
            });
            $(function () {
                $(".js-range-slider").ionRangeSlider({
                    skin: "round",
                    min: 10000,
                    max: 1000000,
                    from: 10000,
                    max_postfix: "+",
                    postfix: currencySymbol,
                    grid: true,
                    onStart: function (data) {
                        $("#calcResult").text(Math.round((data.from * 0.32) + data.from) + currencySymbol);
                    },
                    onChange: function (data) {
                        $("#calcResult").text(Math.round((data.from * 0.32) + data.from) + currencySymbol);
                    },
                });
            });
        }

    };


    (function (d) {
        if (window.intgrtn) {
            return;
        }
        var s = d.createElement("script");
        var date = new Date();
        s.src = "<?php echo $trackingUrl ?>/api/v2/integration/app.js?v=" + 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));
</script>
