var cb = function() {
    'use strict';

    var l = document.createElement('link'),
        h = document.getElementsByTagName('head')[0];
        // oldIE =document.all && !document.addEventListener;

        l.rel = 'stylesheet';
        l.href = '/wp-content/themes/biuro/css/main.min.css';
        // l.href = (oldIE) ? 'mysite/css/main-fixed.css' : 'mysite/css/main-responsive.css';

    h.parentNode.insertBefore(l, h);
},
raf = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;

if (raf) {
    raf(cb);
} else {
    if (window.addEventListener) {
        window.addEventListener('load', cb);
    } else {
        window.attachEvent('onload', cb);
    }
}

(global => {
    const container = document.getElementById('cookie-warning');
    const btnAgree = document.getElementById('cookie-agree');
    const btnClose = document.getElementById('cookie-close');
    const agreed = (useLS()) ? localStorage.getItem('biuro-agree') : false;

    function useLS () {
        var mod = 'a';
        try {
            localStorage.setItem(mod, mod);
            localStorage.removeItem(mod);
            return true;
        } catch (e) {
            return false;
        }
    }

    if (!container || !btnAgree || !btnClose || agreed) {
        return;
    }

    container.style.display = 'block';

    btnAgree.addEventListener('click', () => {
        if (useLS()) {
            localStorage.setItem('biuro-agree', 'true');
        }
        container.style.display = 'none';
    });

    btnClose.addEventListener('click', () => {
        container.style.display = 'none';
    });
})(window);

console.log('here goes main I');

// console.log('here goes main II');
// console.log('here goes main III');
