jQuery(function() {
	$('#about').hide();
	
	$('.about').click(function() {
		toggle($('#about'), 250);
	});
	
	toggle = function(element, height)
	{
		if (element.css("display") === 'none') 
		{
			openSubNavigation(element, height);
			$('#footer').animate({ height: 43 }, { duration: 400, complete: function() {
				$('.toggle-content').hide();
			} });
			
			$('#about-arrow').animate({rotate: '-90deg'}, 400);
			
			$('#imprint-button').bind('click', function() {
				toggle($('#about'), 250);
			})
		}
		else
		{
			$('#imprint-button').unbind('click');
			
			closeSubNavigation(element, height);
			$('.toggle-content').show();
			$('#footer').animate({ height: 270 }, { duration: 400 });
			
			$('#about-arrow').animate({rotate: '90deg'}, 400);
		}
	}

	openSubNavigation = function(element, height) 
	{
		element.css({height: height});
		element.slideDown('medium');
    };

    closeSubNavigation = function(element, restore) 
	{

		element.css({height: 250});
		element.slideUp('medium', function() {
		});

		setTimeout(function() {
		    element.stop(true, true).hide(); 
		}, 500);
    };
});
