import AMenu from '/js/libs/js-AMenu.js'
import AOverScroll from '/js/ext_libs/js-AOverScroll.js'
window.isLoad_Menu = false;
function createFHeader() {
    var h = document.createElement("div");
    h.setAttribute("id", "fHeader");
    h.classList.add("f-header");
    var r = document.querySelector("#header");
    r.childNodes.forEach(el => {
        h.appendChild(el.cloneNode(true));
    });
    document.body.insertBefore(h, document.body.children[0]);
}
window.Load_Menu = function () {
    window.isLoad_Menu = true;
    var asyncStyleSheets = [
        'https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap'
    ];
    window.app.loadCSS(asyncStyleSheets);
    //a1.on("itemClick", (el, e) => {
    //    window.app.initNavApp(el);
    //});
    window.app.on("redirect_page", (e) => {
        a1.changeActive();
    });
    createFHeader();
    var hHeader = document.getElementById("header").clientHeight;
    var ov = new AOverScroll();
    window.app.initScrollBar((scrollY) => {
        if (scrollY > hHeader && !fHeader.classList.contains("show")) {
            fHeader.classList.add("show");
        }
        if (scrollY < hHeader && fHeader.classList.contains("show")) {
            fHeader.classList.remove("show");
        }
    });
    var a1 = new AMenu(".nav-mainmenu", ".nav-mainmenu", true, document.querySelector(".m-navbar > .ico-menu"));


  
  
  //  var a2 = new AMenu("#fHeader .nav-mainmenu");
}
window.AScript.set("asyncLayout", true);