$(function(){
  "use strict";
    $(".fadeInFirst, .fadeInUp, .fadeInUpImg, .fadeInDown, .fadeInRight, .fadeInLeft, .fadeInUpGraph01, .fadeInUpGraph02, .fadeInArrow01, .fadeInArrow02, .fadeInAuxiliary01, .fadeInAuxiliary02").css("visibility", "hidden");
    $(".fadeInLeftSYnews").css("visibility", "hidden");

  $(window).on("load", function() {
    var windowHeight = $(window).height();
    var topWindow = $(window).scrollTop();
    $('.fadeInFirst').each(function(){
      $(this).addClass("animation_fadeInUp");
    });
    setTimeout(function() {
      $('.fadeInUp').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInUp");
        }
      });
      $('.fadeInUpImg').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInUpImg");
        }
      });
      $('.fadeInDown').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInDown");
        }
      });
      $('.fadeInRight').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInRight");
        }
      });
      $('.fadeInLeft').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInLeft");
        }
      });
      $('.fadeInUpGraph01').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInUpGraph01");
        }
      });
      $('.fadeInUpGraph02').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInUpGraph02");
        }
      });
      $('.fadeInArrow01').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInArrow01");
        }
      });
      $('.fadeInArrow02').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInArrow02");
        }
      });
      $('.fadeInAuxiliary01').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInAuxiliary01");
        }
      });
      $('.fadeInAuxiliary02').each(function(){
        if(topWindow > $(this).offset().top - windowHeight + 40){
          $(this).addClass("animation_fadeInAuxiliary02");
        }
      });
    }, 300);
  });

  $(window).on("scroll",function(){
    var windowHeight = $(window).height();
    var topWindow = $(window).scrollTop();
    $('.fadeInUp').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInUp");
      }
    });
    $('.fadeInUpImg').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInUpImg");
      }
    });
    $('.fadeInDown').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInDown");
      }
    });
    $('.fadeInRight').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInRight");
      }
    });
    $('.fadeInLeft').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInLeft");
      }
    });
    $('.fadeInUpGraph01').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInUpGraph01");
      }
    });
    $('.fadeInUpGraph02').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInUpGraph02");
      }
    });
    $('.fadeInArrow01').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInArrow01");
      }
    });
    $('.fadeInArrow02').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInArrow02");
      }
    });
    $('.fadeInAuxiliary01').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInAuxiliary01");
      }
    });
    $('.fadeInAuxiliary02').each(function(){
      if(topWindow > $(this).offset().top - windowHeight + 40){
        $(this).addClass("animation_fadeInAuxiliary02");
      }
    });
  });
});