
 const swiper = new Swiper(".mySwiper", {
  slidesPerView: 7,      
  spaceBetween: 30,     
  loop: false,           
  pagination: {
    el: ".swiper-pagination",
    clickable: true,    
  },
  breakpoints: {
    // when window width is >= 320px
    320: {
      slidesPerView: 1,
      spaceBetween: 10
    },
    // when window width is >= 480px
    480: {
      slidesPerView: 2,
      spaceBetween: 15
    },
    // when window width is >= 640px
    640: {
      slidesPerView: 3,
      spaceBetween: 20
    },
    768: {
      slidesPerView: 4,
      spaceBetween: 20
    },
    1024: {
      slidesPerView: 5,
      spaceBetween: 20
    },
    1200: {
      slidesPerView: 7,
      spaceBetween: 20
    }
  }
});
 const swiper_organize = new Swiper(".organize_slider", {
  slidesPerView: 1,      
  // spaceBetween: 30,     
  loop: true,           
  pagination: {
    el: ".swiper-pagination",
    clickable: true,    
  },
    navigation: {
          nextEl: ".swiper-button-next",
          prevEl: ".swiper-button-prev",
        }
  
});

  // =========================
  // Translation
let card_game_Ar=document.getElementById("card_game_Ar")
let card_game_en=document.getElementById("card_game_en")
let mobile_Ar=document.getElementById("mobile_Ar")
let mobile_en=document.getElementById("mobile_en")
let cosplay_Ar=document.getElementById("cosplay_Ar")
let cosplay_en=document.getElementById("cosplay_en")
let ticketing_btn_en=document.getElementById("ticketing_bnt_en")
let ticketing_ar=document.getElementById("ticketing_ar")
let ticketing_btn1=document.getElementById("ticketing_btn1")
let ticketing_section_ar=document.getElementById("ticketing_section_ar")
let ticketing_section=document.getElementById("ticketing_section")
let vr_section=document.getElementById("vr_section_p")
let vr_section_en=document.getElementById("vr_section_en_p")
let casual_av_ar=document.getElementById("casual_av_ar")
let casual_en=document.getElementById("casual_en")
let hero_en=document.getElementById("hero_en")
let hero_ar=document.getElementById("hero_ar")
let Vr_zone_en=document.getElementById("Vr_zone_en")
let Vr_zone_AR=document.getElementById("Vr_zone_AR")
let playable_games_title=document.getElementById("playable_games_title")
let esports_title=document.getElementById("esports_title")
let e_sport_btn=document.getElementById("e_sport_btn")
let Ar_flag=true

function changeLanguage(lang) {
  console.log("function")


    if(lang === 'ar') {
      Ar_flag=true
        card_game_en.classList.add("hidden1")
        card_game_Ar.classList.remove("hidden1")
        mobile_en.classList.add("hidden1")
        mobile_Ar.classList.remove("hidden1")
        cosplay_en.classList.add("hidden1")
        cosplay_Ar.classList.remove("hidden1")
        ticketing_btn_en.classList.add("hidden1")
        ticketing_ar.classList.remove("hidden1")
        ticketing_section_ar.classList.remove("hidden1")
        ticketing_section.classList.add("hidden1")
        vr_section_en.classList.add("hidden1")
        vr_section.classList.remove("hidden1")
        casual_av_ar.classList.remove("hidden1")
        casual_en.classList.add("hidden1")
        hero_ar.classList.remove("hidden1")
        hero_en.classList.add("hidden1")
        Vr_zone_AR.classList.remove("hidden1")
        Vr_zone_en.classList.add("hidden1")
        ticketing_btn1.innerHTML=" ticketing"
         esports_title.classList.add("En_font")
         e_sport_btn.classList.add("En_font")
          playable_games_title.innerHTML="الألعاب المتاحه"
         esports_title.innerHTML=" بطولات الرياضات الالكترونية"
         e_sport_btn.innerHTML="احجز الان"
        ticketing_btn1.innerHTML="احجز الان"

          e_sport_btn.onclick=function()
           {
            location.href =  "#ticketing_section_ar"
           }
           document.querySelector(".en_lang").classList.remove("colored")
        document.querySelector(".en_lang1").classList.remove("colored")
        document.querySelector(".ar_lang").classList.add("colored")
        document.querySelector(".ar_lang1").classList.add("colored")



  } else {
    Ar_flag=false
    card_game_en.classList.remove("hidden1")
        card_game_Ar.classList.add("hidden1")
        mobile_en.classList.remove("hidden1")
        mobile_Ar.classList.add("hidden1")
        cosplay_en.classList.remove("hidden1")
        cosplay_Ar.classList.add("hidden1")
        ticketing_btn_en.classList.remove("hidden1")
        ticketing_ar.classList.add("hidden1")
        ticketing_section_ar.classList.add("hidden1")
        ticketing_section.classList.remove("hidden1")
         vr_section_en.classList.remove("hidden1")
        vr_section.classList.add("hidden1")
         casual_av_ar.classList.add("hidden1")
        casual_en.classList.remove("hidden1")
         hero_ar.classList.add("hidden1")
        hero_en.classList.remove("hidden1")
         Vr_zone_AR.classList.add("hidden1")
        Vr_zone_en.classList.remove("hidden1")
         playable_games_title.classList.add("En_font")
         esports_title.classList.add("En_font")
         e_sport_btn.classList.add("En_font")
         e_sport_btn.classList.remove("En_font")
        ticketing_btn1.innerHTML="Ticketing"       
          playable_games_title.innerHTML=" PLAYABLE GAMES"
           esports_title.innerHTML="E-SPORTS TOURNAMENTS"
           e_sport_btn.innerHTML="BOOK NOW"
       
        document.querySelector(".en_lang").classList.add("colored")
        document.querySelector(".en_lang1").classList.add("colored")
        document.querySelector(".ar_lang").classList.remove("colored")
        document.querySelector(".ar_lang1").classList.remove("colored")

  }
}
 
document.querySelector(".en_lang").addEventListener("click", () => changeLanguage("en"));
document.querySelector(".en_lang1").addEventListener("click", () => changeLanguage("en"));
document.querySelector(".ar_lang").addEventListener("click", () => changeLanguage("ar"));
document.querySelector(".ar_lang1").addEventListener("click", () => changeLanguage("ar"));
// =========================
// ==========List Logic===============
let list_btn=document.getElementById("open_list")
let list =document.querySelector(".right_side_h")
let buttons = document.querySelectorAll(".right_side_h a");

buttons.forEach(button => {
  button.addEventListener("click", () => {
   list.classList.add("hidden")
  });
});
list_btn.onclick=function()
{
  
  list.classList.toggle("hidden")
}
let lastScrollTop = 0;

  window.addEventListener("scroll", function () {
    let scrollTop = window.pageYOffset || document.documentElement.scrollTop;

    if (scrollTop > lastScrollTop) {
       list.classList.add("hidden")

    } 

    lastScrollTop = scrollTop <= 0 ? 0 : scrollTop; 
  });
  // ======================= Organize Logic
 function openNewWindow(url) {
    // Opens a new tab with example.com, specifying dimensions
    window.open(url, "_blank");
  }
 e_sport_btn.onclick=function  ()
           {
            if(Ar_flag)
            location.href =  "#ticketing_section_ar"
          else
            location.href =  "#ticketing_section"
           }

 ticketing_btn1.onclick=function  ()
           {
            if(Ar_flag)
            location.href =  "#ticketing_section_ar"
          else
            location.href =  "#ticketing_section"
           }

 