<script src="<?php echo $Position; ?>js/vendor/jquery-library.js"></script>
<script src="<?php echo $Position; ?>js/vendor/bootstrap.min.js"></script>

<!-- <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> -->

<!-- <script src="https://maps.google.com/maps/api/js?key=AIzaSyCR-KEWAVCn52mSdeVeTqZjtqbmVJyfSus&language=en"></script> -->
<script src="<?php echo $Position; ?>js/bootstrap-select.min.js"></script>
<script src="<?php echo $Position; ?>dist/js/bootstrap-select.js"></script>
<script src="<?php echo $Position; ?>js/jquery-scrolltofixed.js"></script>
<script src="<?php echo $Position; ?>js/owl.carousel.min.js"></script>
<script src="<?php echo $Position; ?>js/jquery.mmenu.all.js"></script>
<script src="<?php echo $Position; ?>js/packery.pkgd.min.js"></script>
<script src="<?php echo $Position; ?>js/jquery.vide.min.js"></script>
<script src="<?php echo $Position; ?>js/scrollbar.min.js"></script>
<script src="<?php echo $Position; ?>js/prettyPhoto.js"></script>
<script src="<?php echo $Position; ?>js/countdown.js"></script>
<script src="<?php echo $Position; ?>js/parallax.js"></script>
<script src="<?php echo $Position; ?>js/gmap3.js"></script>
<script src="<?php echo $Position; ?>js/main.js"></script>

<!-- Parsley -->
<script src="<?php echo $Position; ?>js/parsley/parsley.min.js"></script>
<script src="<?php echo $Position; ?>js/parsley/parsley.extend.js"></script>
<script src="<?php echo $Position; ?>js/sweetalert/sweetalert.min.js"></script>

<script src="<?php echo $Position; ?>js/wow.min.js"></script>

