window.addEventListener('DOMContentLoaded', (event) => {
let container = document.querySelector('.tabgallery-container.js-id-00');
let navli = container.querySelectorAll('.tab-nav li.tab-li-item');
navli.forEach((n)=>{
n.addEventListener('click', function(e){
let x = this.closest(".tabgallery-container");
var z = this.parentNode.querySelector('.tab-nav li.active');
z.classList.remove('active');
this.classList.add('active');
let els = this.parentNode.children;
let num = [].indexOf.call(els, this) + 1;
x.setAttribute("data-tabgallery", num);
let remove1 = x.querySelectorAll('.media-wrap > *');
let remove2 = x.querySelectorAll('.tab-info-txt > *');
remove1.forEach((r) => {
if (r.classList.contains('visible')) {
r.classList.remove('visible');
}
});
remove2.forEach((r) => {
if (r.classList.contains('visible')) {
r.classList.remove('visible');
}
});
let add1 = x.querySelector(`.media-wrap > *:nth-child(${num})`)
if(add1) add1.classList.add('visible');
let add2 = x.querySelector(`.tab-info-txt > *:nth-child(${num})`)
if(add2) add2.classList.add('visible');
})
})
});