<footer class="footer text-center app-footer">
    <div class="container">
        <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>
        <picture>
            <source srcset="img/logo_m.svg" media="(max-width: 767px)"/>
            <source srcset="img/logo_d.svg" media="(min-width: 768px)"/>
            <img src="data:image/gif;base64,R0lGODlhAQABAAAAADs=" alt="Bitcoin Buyer"/>
        </picture>
        <div data-intgrtn-agreements="" data-intgrtn-type="4" style="font-size: 12px; padding-top: 20px"></div>
    </div>
</footer>

<script>
    var usersgen_arr = [
        {"firstname": "Magdalene", "lastname": "Weihrauch", "photo": "img\/users\/de\/16.jpg"},
        {"firstname": "Hubertine", "lastname": "Ahrens", "photo": "img\/users\/de\/77.jpg"},
        {"firstname": "Wencke", "lastname": "Ga\u00dfner", "photo": "img\/users\/de\/7.jpg"},
        {"firstname": "Ann-Kathrin", "lastname": "Brunke", "photo": "img\/users\/de\/14.jpg"},
        {"firstname": "Henner", "lastname": "Offermann", "photo": "img\/users\/de\/58.jpg"},
        {"firstname": "Victor", "lastname": "Rieger", "photo": "img\/users\/de\/74.jpg"},
        {"firstname": "Arnd", "lastname": "Plath", "photo": "img\/users\/de\/83.jpg"},
        {"firstname": "Hartmut", "lastname": "Pape", "photo": "img\/users\/de\/24.jpg"},
        {"firstname": "Hans-G\u00fcnther", "lastname": "Weirich", "photo": "img\/users\/de\/49.jpg"},
        {"firstname": "Rolf-Dieter", "lastname": "Messer", "photo": "img\/users\/de\/35.jpg"},
        {"firstname": "Linda", "lastname": "Hartmann", "photo": "img\/users\/de\/22.jpg"},
        {"firstname": "Sigurd", "lastname": "Seger", "photo": "img\/users\/de\/95.jpg"},
        {"firstname": "Pero", "lastname": "Gerber", "photo": "img\/users\/de\/94.jpg"},
        {"firstname": "Rose-Marie", "lastname": "Glock", "photo": "img\/users\/de\/45.jpg"},
        {"firstname": "Heide", "lastname": "Heinke", "photo": "img\/users\/de\/81.jpg"},
        {"firstname": "Dogan", "lastname": "Lastname", "photo": "img\/users\/de\/11.jpg"},
        {"firstname": "\u00d6mer", "lastname": "Reindl", "photo": "img\/users\/de\/5.jpg"},
        {"firstname": "Isabel", "lastname": "Feil", "photo": "img\/users\/de\/73.jpg"},
        {"firstname": "Eberhard", "lastname": "Balke", "photo": "img\/users\/de\/52.jpg"},
        {"firstname": "Nadja", "lastname": "Philipp", "photo": "img\/users\/de\/15.jpg"},
    ];
</script>


<script src="js/app.js"></script>
<script src="js/calculator.min.js"></script>

