function dom_init() {
    scroll_init();
    slide_quotes();
    more_info_init();
}

function scroll_init() {
	
	
		$('#nav a').click(function(e){	
			
			var href = $(this).attr('href'), element;					
			element = $(href);
			
			$('html, body').animate({scrollTop: element.offset().top-20}, 2000, 'easeOutExpo');
			
			target = $(href + ' + * .hl');
        setTimeout(function() {
            target.css('background', '#FFF04F');
            setTimeout(function() {
                target.animate({
                    backgroundColor: '#D0E9EA'
                },
                3000,
                function() {
                    target.css('background', 'none');
                });
            },
            1000);
        },
        300);			
			
	    e.preventDefault();
	    return;
      
     })

}

function slide_quotes() {
    $("#dyn_quote blockquote").each(function(qi) {
        $(this).addClass('q' + qi);
        anzahl = qi;
    });
    i = 0;
    function slide_them() {
        setTimeout(function() {
            $("blockquote.q" + i).fadeOut('slow',
            function() {
                $(this).addClass('hidden');
            });
            if (i == anzahl) i = 0;
            else i++;
            $("blockquote.q" + i).fadeIn('slow',
            function() {
                $(this).removeClass('hidden');
            });
            slide_them();
        },
        7500);
    };
    slide_them();
}

function more_info_init() {
    $('.more-info').click(function() {
        if ($(' + .js-more-info', this).is(':hidden')) {
            $(' + .js-more-info', this).fadeIn('medium');
        } else {
            $(' + .js-more-info', this).fadeOut('medium');
        }
        return false;
    });
    $('body').click(function() {
        $('.js-more-info').fadeOut('medium');
    });
}
