$(function(){
	var $elems = $('.animateblock');
	var $elems_init = $('.animateblockinitials');
	var winheight = $(window).height();
	var fullheight = $(document).height();

			 // pour animer ceux qui doivent apparaitre au chargement de la page sans avoir à scroller
			 $(window).scroll(function(){
			 	animate_elems();
			 });
			 function animate_elems() {
			 	wintop = $(window).scrollTop();
			 	$elems.each(function(){
			 		$elm = $(this);

			 		if($elm.hasClass('animated')) { return true; }

			 		topcoords = $elm.offset().top;

			 		if(wintop > (topcoords - (winheight*.75))) {
			 			$elm.addClass('animated');
			 		}
			 	});
			 }
			 function animate_initials_elems() {
			 	wintop = $(window).scrollTop();
				// wait(500);
				$elems_init.each(function(){
					$elm = $(this);

					if($elm.hasClass('animated_initials')) { return true; }

					topcoords = $elm.offset().top;

					if(wintop > (topcoords - (winheight*.75))) {
						$elm.addClass('animated_initials');
					}
				});
			}
			setTimeout(animate_initials_elems(), 2000);
			function wait(ms)
			{
				var d = new Date();
				var d2 = null;
				do { d2 = new Date(); }
				while(d2-d < ms);
			}
		});