<script>

  new WOW().init();

  var wow = new WOW(
  {
    boxClass:     'wow',      // animated element css class (default is wow)
    animateClass: 'animated', // animation css class (default is animated)
    offset:       0,          // distance to the element when triggering the animation (default is 0)
    mobile:       true,       // trigger animations on mobile devices (default is true)
    live:         true,       // act on asynchronously loaded content (default is true)
    callback:     function(box) {
      // the callback is fired every time an animation is started
      // the argument that is passed in is the DOM node being animated
    },
    scrollContainer: null // optional scroll container selector, otherwise use window
  }
  );
  wow.init();

  var position = $(window).scrollTop();

  // should start at 0

  //Menu Off or Show
  /*$(window).scroll(function() {
    var scroll = $(window).scrollTop();
    if(scroll > position) {
      console.log('scrollDown');
      $("#tg-header").fadeOut();
    } else {
      console.log('scrollUp');
      $("#tg-header").fadeIn();
    }
    position = scroll;
  });*/

  // $(document).on('click', '.btn-Up', function(e) {
  //   // console.log('clic');
  //   // $(window).scrollTop(0);
  //   $(window).animate({ scrollTop: 0 }, "slow");
  // });

  $(document).on('click', '.navbar-toggle', function(e) {
    $('.MobileMenu').show();
  });
  $(document).on('click', '.btn-close-menu', function(e) {
    $('.MobileMenu').hide();
  });


  $(document).on('mouseover', '.Btn-dropdown', function(e) {
    $(this).addClass('show');
    $(this).find('.dropdown-menu').addClass('show');
    console.log('Hover');
  });

  $(document).on('mouseout', '.dropdown-menu', function(e) {
    $(this).removeClass('show');
    $(this).parents('.Btn-dropdown').removeClass('show');
  });

  $(document).on('click', '.Btn-dropdown-Go', function(e) {
    var Go = $(this).data('go');
    console.log('Go: '+Go);
    document.location.href=Go;
  });


  $('.btn-Up').click(function(){
    $("html, body").animate({ scrollTop: 0 }, 600);
    return false;
  });

  $(document).on('click', 'a[href^="#"]', function(e) {
    // target element id
    var id = $(this).attr('href');

    // target element
    var $id = $(id);
    if ($id.length === 0) {
        return;
    }

    // prevent standard hash navigation (avoid blinking in IE)
    e.preventDefault();

    // top position relative to the document
    var pos = $id.offset().top;

    // animated top scrolling
    $('body, html').animate({scrollTop: pos});
  });

  //Screen
  /*
  AltoScreen      = $( window ).height();
  HalfScreen      = AltoScreen / 2;
  Threequarters   = AltoScreen * .75;
  $(".AltoScreen").css("height", AltoScreen);
  $(".HalfScreen").css("height", HalfScreen);
  $(".Threequarters").css("height", Threequarters);
  */

  <?php if( $MenuMove == 1 ){  ?>
    $(window).scroll(function (event) {
      var scroll = $(window).scrollTop();
      if( scroll > 0 ){
        $('#tg-header').addClass('BgHead1');
        $('#tg-header').find('#tg-navigation').addClass('HeadMenu2');
      }else{
        $('#tg-header').removeClass('BgHead1');
        $('#tg-header').find('#tg-navigation').removeClass('HeadMenu2');
      }
      // Do something
    });
  <?php } ?>

  $( window ).resize(function() {
    AltoScreen      = $( window ).height();
    AnchoScreen     = $( window ).width();
    HalfScreen      = AltoScreen / 2;
    Threequarters   = AltoScreen * .75;
    $(".AltoScreen").css("height", AltoScreen);
    $(".HalfScreen").css("height", HalfScreen);
    $(".Threequarters").css("height", Threequarters);

    <?php if( $MenuMove == '1' ){ ?>
      if( AnchoScreen >= 992 ){
        AltoScreenMenu = AltoScreen - 120;
        //$('.tg-header').removeAttr('style');
        //$('.tg-header').css("top", AltoScreenMenu);
      }
    <?php } ?>

  });
  //End Screen

  //Alto Boxes
  //(function($) {
    $(document).ready(function(){

      //Btn Menu
      $(document).on('click', '.Btn-TopMenu', function(e) {
        $('.MenuFull').addClass('Active');
      });
      //End Btn Menu

      //Btn CloseMenu
      $(document).on('click', '.btn-close-menu', function(e) {
        $('.MenuFull').removeClass('Active');
      });
      //End Btn CloseMenu

      alto0 = '0';
      $('.BoxOpcIn').each(function() {
        alto1 = $(this).height();
        if( alto1 >= alto0 ){
          alto0 = alto1;
        }
        $('.BoxOpcIn').height(alto0);
      });

      $('.BoxA2').each(function() {
      Size = $(this).width();
      Size2 = Size * .5;
          $('.BoxA2').height(Size2);
          $('.BoxA2In').height(Size2);
      });

      $('.Box1').each(function() {
        AnchoBox = $(this).width();
        Size = $(this).height();
        console.log('Size');
        Size2 = $(this).height * 2;
        //alert('Size: ' + Size);
        $('.Box1').height($(this).width());
        $('.Box2').height($(this).width());
        $('.Box1 .Trans').height($(this).width());
        $('.Box2 .Trans').height($(this).width());
        $('.Box1-A').css('min-height', AnchoBox+'px');
      });
    });
  //})(jQuery);

  $(window).resize(function(){

    alto0 = '0';
    $('.BoxOpcIn').each(function() {
      alto1 = $(this).height();
      if( alto1 >= alto0 ){
        alto0 = alto1;
      }
      $('.BoxOpcIn').height(alto0);
    });

    $('.BoxA2').each(function() {
    Size = $(this).width();
    Size2 = Size * .5;
        $('.BoxA2').height(Size2);
        $('.BoxA2In').height(Size2);
    });

    	$('.Box1').each(function() {
			Size = $(this).height();
      Size2 = $(this).height * 2;
			//alert('Size: ' + Size);
        	$('.Box1').height($(this).width());
          $('.Box2').height($(this).width());
          $('.Box1 .Trans').height($(this).width());
          $('.Box2 .Trans').height($(this).width());
    	});
	}).resize();
  //End Boxes

  //Maximo Alto de Boxes
  var heights = $(".BoxAlo").map(function (){
    return $(this).height();
  }).get();
  maxHeight = Math.max.apply(null, heights);
  $(".BoxAlo").css("height", maxHeight);
  $( window ).resize(function() {
    var heights = $(".BoxAlo").map(function (){
      return $(this).height();
    }).get();
    maxHeight = Math.max.apply(null, heights);
    $(".BoxAlo").css("height", maxHeight);
  });
  //End Maximo Alto de Boxes

  $(document).on('click', '.BtnAnio', function(e) {
    var Ww = $(window).width();
    if( Ww <= 991 ){
      $(this).find('.CardInTime').toggle();
    }
  });

  $(document).on('click', '.BtnCloseTimeLine', function(e) {
    //$(this).parents('.CardInTime').toggle();
  });

  <?php if( $MenuMove == '1' ){ ?>
    //Ajuste de Menu abajo en Banner
    /*AltoScreen      = $( window ).height();
    //alert(AltoScreen);
    $( document ).ready(function() {
      AltoScreen = AltoScreen - 120;
      $('.tg-header').css("top", AltoScreen);
    });*/
  <?php } ?>
  $( ".btn-gal-view" ).click(function() {
    cla = $( this ).data('value');
    $.when($('.GalBox').fadeOut(500)).done(function() {
      $( '.'+cla ).fadeIn( "slow", function() {
      });
    });
    /*$( ".GalBox" ).fadeOut( "slow", function() {
      $( '.'+cla ).fadeIn( "slow", function() {
      });
      $('.'+cla).show();
    });*/
  });

  if (navigator.userAgent.match(/Trident\//) || navigator.userAgent.match(/Edge\//)) {
    document.body.addEventListener("mousewheel", function(evt) {
        evt.preventDefault();
        var wd = evt.wheelDelta;
        var csp = window.pageYOffset;
        window.scrollTo(0, csp - wd);
    });
  }


</script>
