$(function(){


	if ( $('html').hasClass('home') ) {

		$('#header').hide();
		$('#header').slideDown(700);
	
	} else {
		$('#header').css({
			height: 68
		});
	}
	
	
	setTimeout(function(){
		$('#intro').fadeOut(600, function(){
		
			$('#header').animate({
				height: '68px'
			});
			
		});
	}, 2000);
	
	
	function close(){
		$('#intro, #contact-section').fadeOut(400, function(){
			$('header').animate({
				height: 68
			});
		});
	}
	


	$('#contact a').click(function(){
		if ( !$('header').is(':animated') ) {
			if ( $('#contact-section').is(':visible') ) {
					close();
				return false;
			} else {
				if ( $('header').outerHeight()===68 ) {
					$('header').animate({
						height: '380px'
					}, function(){
						$('#contact-section').fadeIn();
					});
				} else {
					$('#intro').fadeOut(400, function(){
					
						$('header').animate({
							height: '68px'
						}, function(){
							$('header').animate({
								height: '380px'
							}, function(){
								$('#contact-section').fadeIn();
							});
						});
					});
				}
			}
		}
		return false;
	 });


	$('#about a').click(function(){
		if ( !$('header').is(':animated') ) {
			if ( $('#intro').is(':visible') ) {
				close();
				return false;
			} else {
				if ( $('header').outerHeight()===68 ) {
					$('header').animate({
						height: '265px'
					}, function(){
						$('#intro').fadeIn();
					});
				} else {
					$('#contact-section').fadeOut(400, function(){
					
						$('header').animate({
							height: '68px'
						}, function(){
							$('header').animate({
								height: '265px'
							}, function(){
								$('#intro').fadeIn();
							});
						});
										
					});
				}
			}
		}
		return false;
	 });	
	 
	
});