<script>
    function todaysDate() {
        var currentDate = new Date();
        var today = currentDate.toLocaleDateString('en-GB', {year: 'numeric', month: 'numeric', day: 'numeric'});

        $('.today').html(today);
    }

    function randomTimes() {
        var currentDate = new Date();
        var today = currentDate.toLocaleDateString('en-GB', {year: 'numeric', month: 'numeric', day: 'numeric'});

        $('.today').html(today);

        $('.time').each(function (i, el) {
            var date = new Date();

            date.setHours(Math.random() * (date.getHours() - 1));
            date.setMinutes(Math.random() * 59);
            date.setSeconds(Math.random() * 59);

            $(el).html(date.toLocaleTimeString('en-GB'));
        });
    }

    $(function () {
        var $featuredMedia = $('#video');

        if ($featuredMedia.length > 0 && $(window).width() > 960) {
            (function () {
                var $window = $(window);

                var top = $featuredMedia.offset().top;
                var offset = Math.floor(top + $featuredMedia.outerHeight() / 2);

                $window.on('resize', function () {
                    top = $featuredMedia.offset().top;
                    offset = Math.floor(top + $featuredMedia.outerHeight() / 2);
                }).on('scroll', function () {
                    $featuredMedia.toggleClass('is-sticky', $window.scrollTop() > offset);
                });
            })();
        }
    });

    function startTimer(duration, dateDisplay, timeDisplay) {
        var timer = duration,
            minutes = void 0,
            seconds = void 0;

        setInterval(function () {
            minutes = parseInt(timer / 60, 10);
            seconds = parseInt(timer % 60, 10);

            minutes = minutes < 10 ? "0" + minutes : minutes;
            seconds = seconds < 10 ? "0" + seconds : seconds;

            timeDisplay.text(minutes + ":" + seconds);

            if (--timer < 0) {
                timer = duration;
            }
        }, 1000);

        dateDisplay.text(new Date().toLocaleDateString('en-GB'));
    }

    function addPixel(type) {
        if (typeof pixelObject !== 'undefined') {
            var p = pixelObject[type];
            if (p.length > 0) {
                for (var i = 0; i < p.length; i++) {
                    var pixelElement = '';

                    var tag = p[i].tag;
                    var url = p[i].url;

                    pixelElement += '<' + tag + ' src="' + url + '"';

                    if (tag === 'img' || tag === 'iframe') {
                        pixelElement += ' width="1px" height="1px" style="display: none">';
                    }

                    if (tag !== 'img') {
                        pixelElement += '></' + tag + '>';
                    }

                    $('.pixel').append(pixelElement);
                }
            }
        }
    }


    'use strict';

    var pwLength = 8;
    var pwArr = [];

    var CHAR_TYPE = {
        DIGIT: 0,
        UPPER: 1,
        LOWER: 2
    };

    function getRandomCharacter(charType) {
        var unicodeStart = void 0;
        var unicodeLength = void 0;

        switch (charType) {
            case CHAR_TYPE.DIGIT:
                unicodeStart = 48;
                unicodeLength = 10;
                break;
            case CHAR_TYPE.UPPER:
                unicodeStart = 65;
                unicodeLength = 26;
                break;
            case CHAR_TYPE.LOWER:
                unicodeStart = 97;
                unicodeLength = 26;
                break;
        }

        return String.fromCharCode(unicodeStart + Math.floor(Math.random() * unicodeLength));
    }

    function insertRandomCharacter(charType) {
        var randomCharacter = getRandomCharacter(charType);
        var done = false;

        while (!done) {
            var randomIndex = Math.floor(Math.random() * pwLength);

            if (pwArr[randomIndex] == null) {
                pwArr[randomIndex] = randomCharacter;
                done = true;
            }
        }
    }

    todaysDate();

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

</script>

<!-- BEGIN intgrtn -->
<script>
    window.intgrtnInit = function () {
        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,
                            text: "Generate",
                        },
                    },
                },
            },
        });

        window.intgrtn.events.on("get.project.details.success", function (response) {
            var player = videojs('my-video', {"controls": true, "autoplay": "any", "controlBar": true, "fluid": true, "preload": "metadata"});
            player.src({type: 'video/mp4', src: 'media/<?php echo $videoSRC ?>'});

            initUiFlags(response);
        });

        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'],
                "BG": ['#05ac20', '#fd1322'],
                "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);

            document.dispatchEvent(new CustomEvent("visitorsLocated", {
                detail: 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("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');
            });
        }

    };
    (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));
</script>
<!-- END intgrtn -->

