document.addEventListener('DOMContentLoaded', () => {
    var closed = true;

    $(window).on("load",function(){
       // $('#modalLoading').modal("hide");
    });

    window.addEventListener('beforeunload', function(e) {
        console.log("descargando ", e);
       // $('#modalLoading').modal("show");
    });


    $(document).ready(function () {
    /*  $('#modalLoading').modal("show");
        window.canCloseLoading = true;
        let timer = setInterval(() => {
            if (window.canCloseLoading) {
                $('#modalLoading').modal("hide");
            }
        }, 5000);*/
        var medContainerSidebar = $("#MedContainerSidebar");
        var options = $("span.d-none");
        $("#btn-navbar-responsive").click(function () {
            if (closed) {
                medContainerSidebar.show("fast", () => {
                    medContainerSidebar.removeClass("col-auto");
                    medContainerSidebar.addClass("col-12");
                    for (let option of options) {
                        option.className = option.className.replace("d-none", "");
                    }
                });
            } else {
                medContainerSidebar.hide("fast", () => {
                    medContainerSidebar.removeClass("col-6");
                    medContainerSidebar.addClass("col-auto");
                    for (let option of options)
                        option.className = " d-none " + option.className
                });
            }
            closed = (!closed);
        });
    }); 
});