
  $('.main-nav ul li:has(ul)').addClass('submenu');
  $('.main-nav ul li:has(ul)').append("<i></i>");
  $('.main-nav ul i').click(function() {
      $(this).parent('li').toggleClass('open');
      $(this).parent('li').children('ul').slideToggle();
  })


  $('#datepicker').datepicker({
    uiLibrary: 'bootstrap4'
});
// $('#datetimepicker1').datetimepicker({
//   language: 'pt-BR'
// });
// $('.datepicker').datepicker();

// Filter menu

$('.btn-filter,.x-close').on('click',function(){
    // $(this).preventDefault();
    $('.aside-bar-wrapp').toggleClass('aside-active');
})

  //Mobile Menu
  $('.mob-btn').click(function() {
      if (!$('html').hasClass('show-menu')) {
          $('html').addClass('show-menu');
      } else {
          $('html').removeClass('show-menu');
      }
  });

  $('.overlay').click(function() {
      if ($('html').hasClass('show-menu')) {
          $('html').removeClass('show-menu');
      }
  });
  // Slim Header
  var header = 0;
  function scrollHead() {
    if ($(document).scrollTop() > 5) {
      if (header == 0) {
        header = 1;
        $('html').addClass('slim');
      }
    } else {
      if (header == 1) {
        header = 0;
        $('html').removeClass('slim');
      }
    }
  }

  // Goto Top of the Page
  // $(function() {
  //   $(window).scroll(function() {
  //     // headerHeight();
  //     if ($(this).scrollTop() > 150) {
  //       $("#back-to-top").addClass("visible");
  //       $('.back-btn').addClass('visible');
  //     } else {
  //       $("#back-to-top").removeClass("visible");
  //       $('.back-btn').removeClass('visible');
  //     }
  //   });
  //   $("#back-to-top").click(function() {
  //     $("body,html").animate({
  //       scrollTop: 0
  //     }, 800);
  //     return false;
  //   });
  // });

  scrollHead();
  $(window).scroll(scrollHead);

  /*=========== DropDown Select  =========*/
(function() {
  x = document.getElementsByClassName("custom-drop-select");
  for (i = 0; i < x.length; i++) {
    selElmnt = x[i].getElementsByTagName("select")[0];
    a = document.createElement("DIV");
    a.setAttribute("class", "select-selected");
    a.innerHTML = selElmnt.options[selElmnt.selectedIndex].innerHTML;
    x[i].appendChild(a);
    b = document.createElement("DIV");
    b.setAttribute("class", "select-items select-hide");
    for (j = 1; j < selElmnt.length; j++) {
      c = document.createElement("DIV");
      c.className = "items";
      c.innerHTML = selElmnt.options[j].innerHTML;
      c.addEventListener("click", function(e) {
        var y, i, k, s, h;
        s = this.parentNode.parentNode.getElementsByTagName("select")[0];
        h = this.parentNode.previousSibling;
        for (i = 0; i < s.length; i++) {
          s.options[i].removeAttribute("selected", "selected");
        }
        for (i = 0; i < s.length; i++) {
          if (s.options[i].innerHTML == this.innerHTML) {
            // s.selectedIndex = i;
            s.value = this.innerHTML;
            s.options[i].setAttribute("selected", "selected");
            if (this.innerHTML.length > 25) {
              h.innerHTML = this.innerHTML.substring(0, 22);
              h.innerHTML = h.innerHTML + "..";
            } else {
              h.innerHTML = this.innerHTML;
            }
            y = this.parentNode.getElementsByClassName("same-as-selected");
            for (k = 0; k < y.length; 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) {
      e.stopPropagation();
      closeAllSelect(this);
      this.nextSibling.classList.toggle("select-hide");
      this.classList.toggle("select-arrow-active");
    });
  }

  function closeAllSelect(elmnt) {
    var x,
      y,
      i,
      arrNo = [];
    x = document.getElementsByClassName("select-items");
    y = document.getElementsByClassName("select-selected");
    for (i = 0; i < y.length; i++) {
      if (elmnt == y[i]) {
        arrNo.push(i);
      } else {
        y[i].classList.remove("select-arrow-active");
      }
    }
    for (i = 0; i < x.length; i++) {
      if (arrNo.indexOf(i)) {
        x[i].classList.add("select-hide");
      }
    }
  }
  document.addEventListener("click", closeAllSelect, { passive: false });
})();


var loc = window.location.href;
var loc_spl = loc.split('/');
if(loc_spl[loc_spl.length-1] == '' || loc_spl[loc_spl.length-1] == 'index.html' || loc_spl[loc_spl.length-1] == 'about-us.html'){
   $('.rz-header').addClass('home-header');
}
else if(loc_spl[loc_spl.length-1] == 'newpage-1.html' || loc_spl[loc_spl.length-1] == 'newpage-2.html' || loc_spl[loc_spl.length-1] == 'newpage-3.html'){
  $('.rz-header').addClass('admin-header');
  $('.rz-header').addClass('inner-header');
}
else{
  $('.rz-header').addClass('inner-header');
}
console.log(loc_spl);
console.log(loc);


$(function() {
  $('.btn-fltrs').on('click', function() {
      $(this).addClass('btn-blue-selected');
  });
});
