$(document).ready(function() {

	// Navi: 
	$("ul.dropdown li").dropdown();

	// Logo
	
	// Reeder:
	$('#HEAD h1').css({'margin-left': '250px', 'opacity': '0', 'cursor': 'pointer'});
	$('#HEAD h1').animate({'opacity': '1', 'margin-left': '130px'},5000,'swing');
	$('#HEAD h1').click(function() {
		window.location='index.html';
		return false;
	});

	// Unternehmensgruppe:
	$('#HEAD p').css({'margin-left': '-40px', 'opacity': '0', 'cursor': 'pointer'});
	$('#HEAD p').animate({'margin-left': '20px', 'opacity': '1'},4500,'swing');
	$('#HEAD p').click(function() {
		window.location='index.html';
		return false;
	});

	// Deko-Linie:
	$('#HEAD').append('<div id="line"></div>');
	$('#line').css({'opacity': '0'});
	$('#line').delay(3000).animate({'opacity': '1'},3000);

	// Accordion
	
	$('#thzlist h2').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();
	
	$('#list h2').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();
	
	$('#list h3').click(function() {
		$(this).next().toggle('slow');
		return false;
	}).next().hide();
	
	$('#list.elapse').append('<input class="openall" type="button" value="Alle aufklappen"><input class="closeall" type="button" value="Alle zuklappen">');
	
	$('#list .openall').click(function() {
		$('#list').find('h2').next().show('slow');
		$('#list').find('h3').next().show('slow');
	});
	
	$('#list .closeall').click(function() {
		$('#list').find('h2').next().hide('slow');
		$('#list').find('h3').next().hide('slow');
	});	
});

// Navi animation

$.fn.dropdown = function() {

	// Initialize (hide)
	$('ul:first',this).fadeOut(1).css('visibility', 'hidden');
	
	$(this).hover(function(){
		$(this).addClass("hover");
		$('> .dir',this).addClass("open");
		$('ul:first',this).css('visibility', 'visible').fadeIn(350);
	},function(){
		$(this).removeClass("hover");
		$('.open',this).removeClass("open");
		$('ul:first',this).fadeOut(1).css('visibility', 'hidden');
	});

};



