/*const sidebar = document.querySelector(".sidebar");
const sidebarClose = document.querySelector("#sidebar-close");
const menu = document.querySelector(".menu-content");
const menuItems = document.querySelectorAll(".submenu-item");
const subMenuTitles = document.querySelectorAll(".submenu .menu-title");
sidebarClose.addEventListener("click", () => sidebar.classList.toggle("close"));

menuItems.forEach((item, index) => {
  item.addEventListener("click", () => {
    menu.classList.add("submenu-active");
    item.classList.add("show-submenu");
    menuItems.forEach((item2, index2) => {
      if (index !== index2) {
        item2.classList.remove("show-submenu");
      }
    });
  });
});
subMenuTitles.forEach((title) => {
  title.addEventListener("click", () => {
    menu.classList.remove("submenu-active");
  });
});*/
 	const sidebar = document.querySelector(".sidebar");
   const sidebarClose = document.querySelector("#sidebar-close");
   const menu = document.querySelector(".menu-content");
	
   const menuItems = document.querySelectorAll(".submenu-item");
   const subMenuTitles = document.querySelectorAll(".submenu .menu-title");
	sidebarClose.addEventListener("click", function() {
  		 sidebar.classList.toggle("close");
	});
  const actives= document.querySelector(".show-submenu");
 
for (let i = 0; i < menuItems.length; i++) {
  let item=menuItems[i];
  let m=i;
  item.addEventListener("click", function() {
  menu.classList.add("submenu-active");
  actives.classList.remove('show-submenu');
  item.classList.add("show-submenu");
 
  if(m==0){
    menuItems[1].classList.remove('show-submenu');
  }
  if(m==1){
    menuItems[0].classList.remove('show-submenu');
  }
  
  /*for (let j = 0; j < menuItems.length; j++) {
      let item_2=menuItems[j];
      if (i != j) {
        item_2.classList.remove('show-submenu');
      }
      alert(item_2.classList)

    }*/
  });
}

for (let l = 0; l < subMenuTitles.length; l++) {
  subMenuTitles[l].addEventListener("click",function(){
    menu.classList.remove("submenu-active");
  });
  
}

function gotoPrerequis(){

  //(document.getElementsByClassName("main"))[0].style.backgroundColor="red";

 
    $(".main").load("produit.html"); 
  
}
function showMenu(){
  document.getElementById("myDropdown").classList.toggle("show");

}
function gotoPrincipal(){
  document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
