// Add Your Scripts here
// SMOOTH SCROLLING
    $('a[href*="#"]')
  // Remove links that don't actually link to anything
  .not('[href="#"]')
  .not('[href="#0"]')
  .click(function(event) {
    // On-page links
    if (
      location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') 
      && 
      location.hostname == this.hostname
    ) {
      // Figure out element to scroll to
      var target = $(this.hash);
      target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
      // Does a scroll target exist?
      if (target.length) {
        // Only prevent default if animation is actually gonna happen
        event.preventDefault();
        $('html, body').animate({
          scrollTop: target.offset().top
        }, 1000, function() {
          // Callback after animation
          // Must change focus!
          var $target = $(target);
          $target.focus();
          if ($target.is(":focus")) { // Checking if the target was focused
            return false;
          } else {
            $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
            $target.focus(); // Set focus again
          };
        });
      }
    }
  });
// SMOOTH SCROLLING END
// HAMBURGER-AND-MENU-FUNCTION
$(document).ready(function(){
$('.nav-header').click(function(){
              $('.nav-header').toggleClass('active');
              // $('.collapse-nav').toggle('boxopened', 'easeInQuad');
                $('.collapse-nav').toggleClass('show');
            });

$('.main-menu li a').click(function(){
              $('.nav-header').toggleClass('active');
              // $('.collapse-nav').toggle('boxopened', 'easeInQuad');
                $('.collapse-nav').toggleClass('show');
            });

  $('.menu-item-has-children').on('click', (event) => {
  $(event.target).siblings('.sub-menu')
    .toggleClass('is-open');
});
//  if you want to remove the dropdown by clicking anywhere at the display then try this..
  $(document).click(function(e) {
  $('.menu-item-has-children')
    .not($('.menu-item-has-children').has($(e.target)))
    .children('.sub-menu')
    .removeClass('is-open');
});
// DROPDOWN-REMOVE-BY-CLICKING-ANYWHERE-END

  $('.tab-expend').on('click', (event) => {
  $(event.target).parent('.tab').find('.tab-expend-inner')
    .toggleClass('is-open');
});

//  if you want to remove the dropdown by clicking anywhere at the display then try this..
  $(document).click(function(e) {
  $('.tab-expend')
    .not($('.tab-expend').parent('.tab')($(e.target)))
    .find('.tab-expend-inner')
    .removeClass('is-open');
});

$('.tablinks').click(function(){
  $('.tab-expend-inner').removeClass('is-open');
});

$('.contact-poper').click(function(){
              $('#contact-pop').fadeIn("slow");
            });
$('.cancel-btn').click(function(){
              $('#contact-pop').fadeOut("slow");
            });

$('#expendeture').click(function(){
              $('.about-expendeture').slideToggle("slow");
              $(this).toggleClass('change');
});
$('.accordion-controller').click(function(){
  $('section').removeClass('expendeded');
  $(this).parent('.single-accordion').find('section').addClass('expendeded');
  $('.accordion-controller').removeClass('expended');
  $(this).addClass('expended');
})
});
// HAMBURGER-AND-MENU-FUNCTION-END

// scroll-effect
$(window).on('scroll', function() {
    if($(window).scrollTop() > 200) {
      $('header').addClass('sticky');
    }
    
  });

  $(window).on('scroll', function() {
    if($(window).scrollTop() < 1) {
      $('header').removeClass('sticky');
    }
    
  });

function openReport(evt, reportName) {
  var i, tabcontent, tablinks;
  tabcontent = document.getElementsByClassName("tabcontent");
  for (i = 0; i < tabcontent.length; i++) {
    tabcontent[i].style.display = "none";
  }
  tablinks = document.getElementsByClassName("tablinks");
  for (i = 0; i < tablinks.length; i++) {
    tablinks[i].className = tablinks[i].className.replace(" active", "");
  }
  document.getElementById(reportName).style.display = "block";
  evt.currentTarget.className += " active";
}

// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();

$('.tab > button').append("<span class='m-subnav-arrow'></span>");