jQuery(document).ready(function() {
  

   $('#carouselHacked').carousel();
  
	//this code is for the gmap
	 // var map = new GMaps({
        // el: '#map',
        // lat: -12.043333,
        // lng: -77.028333
      // });


      //this code is for smooth scroll and nav selector
            $(document).ready(function () {
              $(document).on("scroll", onScroll);
              
              //smoothscroll
              $('a[href^="#"]').on('click', function (e) {
                  e.preventDefault();
                  $(document).off("scroll");
                  
                  $('a').each(function () {
                      $(this).removeClass('active');
                  })
                  $(this).addClass('active');
                
                  var target = this.hash,
                      menu = target;
                  $target = $(target);
                  $('html, body').stop().animate({
                      'scrollTop': $target.offset().top+2
                  }, 500, 'swing', function () {
                      window.location.hash = target;
                      $(document).on("scroll", onScroll);
                  });
              });
          });

          function onScroll(event){
              var scrollPos = $(document).scrollTop();
              $('.navbar-default .navbar-nav>li>a').each(function () {
                  var currLink = $(this);
                  var refElement = $(currLink.attr("href"));
                  if (refElement.position().top <= scrollPos && refElement.position().top + refElement.height() > scrollPos) {
                      $('.navbar-default .navbar-nav>li>a').removeClass("active");
                      currLink.addClass("active");
                  }
                  else{
                      currLink.removeClass("active");
                  }
              });
          }
     
     
     //this code is for animation nav
     jQuery(window).scroll(function() {
        var windowScrollPosTop = jQuery(window).scrollTop();

        if(windowScrollPosTop >= 50) {
          jQuery(".top-header").css({"background-color": "rgba(0, 0, 0, 0.9)",});
		  jQuery(".top-header img.logo").css({"margin-top": "-10px", "margin-bottom": "0px"});
		  
		  jQuery(".top-header img.logo2").css({"margin-top": "10px", "margin-bottom": "0px"});
		  
          jQuery(".navbar-default").css({"margin-top": "-80px",});
		  
		  jQuery(".kpmg").css({ "margin-top": "5px", });
        }
        else{
          jQuery(".top-header").css({"background": "transparent",});
		  jQuery(".top-header img.logo").css({"margin-top": "-5px", "margin-bottom": "20px"});
		  
		  jQuery(".top-header img.logo2").css({"margin-top": "16px", "margin-bottom": "20px"});
		  
            //jQuery(".navbar-default").css({"margin-top": "12px", "margin-bottom": "0"});
		  jQuery(".navbar-default").css({ "margin-top": "-80px", "margin-bottom": "0" });
		  
		  jQuery(".kpmg").css({ "margin-top": "-15px", });
          
        }
     });

      
     

});