// const BASE_URL = window.location.origin;
// const BASES_URL = "https://localhost/jumppace";

	
$('img.lazyload').on('load',function(){
    $('.portfolio-container').isotope( 'reloadIsotope' ).isotope();
//  $("#portfolio-flters li:nth-child(1)").trigger('click'); 
});	



// wow start
new WOW().init();
// wow end
// AOS start
// AOS.init();
AOS.init({
  once: true
})
$(window).on('load', function() {
  AOS.refresh();
});
// AOS end


// sticky social
$(document).scroll(function () {
	"use strict";
    var y = $(this).scrollTop();
    if (y > 200) {
        $('.sticky-container').fadeIn();
    } else {
        $('.sticky-container').fadeOut();
    }

    if (y >= 70) {
        $(".header-main").addClass("stickyyy");
        // $('header.header-main.stickyyy .nav-area-full .logo img').attr('src', BASES_URL +'/assets/images/logodark.png');
    } else {
        $(".header-main").removeClass("stickyyy");
        // $("header.header-main .nav-area-full .logo img").attr('src', BASES_URL + '/assets/images/logo.png');
    } 
    if (y > 500) {
      $('.floating_wrap').addClass('visible');
        $('.floatbutton').addClass('visible');
        
        
    } else {
      $('.floating_wrap').removeClass('visible');
        $('.floatbutton').removeClass('visible');
        
    }

}); 
// sticky social end


// sidebar
var burgerTop = document.getElementsByClassName("top");
var burgerBot = document.getElementsByClassName("bottom");
var burgerMid = document.getElementsByClassName("middle");
var burgerSidebar = document.getElementsByClassName("sidebar");
var sideText = document.getElementsByClassName("sidetext");
var burgerWhole = document.querySelectorAll(".top, .bottom, .middle");

var tl = new TimelineMax({
  paused: true,
  reversed: true
});
tl.timeScale(1);
tl
  .to(burgerTop, 0.7, {
    y: 11,
    yoyo: true,
    ease: Power1.easeInOut
  })
  .to(burgerBot, 0.7, {
    y: -11,
    yoyo: true,
    ease: Power1.easeInOut
  }, '-=0.7')
  .to(burgerTop, 1, {
    rotation: 585
  })
  .to(burgerMid, 1, {
    rotation: 585
  }, '-=1')
  .to(burgerBot, 1, {
    rotation: 675
  }, '-=1')
  .to(burgerWhole, 0.1, {
    css: {
      borderColor: "#fff"
    },
    ease: Power1.easeOut
  }, '-=1')
  .to(burgerSidebar, 1, {
    x: '100%',
    ease: Power2.easeOut
  }, '-=1')
  .staggerFrom(sideText, 0.5, {
    opacity: 0,
    y: 25,
    ease: Power1.easeOut
  }, 0.1, "-=0.7")
  .to(sideText, 0.2, {
    css: {
      color: "#fff"
    }
  });

function haminate() {
  tl.reversed() ? tl.play() : tl.reverse();
  $(".burger-click-region").toggleClass("active");
  window.setTimeout(function () {
    $("body").toggleClass("menu-open");
    window.setTimeout(function () {
      if($("body").hasClass("menu-open")){
        $(".backdrop").addClass("rotate");
      }else{
        $(".backdrop").removeClass("rotate");
      }
    }, 50);
    $(".sidebar").toggleClass("openside");
    $(".logoside").toggleClass("fadeInUp");
    $(".backdrop").fadeToggle({
      width: 'toggle'
    }, 550);
  }, 800);
}


  $(document).on("click", ".dropdown-nav-item .nav-item",function(){
    $(this).siblings(".inner-menu").slideToggle();
  });


  $('.slider-work').slick({
    dots: true,
    arrows: false,
    infinite: false,
    speed: 300,
    slidesToShow: 4,
    slidesToScroll: 4,
    responsive: [
      {
        breakpoint: 1024,
        settings: {
          slidesToShow: 3,
          slidesToScroll: 3,
          infinite: true,
          dots: true
        }
      },
      {
        breakpoint: 600,
        settings: {
          slidesToShow: 2,
          slidesToScroll: 2
        }
      },
      {
        breakpoint: 480,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1
        }
      }
      // You can unslick at a given breakpoint now by adding:
      // settings: "unslick"
      // instead of a settings object
    ]
  });
  
  $('.heading-slider').slick({
    dots: false,
    arrows: false,
    infinite: true,
    autoplay:true,
    speed: 300,
    slidesToShow: 1,
    slidesToScroll: 1,
    responsive: [
      {
        breakpoint: 1024,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1,
          infinite: true,
          dots: false
        }
      },
      {
        breakpoint: 600,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1
        }
      },
      {
        breakpoint: 480,
        settings: {
          slidesToShow: 1,
          slidesToScroll: 1
        }
      }
      // You can unslick at a given breakpoint now by adding:
      // settings: "unslick"
      // instead of a settings object
    ]
  });

  $("body").addClass("darkmode");
   // executes when HTML-Document is loaded and DOM is ready
   $('.vertical-switch input').change(function(){
    if (this.checked) {
      $('.vertical-switch input').prop('checked', true).closest("body").addClass('darkmode');
    } else {
      $('.vertical-switch input').prop('checked', false).closest("body").removeClass('darkmode');
    }
  });
  
  
