$(document).ready(function () {
    $('.HomeSlider').slick({
        dots: true,
        autoplay: true,
        arrows: true,
        infinite: true,
        fade: true,
        speed: 300,
        slidesToShow: 1,
        slidesToScroll: 1
    });
    $('.HomeSlider .slick-dots li').html('<div></div>')

    $('.ShopSlider').slick({
        dots: true,
        autoplay: true,
        arrows: true,
        infinite: true,
        fade: true,
        speed: 300,
        slidesToShow: 1,
        slidesToScroll: 1
    });
    $('.ShopSlider .slick-dots li').html('<div></div>')

    $('.CoursesSlider').slick({
        dots: true,
        autoplay: true,
        arrows: true,
        infinite: true,
        fade: true,
        speed: 300,
        slidesToShow: 1,
        slidesToScroll: 1
    });
    $('.CoursesSlider .slick-dots li').html('<div></div>')

    setTimeout(function (){
        if(!$('.PreloaderInner').hasClass('animate__fadeOutUp')){
            $('.PreloaderInner').addClass('animate__fadeOutUp')
        }
    },10000)
});

$(window).on('load',function (){
    $('.PreloaderInner').addClass('animate__fadeOutUp')

    $('#HomeBtn').click()
});

$(window).on('resize',function (){

});

function NavBar(el){
    el.parent().find('button').removeClass('ActiveNavBar')
    el.addClass('ActiveNavBar')
    $('.MainView').hide()
    $(el.attr('rel')).show()
    $('.SideMenu').fadeOut(500)
}

function ShowStory(){
    $('.Story').show()
    $('.Story video')[0].play()
}

function CloseStory(){
    $('.Story').hide()
    $('.Story video').trigger('pause')
}

function SideMenuClicker(el){
    var Target = $(el.attr('rel'))
    $('.MainView').hide()
    Target.show()
    $('.NavbarInner button').removeClass('ActiveNavBar')
    $('.SideMenu').fadeOut(500)
}

function Increase(el){
    if(el.find('i').hasClass('fa-plus')){
        var Status = 2;
    }else{
        var Status = 3;
    }

    if(Status == 2){
        el.parent().find('input').val(parseInt(el.parent().find('input').val())+1)
    }else{
        if(el.parent().find('input').val() != 1){
            el.parent().find('input').val(parseInt(el.parent().find('input').val())-1)
        }
    }
}

function ShowChat(){
    $('.NavbarInner button').removeClass('ActiveNavBar')
    $('.MainView').hide()
    $('#Chat').show()
    setTimeout(function (){
        $('.ChatItem').first().show()
        $('#ChatPopUpSound')[0].play()
    },1000)
    setTimeout(function (){
        $('.ChatItem').last().show()
        $('#ChatPopUpSound')[0].play()
    },2500)

}

function toggleFullScreen() {
    if (!document.fullscreenElement &&    // alternative standard method
        !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) {  // current working methods
        if (document.documentElement.requestFullscreen) {
            document.documentElement.requestFullscreen();
        } else if (document.documentElement.msRequestFullscreen) {
            document.documentElement.msRequestFullscreen();
        } else if (document.documentElement.mozRequestFullScreen) {
            document.documentElement.mozRequestFullScreen();
        } else if (document.documentElement.webkitRequestFullscreen) {
            document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
        }
    } else {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitExitFullscreen) {
            document.webkitExitFullscreen();
        }
    }
}