/*
Responsavel pelo carregamento dinamico das imagens.
*/

;(function($) {
    $.fn.imageLoad = function(options) {
      var settings = $.extend({
          desconto: 0
      }, options);

      return this.each(function() {
          var $this = $(this);

          function image_load() {
            $this.attr('src', $this.data('src')).removeClass('ftr-js-image-load__image');
          }

          if($this.offset().top < ($(window).scrollTop() + $(window).height() + settings.desconto) ) {
            image_load();
          }

          $this.one('image_load', function(){
            image_load();
          });

          $(window).on('scroll', function(){
            if($this.offset().top < ($(window).scrollTop() + $(window).height() + settings.desconto) ) {
              $this.trigger('image_load');
            }
          });

      });
    }
})(jQuery);

$('.ftr-js-image-load__image').imageLoad({desconto: 500});