//intialization plugins
$(document).ready(function () {
    //animation icon toggler of navbar
    $(`.navbar-toggler`).click(function() {
        $(`.navbar-toggler`).toggleClass(`active`);
    });
    // navbar-fixed-top
    $(function () {
        $(document).scroll(function () {
            var $nav = $(".navbar-fixed-top");
            $nav.toggleClass('scrolled', $(this).scrollTop() > $nav.height());
        });
    });
    //Wow intit
    wow = new WOW({
        boxClass: 'wow',
        animateClass: 'animated',
        offset: 200,
        mobile: true,
        live: false
    });
    wow.init();
    //fancybox
    $("[data-fancybox]").fancybox({
        selector: '[data-fancybox="images"]',
        // loop: true
    });
    //tooltip
    $(function () {
        $('[data-toggle="tooltip"]').tooltip();
    });
    /*Loading page */
    // $(window).on("load", function(){
    //     $(".loading-page")
    //     .fadeOut(2000 , function(){
    //         $("body").css("overflow" , "auto");
    //         $("this").fadeOut(1500 , function(){
    //             $(this).remove();
    //         });
    //     });
    // });  
});

//Swiper 
var swiper = new Swiper('.header .swiper_header', {
    // loop: true,
    speed: 900,
    slidesPerView: 1,
    spaceBetween: 0,
    // autoplay: {
    //     delay: 2500,
    // },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    pagination: {
        el: '.swiper-pagination',
        clickable: true
    },
});
var swiper = new Swiper('.disabled-sec .disabled_swiper', {
    // loop: true,
    speed: 900,
    slidesPerView: 1,
    spaceBetween: 0,
    // autoplay: {
    //     delay: 2500,
    // },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    pagination: {
        el: '.swiper-pagination',
        clickable: true
    },
});
var swiper = new Swiper('.gallery-sec .gallery_swiper', {
    loop: true,
    speed: 900,
    slidesPerView: 1,
    spaceBetween: 15,
    centeredSlides: true,
    // autoplay: {
    //     delay: 2500,
    // },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    pagination: {
        el: '.gallery-sec .swiper-pagination',
        clickable: true
    },
    breakpoints: {
        640: {
            slidesPerView: 2,
        },
        768: {
            slidesPerView: 3,
        },
        1024: {
            slidesPerView: 5,
        },
    }
});
var swiper = new Swiper('.statics-sec .statics_swiper', {
    // loop: true,
    speed: 900,
    slidesPerView: 1,
    spaceBetween: 0,
    // autoplay: {
    //     delay: 2500,
    // },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    pagination: {
        el: '.statics-sec .swiper-pagination',
        clickable: true
    },
    breakpoints: {
        640: {
            slidesPerView: 2,
        },
        1024: {
            slidesPerView: 3,
            allowTouchMove: false,
            preventClicks: false
        },
    }
});
var swiper = new Swiper('.feedback-sec .feedback_swiper', {
    // loop: true,
    speed: 900,
    slidesPerView: 1,
    spaceBetween: 15,
    // autoplay: {
    //     delay: 2500,
    // },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    pagination: {
        el: '.feedback-sec .swiper-pagination',
        clickable: true
    },
    breakpoints: {
        640: {
            slidesPerView: 2,
        },
        1024: {
            slidesPerView: 3,
        },
    }
});
var swiper = new Swiper('.partners-sec .partners_swiper', {
    // loop: true,
    speed: 900,
    slidesPerView: 1,
    spaceBetween: 15,
    // autoplay: {
    //     delay: 2500,
    // },
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },
    pagination: {
        el: '.partners-sec .swiper-pagination',
        clickable: true
    },
    breakpoints: {
        640: {
            slidesPerView: 2,
        },
        768: {
            slidesPerView: 5,
        },
        1024: {
            slidesPerView: 7,
        },
    }
});
var swiper = new Swiper('.vid_gallery_slider .swiper-container', {
    // slidesPerView: 2,
    spaceBetween: 0,
    // centeredSlides: true,
    speed: 1000,
    observer: true,
    observeParents: true,
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
    navigation: false,
    mousewheel: false,
    keyboard: true,
    autoplay: {
        delay: 5000,
    },
    loop: true,
    breakpoints: {
        0: {
            slidesPerView: 1,
        },
        480: {
            slidesPerView: 1,
        },
        787: {
            slidesPerView: 2,
        },
        991: {
            slidesPerView: 3,
        },
        1200: {
            slidesPerView: 4,
        }
    }
});

