
// // <!--slick slider-->
$(".responsive").slick({
    infinite: false,
    speed: 900,
    slidesToShow: 3,
    slidesToScroll: 3,  // Adjusted value to match slidesToShow
    centerMode: false,
    variableWidth: false,
    responsive: [{
        breakpoint: 480,
        settings: {
            speed: 300,
            slidesToShow: 1,
            slidesToScroll: 1,  // Adjusted value to match slidesToShow
            variableWidth: true,
        },
    }],
});


$(".responsive1").slick({
    infinite: false,
    speed: 900,
    slidesToShow: 3,
    slidesToScroll: 3,  // Adjusted value to match slidesToShow
    centerMode: false,
    variableWidth: false,
    responsive: [{
        breakpoint: 480,
        settings: {
            speed: 300,
            slidesToShow: 1,
            slidesToScroll: 1,  // Adjusted value to match slidesToShow
            variableWidth: true,
        },
    }],
});
// // <!--slick slider close-->




// <!--dropdown-->
var x, i, j, l, ll, selElmnt, a, b, c, dc;
/*look for any elements with the class "custom-select":*/
x = document.getElementsByClassName("custom-select1");
dc = document.getElementsByClassName("select-selected");
l = x.length;
for (i = 0; i < l; i++) {
    selElmnt = x[i].getElementsByTagName("select")[0];
    ll = selElmnt.length;
    /*for each element, create a new DIV that will act as the selected item:*/
    a = dc[i]
    a.value = selElmnt.options[selElmnt.selectedIndex].innerHTML;
    /*for each element, create a new DIV that will contain the option list:*/
    b = document.createElement("DIV");
    b.setAttribute("class", "select-items select-hide");
    for (j = 1; j < ll; j++) {
        /*for each option in the original select element,
        create a new DIV that will act as an option item:*/
        c = document.createElement("DIV");
        c.innerHTML = selElmnt.options[j].innerHTML;
        c.addEventListener("click", function (e) {
            /*when an item is clicked, update the original select box,
            and the selected item:*/
            var y, i, k, s, h, sl, yl;
            s = this.parentNode.parentNode.getElementsByTagName("select")[0];
            sl = s.length;
            h = this.parentNode.previousElementSibling;
            for (i = 0; i < sl; i++) {
                if (s.options[i].innerHTML == this.innerHTML) {
                    s.selectedIndex = i;
                    h.value = this.innerHTML;
                    y = this.parentNode.getElementsByClassName("same-as-selected");
                    yl = y.length;
                    for (k = 0; k < yl; k++) {
                        y[k].removeAttribute("class");
                    }
                    this.setAttribute("class", "same-as-selected");
                    break;
                }
            }
            h.click();
        });
        b.appendChild(c);
    }
    x[i].appendChild(b);
    a.addEventListener("click", function (e) {
        /*when the select box is clicked, close any other select boxes,
        and open/close the current select box:*/
        e.stopPropagation();
        if (this.value == 'City') {
            this.value = ""
        }
        closeAllSelect(this);
        this.nextElementSibling.classList.toggle("select-hide");
        this.classList.toggle("select-arrow-active");
    });
    a.addEventListener("keyup", function (e) {
        let results = [], cities = this.nextElementSibling.children;
        for (let i = 0; i < cities.length; i++) {
            if (cities[i].textContent.toLowerCase().includes(e.target.value.toLowerCase())) {
                cities[i].style.display = 'block'
            } else {
                cities[i].style.display = 'none'
            }
        }
    })
}
function closeAllSelect(elmnt) {
    /*a function that will close all select boxes in the document,
    except the current select box:*/
    var x, y, i, xl, yl, arrNo = [];
    x = document.getElementsByClassName("select-items");
    y = document.getElementsByClassName("select-selected");
    xl = x.length;
    yl = y.length;
    for (i = 0; i < yl; i++) {
        if (elmnt == y[i]) {
            arrNo.push(i)
        } else {
            y[i].classList.remove("select-arrow-active");
        }
    }
    for (i = 0; i < xl; i++) {
        if (arrNo.indexOf(i)) {
            x[i].classList.add("select-hide");
        }
    }
}
/*if the user clicks anywhere outside the select box,
then close all select boxes:*/
document.addEventListener("click", (e) => {
    let y = document.getElementsByClassName("select-selected");
    for (let i = 0; i < y.length; i++) {
        let select = y[i].previousElementSibling
        y[i].value = select.options[select.selectedIndex].innerHTML
    }
    closeAllSelect(e.target);
});
// <!--dropdown close-->



// <!-- fixed footer-->
window.onscroll = function () {
    myFunction1();
    myFunction2();
}

var header1 = document.getElementById("myHeader1");
var header2 = document.getElementById("myHeader2");
var sticky1 = header1.offsetTop + header1.offsetHeight;
var sticky2 = header2.offsetTop + header2.offsetHeight;
var gridList4aElements = document.getElementsByClassName("grid-list4a");

// Combine queries for para2 and para3
var para2Header1 = document.querySelector(".header1 .para2");
var para3Header1 = document.querySelector(".header1 .para3");
var para2Header2 = document.querySelector(".header2 .para2");
var para3Header2 = document.querySelector(".header2 .para3");

function myFunction1() {
    if (window.pageYOffset > sticky1) {
        header1.classList.add("sticky1");
        para2Header1.style.display = 'none';
        para3Header1.style.display = 'none';
        for (var i = 0; i < gridList4aElements.length; i++) {
            gridList4aElements[i].style.gridTemplateColumns = "1FR 1FR 1FR 1FR";
        }
    } else {
        header1.classList.remove("sticky1");
        para2Header1.style.display = 'block';
        para3Header1.style.display = 'block';
        for (var i = 0; i < gridList4aElements.length; i++) {
            gridList4aElements[i].style.gridTemplateColumns = "1FR";
        }
    }
}

function myFunction2() {
    if (window.pageYOffset > sticky2) {
        header2.classList.add("sticky2");
        para2Header2.style.display = 'none';
        para3Header2.style.display = 'none';
    } else {
        header2.classList.remove("sticky2");
        para2Header2.style.display = 'block';
        para3Header2.style.display = 'block';
    }
}
// <!-- fixed footer close -->


// <!--faq-->
// var acc = document.getElementsByClassName("accordion1");
// var i;

// for (i = 0; i < acc.length; i++) {
//     acc[i].addEventListener("click", function () {
//         this.classList.toggle("active");
//         var panel1 = this.nextElementSibling;
//         if (panel1.style.maxHeight) {
//             panel1.style.maxHeight = null;
//         } else {
//             panel1.style.maxHeight = panel1.scrollHeight + "px";
//         }
//     });
// }
// <!--faq close-->