$(".tabs .units-categories .tab-item span").click(function(){
    $(".tabs .units-categories .tab-item").removeClass("active")
    $(this).parent().addClass("active")
    let anc = $(this).parent()
    if ($(anc).data("content-target") == "all") {        
        $(`.tab-content ul .porfolio-item[data-content-port]`).fadeOut("500")
        $(`.tab-content ul .porfolio-item[data-content-port]`).fadeIn("500")
    }
    else{
        $(`.tab-content ul .porfolio-item[data-content-port]`).fadeOut("500")
        $(`.tab-content ul .porfolio-item[data-content-port]`).each(function(ind,elem){
            if ($(elem).data("content-port").includes($(anc).data("content-target"))) {
                $(elem).fadeIn("500")
            }
        })
    }
    $(`.tab-content ul .porfolio-item[data-content-port]`).removeClass("mid-item")
});
$(".less-more-handler .more").click(function(){
    $(".is_need_to_hide").css("display","block")
    $(".less-more-handler .more").css("display","none")
    $(".less-more-handler .less").css("display","block")
});
$(".less-more-handler .less").click(function(){
    $(".is_need_to_hide").css("display","none")
    $(".less-more-handler .less").css("display","none")
    $(".less-more-handler .more").css("display","block")
});

////// footer year
$(function(){
"use strict";
var theYear = new Date().getFullYear();
$('#year').html(theYear);
});	






    $(document).ready(function() {
    //   $('.venobox').venobox({
    //     'share': false
    //   });
      new VenoBox({
            selector: ".my-custom-links"
        });
    });


    $(document).ready(function(){
        $('.matchHeight').matchHeight();
    })

     ////// Accordion 
        //  $('.accordion .quest-title.active1').addClass('active');
        $('#accordion-1').slideDown(300).addClass("open");
        $('.quest-title').on("click",function (e) {
            if($(this).hasClass("active") & $(this).next().hasClass('open')){
               // $(this).removeClass("active");
               // $(this).next().slideUp(300).removeClass('open');
           }
           else{
               $('.accordion .quest-title').removeClass('active');
               $('.accordion .quest-content').slideUp(300).removeClass('open');
               $(this).addClass("active");
               $(this).next().slideDown(300).addClass('open');
           }
        });
        ////// Accordion end 

//========================================= taimoor code for package selection and add-ons work =========================================//

// disclaimer


	// GET/SET Cookie
  function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
    var expires = "expires=" + d.toGMTString();
    document.cookie = cname + "=" + cvalue + "; " + expires;
  }
  
  function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
      var c = ca[i].trim();
      if (c.indexOf(name) === 0) return c.substring(name.length, c.length);
    }
    return "";
  }
  
  // EU Cookie Agreement
  var cContent = $('.cookie-disclaimer'),
      cName = "COOKIES_ACCEPTED";
  
  if (getCookie(cName) !== "true"){
    cContent.fadeIn();
    console.log(getCookie(cName));            
  }
  
  $('.accept-cookie').click(function () {
    setCookie(cName, "true", 30);
    console.log("cookie accepted!");
    cContent.fadeOut("fast");
  });

// tabs steps

var currentTab = 0; // Current tab is set to be the first tab (0)
showTab(currentTab); // Display the current tab

function showTab(n) {
  // This function will display the specified tab of the form...
  var x = document.getElementsByClassName("tab");
  x[n].style.display = "block";
  //... and fix the Previous/Next buttons:
  if (n == 0) {
    document.getElementById("prevBtn").style.display = "none";
  } else {
    document.getElementById("prevBtn").style.display = "inline";
  }
  if (n == (x.length - 1)) {
    document.getElementById("nextBtn").innerHTML = "Submit";
  } else {
    document.getElementById("nextBtn").innerHTML = "Next";
  }
  //... and run a function that will display the correct step indicator:
  fixStepIndicator(n)
}

function nextPrev(n) {
  // This function will figure out which tab to display
  var x = document.getElementsByClassName("tab");
  // Exit the function if any field in the current tab is invalid:
  if (n == 1 && !validateForm()) return false;
  // Hide the current tab:
  x[currentTab].style.display = "none";
  // Increase or decrease the current tab by 1:
  currentTab = currentTab + n;
  // if you have reached the end of the form...
  if (currentTab >= x.length) {
    // ... the form gets submitted:
    document.getElementById("regForm").submit();
    return false;
  }
  // Otherwise, display the correct tab:
  showTab(currentTab);
}

function validateForm() {
  // This function deals with validation of the form fields
  var x, y, i, valid = true;
  x = document.getElementsByClassName("tab");
  y = x[currentTab].getElementsByTagName("input");
  // A loop that checks every input field in the current tab:
  for (i = 0; i < y.length; i++) {
    // If a field is empty...
    if (y[i].value == "") {
      // add an "invalid" class to the field:
      y[i].className += " invalid";
      // and set the current valid status to false
      valid = false;
    }
  }
  // If the valid status is true, mark the step as finished and valid:
  if (valid) {
    document.getElementsByClassName("step")[currentTab].className += " finish";
  }
  return valid; // return the valid status
}

function fixStepIndicator(n) {
  // This function removes the "active" class of all steps...
  var i, x = document.getElementsByClassName("step");
  for (i = 0; i < x.length; i++) {
    x[i].className = x[i].className.replace(" active", "");
  }
  //... and adds the "active" class on the current step:
  x[n].className += " active";
}






 