var swiper = new Swiper('.room_det_pg .main_slider .swiper-container', {
    slidesPerView: 1,
    spaceBetween: 20,
    centeredSlides: true,
    speed: 1500,
    pagination: false,
    mousewheel: true,
    loop: false, // Not recommended to enable!!!
    // longSwipesRatio: 0.01,
    // followFinger: false,
    // grabCursor: true, 
    // watchSlidesProgress: true,
    parallax: true,
    lazy: {
            loadPrevNext: true,
        },
    navigation: {
        nextEl: '.main_slider .swiper-button-next',
        prevEl: '.main_slider .swiper-button-prev',
    },
    mousewheel: false,
    keyboard: true,
    autoplay: {
        delay: 5000,
    },
    loop: true,
});

var swiper = new Swiper('.room_features_slider .swiper-container', {
    // slidesPerView: 2,
    spaceBetween: 30,
    // centeredSlides: true,
    speed: 1000,
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
    navigation: false,
    mousewheel: false,
    keyboard: true,
    autoplay: {
        delay: 5000,
    },
    loop: true,
    breakpoints: {
        0: {
            slidesPerView: 1,
        },
        480: {
            slidesPerView: 1,
        },
        787: {
            slidesPerView: 2,
        },
        991: {
            slidesPerView: 2,
        },
        1200: {
            slidesPerView: 2,
        }
    }
});

var swiper = new Swiper('.testimonials .swiper-container', {
    // slidesPerView: 2,
    spaceBetween: 30,
    centeredSlides: true,
    speed: 1000,
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    },
    navigation: false,
    mousewheel: false,
    keyboard: true,
    autoplay: {
        delay: 5000,
    },
    loop: true,
    breakpoints: {
        0: {
            slidesPerView: 1,
        },
        480: {
            slidesPerView: 1,
        },
        787: {
            slidesPerView: 2,
        },
        991: {
            slidesPerView: 2,
        },
        1200: {
            slidesPerView: 2,
        }
    }
});
/* ----------------------------------------------------------------
            [ 03- portfolio taps ]
-----------------------------------------------------------------*/
$('.portfolio .taps span').on('click', function () {
    $(this).addClass('active').siblings().removeClass('active');
    $(this).parents("li").addClass('active').siblings().find("span").removeClass('active');
})

/* ----------------------------------------------------------------
            [ 04 - portfolio mixitup ]
-----------------------------------------------------------------*/
$(document).ready(function () {
    var containerEl = document.querySelector('.portfolio .content');
    var mixer = mixitup(containerEl);
});


// fs_sm_theme , fs_md_theme , fs_lg_theme
function fs_sm_theme() {
    var body = document.getElementById("changeTheme");
    body.classList.add("fs_sm_theme");
    body.classList.remove("fs_md_theme", "fs_lg_theme");
    $('.fs_butn').removeClass('active');
    $('.fs_butn_sm').addClass('active');
}
function fs_md_theme() {
    var body = document.getElementById("changeTheme");
    body.classList.add("fs_md_theme");
    body.classList.remove("fs_sm_theme", "fs_lg_theme");
    $('.fs_butn').removeClass('active');
    $('.fs_butn_md').addClass('active');
}
function fs_lg_theme() {
    var body = document.getElementById("changeTheme");
    body.classList.add("fs_lg_theme");
    body.classList.remove("fs_md_theme", "fs_md_theme");
    $('.fs_butn').removeClass('active');
    $('.fs_butn_lg').addClass('active');
}


// DARK MODE THEME
// function to set a given theme/color-scheme
function setTheme(themeName) {
    localStorage.setItem('theme', themeName);
    document.documentElement.className = themeName;
}
// function to toggle between light and dark theme
function toggleTheme() {
    if (localStorage.getItem('theme') === 'theme-dark') {
        setTheme('theme-light');
    } else {
        setTheme('theme-dark');
    }
}
// Immediately invoked function to set the theme on initial load
(function () {
    if (localStorage.getItem('theme') === 'theme-dark') {
        setTheme('theme-dark');
        document.getElementById('slider').checked = false;
    } else {
        setTheme('theme-light');
      document.getElementById('slider').checked = true;
    }
})();



//Swiper 
// var swiper = new Swiper(' .swiper-container', {
//     loop: true,
//     speed: 900,
//     slidesPerView: 1,
//     spaceBetween: 15,
//     // autoplay: {
//     //     delay: 2500,
//     // },
//     navigation: {
//         nextEl: '.swiper-button-next',
//         prevEl: '.swiper-button-prev',
//     },
//     pagination: {
//         el: '.swiper-pagination',
//         clickable: true
//     },
//     breakpoints: {
//         640: {
//             slidesPerView: 2,
//             spaceBetween: 20,
//         },
//         768: {
//             slidesPerView: 3,
//             spaceBetween: 20,
//         },
//         1024: {
//             slidesPerView: 5,
//             spaceBetween: 20,
//         },
//     }
// });