<script>
    var rangeInputs = document.getElementsByClassName("custom-range-slider");
    var depositVal;
    var timeVal;
    var potPayout;
    var payoutEl = document.getElementsByClassName("payout-box__amount")[0];
    var tooltips = document.getElementsByClassName("current-value-box");
    var customCurrency = "$";

    var browserCheck = !(document.documentMode || /Edge\//.test(navigator.userAgent) || /Edg\//.test(navigator.userAgent) || /firefox/i.test(navigator.userAgent)); //coloring range track with different colors in these browsers done via css pesudo elements

    document.addEventListener('visitorsLocated', function (e) {
        customCurrency = e.detail;
    });

    document.addEventListener('DOMContentLoaded', initRangeColorTooltip);
    document.addEventListener('DOMContentLoaded', ieTooltips);

    function ieTooltips() {
        if (!document.documentMode) {
            for (i = 0; i < tooltips.length; i++) {
                tooltips[i].style.display = "block";
            }
        } else {
            console.log(tooltips, "noa");
            for (i = 0; i < tooltips.length; i++) {
                tooltips[i].style.display = "none";
            }
        }
    }

    // Color of left side of slider (before slider-thumb) - Initial coloring and tooltip initial position
    function initRangeColorTooltip() {
        for (i = 0; i < rangeInputs.length; i++) {
            if (browserCheck) {
                rangeInputs[i].style.background = 'linear-gradient(to right, #249e2c 0%, #249e2c ' + (rangeInputs[i].value - rangeInputs[i].min) / (rangeInputs[i].max - rangeInputs[i].min) * 100 + '%, rgba(36, 158, 44, 0.2) ' + (rangeInputs[i].value - rangeInputs[i].min) / (rangeInputs[i].max - rangeInputs[i].min) * 100 + '%, rgba(36, 158, 44, 0.2)';

            }
            rangeInputs[i].oninput = sliderColorAndTooltip;
            var currentValueBox = rangeInputs[i].nextElementSibling.getElementsByClassName("current-value-box__num")[0]
            var rangePercent = rangeInputs[i].value;
            currentValueBox.style.transform = "translateX(-50%)";
            currentValueBox.style.left = 100 / rangeInputs[i].max * rangePercent + "%";

            if (rangeInputs[i].classList.contains("calc-range__time__slider")) {
                currentValueBox.innerHTML = rangePercent + " days";
            } else {
                currentValueBox.innerHTML = customCurrency + rangePercent;
            }
        }
    }


    // Color of left side of slider (before slider-thumb) and tooltip with current value
    function sliderColorAndTooltip() {
        var currentValueBox = this.nextElementSibling.getElementsByClassName("current-value-box__num")[0]
        var rangePercent = this.value;
        if (browserCheck) {
            this.style.background = 'linear-gradient(to right, #249e2c 0%, #249e2c ' + (rangePercent - this.min) / (this.max - this.min) * 100 + '%, rgba(36, 158, 44, 0.2) ' + (rangePercent - this.min) / (this.max - this.min) * 100 + '%, rgba(36, 158, 44, 0.2) 100%)';
        }
        currentValueBox.style.transform = "translateX(-50%)";
        currentValueBox.style.left = 100 / this.max * rangePercent + "%";

        if (this.classList.contains("calc-range__time__slider")) {
            currentValueBox.innerHTML = rangePercent + " days";
        } else {
            currentValueBox.innerHTML = customCurrency + rangePercent;
        }
    }

    // Deposit (input field >> range slider)
    function inputDeposit() {
        var days = document.getElementById("currency").value
        document.getElementsByClassName("calc-range__deposit__slider")[0].value = days;
        initRangeColorTooltip()
        potentialPayout();
    }

    // Deposit (range slider >> input field)
    function sliderDeposit(e) {
        var deposit = e.value;
        document.getElementById("currency").value = deposit;
        potentialPayout();
    }

    // TIME-OF-USAGE (input field >> range slider)
    function inputDays() {
        var days = document.getElementById("time-unit-days").value
        document.getElementsByClassName("calc-range__time__slider")[0].value = days;
        initRangeColorTooltip()
        potentialPayout();
    }

    // TIME-OF-USAGE (range slider >> input field)
    function sliderDays(e) {
        var days = e.value;
        document.getElementById("time-unit-days").value = days;
        potentialPayout();
    }

    // Potential Patout Output
    function potentialPayout() {
        depositVal = document.getElementsByClassName("calc-range__deposit__slider")[0].value;
        timeVal = document.getElementsByClassName("calc-range__time__slider")[0].value;
        potPayout = depositVal * timeVal / 30; /// FORMULA GOES HERE! ///
        potPayout = Math.round(potPayout).toLocaleString();
        // potPayout = potPayout.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");  //regex for thousands separators
        payoutEl.innerHTML = customCurrency + potPayout;
    }
</script>
