$(document).ready(function() {
   

   $('#navigation ul ul.sub').hide();

    $('#navigation ul>li:has(ul.sub)').hoverIntent(
        function() {
           if ($("ul.sub").is(":hidden")) {
           $('ul.sub', this).slideDown('fast');
           }
        }, function () {
           if ($("ul.sub").is(":visible")) {
           $('ul.sub', this).slideUp('fast');
           }
        }
    );
	
	$(".read-more").click(homeSlideUp);
	$(".reduce-text").click(homeSlideDown);


		function homeSlideUp() {

		if (window.running_animation == true) return;

			window.running_animation = true;

			$("#teaser").fadeOut(500);
			$("#content-home").animate({height: "383px"}, 1200);
			$("#one").animate({borderWidth: "10px"}, 1400).fadeIn(1500);
			$(".intro-links").animate({borderWidth: "10px"}, 1400).fadeIn(2000, function(){window.running_animation = false;});

			return false;
		}


		function homeSlideDown() {

		if (window.running_animation == true) return;

			window.running_animation = true;

			$(".intro-links").fadeOut(700);
			$(".intro-text").fadeOut(800);
			$("#content-home").animate({height: "383px"}, 1200).animate({height: "41"}, 1200);
			$("#teaser").animate({borderWidth: "10px"}, 2400).fadeIn(2000, function(){window.running_animation = false;});

			return false;
		}	


		$("#content-home #one .pagi-links a").click(function(){

			$("#content-home #one").hide();
			$("#content-home #two").fadeIn("slow");
			
		}); 
		
		$("#content-home #two .pagi-links a").click(function(){
			$("#content-home #two").hide();
			$("#content-home #one").fadeIn("slow");
		}); 
		
		$("#nyroModalFull a").click(function(){										
			
			$('#nyroModalFull').css('display',none);
			
			return false;
		});
	
});
