// // get the first and second div elements
const firstDiv = document.querySelector('.chbs-main-content-step-1');
const secondDiv = document.querySelector('.chbs-main-navigation-default');

// add a click event listener to all buttons with the class 'chbs-button'
document.querySelectorAll('.chbs-button').forEach(button => {
  button.addEventListener('click', () => {
	  if (getComputedStyle(firstDiv).display === 'none') {
		  // if the first div is hidden, display the second div
		  secondDiv.style.display = 'block';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			  element.style.display = 'none';
		  });
		  document.getElementById("left-simulator").style.display = 'none';
		  document.getElementById("title-simulator").style.display = 'none';
		  document.getElementById("simulator").style.width = "100%";
		  /*document.getElementById("simulator").style.background = "white";*/
			
		} else {
		  // otherwise, hide the second div
		  secondDiv.style.display = 'none';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			element.style.display = 'block';
		  });
		  document.getElementById("left-simulator").style.display = 'block';
		  document.getElementById("title-simulator").style.display = 'block';
		  document.getElementById("simulator").style.width = "80%";
		  document.getElementById("left-simulator").style.padding = "0 20px";
		  /*document.getElementById("simulator").style.background = "linear-gradient(45deg, #bb16ee 0%,#53a4fd 100%)";*/
		}
	setTimeout(function(){
		if (getComputedStyle(firstDiv).display === 'none') {
		  // if the first div is hidden, display the second div
		  secondDiv.style.display = 'block';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			  element.style.display = 'none';
		  });
		  document.getElementById("left-simulator").style.display = 'none';
		  document.getElementById("title-simulator").style.display = 'none';
		  document.getElementById("simulator").style.width = "100%";
		  /*document.getElementById("simulator").style.background = "white";*/
			
		} else {
		  // otherwise, hide the second div
		  secondDiv.style.display = 'none';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			element.style.display = 'block';
		  });
		  document.getElementById("left-simulator").style.display = 'block';
		  document.getElementById("title-simulator").style.display = 'block';
		  document.getElementById("simulator").style.width = "80%";
		  document.getElementById("left-simulator").style.padding = "0 20px";
		  /*document.getElementById("simulator").style.background = "linear-gradient(45deg, #bb16ee 0%,#53a4fd 100%)";*/
		}
	},400);
	  setTimeout(function(){
		if (getComputedStyle(firstDiv).display === 'none') {
		  // if the first div is hidden, display the second div
		  secondDiv.style.display = 'block';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			  element.style.display = 'none';
		  });
		  document.getElementById("left-simulator").style.display = 'none';
		  document.getElementById("title-simulator").style.display = 'none';
		  document.getElementById("simulator").style.width = "100%";
		  /*document.getElementById("simulator").style.background = "white";*/
			
		} else {
		  // otherwise, hide the second div
		  secondDiv.style.display = 'none';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			element.style.display = 'block';
		  });
		  document.getElementById("left-simulator").style.display = 'block';
		  document.getElementById("title-simulator").style.display = 'block';
		  document.getElementById("simulator").style.width = "80%";
		  document.getElementById("left-simulator").style.padding = "0 20px";
		  /*document.getElementById("simulator").style.background = "linear-gradient(45deg, #bb16ee 0%,#53a4fd 100%)";*/
		}
	},1000);
	  setTimeout(function(){
		if (getComputedStyle(firstDiv).display === 'none') {
		  // if the first div is hidden, display the second div
		  secondDiv.style.display = 'block';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			  element.style.display = 'none';
		  });
		  document.getElementById("left-simulator").style.display = 'none';
		  document.getElementById("title-simulator").style.display = 'none';
		  document.getElementById("simulator").style.width = "100%";
		  /*document.getElementById("simulator").style.background = "white";*/
			
		} else {
		  // otherwise, hide the second div
		  secondDiv.style.display = 'none';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			element.style.display = 'block';
		  });
		  document.getElementById("left-simulator").style.display = 'block';
		  document.getElementById("title-simulator").style.display = 'block';
		  document.getElementById("simulator").style.width = "80%";
		  document.getElementById("left-simulator").style.padding = "0 20px";
		 /*document.getElementById("simulator").style.background = "linear-gradient(45deg, #bb16ee 0%,#53a4fd 100%)";*/
		}
	},1500);
	  
  });
});

document.addEventListener('DOMContentLoaded', function() {
document.querySelectorAll('.chbs-button').forEach(button => {
  button.addEventListener('click', () => {
	  if (getComputedStyle(firstDiv).display === 'none') {
		  
		  secondDiv.style.display = 'block';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			  element.style.display = 'none';
		  });
		  document.getElementById("left-simulator").style.display = 'none';
		  document.getElementById("title-simulator").style.display = 'none';
		  document.getElementById("simulator").style.width = "100%";
		  /*document.getElementById("simulator").style.background = "white";*/
			
		} else {
		  secondDiv.style.display = 'none';
		  document.querySelectorAll('.chbs-moving-content').forEach(element => {
			element.style.display = 'block';
		  });
		  document.getElementById("left-simulator").style.display = 'block';
		  document.getElementById("title-simulator").style.display = 'block';
		  document.getElementById("simulator").style.width = "80%";
		  document.getElementById("left-simulator").style.padding = "0 20px";
		  /*document.getElementById("simulator").style.background = "linear-gradient(45deg, #bb16ee 0%,#53a4fd 100%)";*/
		}
	  
  });
});
});

// optional: clear the event listeners when the page is unloaded
/*
window.addEventListener('unload', () => {
  document.querySelectorAll('.chbs-button').forEach(button => {
    button.removeEventListener('click');
  });
});*/
