| (function($) {
    const prefersDarkTheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
    var preferredTheme = ((prefersDarkTheme) ? 'dark' : 'light');
    var theme = getCookie('Theme');
    if (theme.length) {
        $('html').addClass(theme);
    }
    $(document).ready(function() {
        if (!(($('html').hasClass('dark')) || ($('html').hasClass('light')))) {
            // No theme set by cookie, set one according the visitor's preference
            $('html').addClass(preferredTheme);
        }
        $('#System, #Light, #Dark').click(function() {
            if ($(this).val() == 'system') {
                deleteCookie('Theme');
                $('html').removeClass('dark').removeClass('light').addClass(preferredTheme);
            }
            else {
                theme = $(this).val();
                $('html').removeClass('dark').removeClass('light').addClass(theme);
                var cookies = getCookie('Cookies_OK');
                if ((cookies == 'All') || (cookies.indexOf('Personalization') > -1)) {
                    setCookie('Theme', theme, 365);
                }
            }
        });
    });
}(jQuery));
function showPopup(code, width, height) {
    if (code.length) {
        $('#DarkBackground').css('display', 'block');
        $('#Content').html(code);
        setTimeout(function() {
            w = ((width > 0) ? width : $('#Content').innerWidth());
            h = ((height > 0) ? height : $('#Content').innerHeight());
            if ($(window).width() <= 1024) {
                $('#PopupWindow').css({
                    position: 'fixed',
                    top: '15px',
                    right: '15px',
                    bottom: '15px',
                    left: '15px',
                    marginLeft: 0,
                    marginTop: 0,
                    width: 'calc(100vw - 30px)',
                    height: 'calc(' + $(window).innerHeight() + ' - 30px)'
                });
            } else {
                w = ((w > ($(window).innerWidth() - 30)) ? ($(window).innerWidth() - 30) : w);
                h = ((h > ($(window).innerHeight() - 30)) ? ($(window).innerHeight() - 30) : h);
                $('#PopupWindow').css({
                    position: '',
                    top: '',
                    right: '',
                    bottom: '',
                    left: '',
                    marginLeft: '-' + (w / 2) + 'px',
                    marginTop: '-' + (h / 2) + 'px',
                    width: w,
                    height: h
                });
            }
            $('#PopupWindow').css('display', 'block');
        }, 100);
        if ($('#PopupWindow').outerHeight() == $(window).height()) {
            
        }
        disableScroll();
    }
}
function closePopup() {
    $('#PopupWindow, #DarkBackground').css('display', 'none').removeAttr('style');
    $('#Content').html('');
    enableScroll();
}
function disableScroll() {
    $('body').css('overflow', 'hidden');
}
function enableScroll() {
    $('body').removeAttr('style');
}
 |