// JavaScript Document

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