// JavaScript Document


jQuery(document).ready(function() {
    
	/* ########## carousel ########## */
	jQuery('#mycarousel').jcarousel({
    	wrap: 'circular',
		scroll: 1
    });
	
	$('#mycarousel li').bind('mouseenter', function() {
		$(this).children(".desc").fadeIn(500);
	});
	$('#mycarousel li').bind('mouseleave', function() {	
		$(this).children(".desc").fadeOut(500);
	});
	
	
	/* ########## navigation ##########  */
	
	function funShowPortfolio(){
		$('#portfolio').addClass('active');
		if($('#innercontent_start').is(":visible")) {
			$('#home').removeClass('active');
			
			$('#innercontent_start').fadeOut('slow', function() {
					$('#innercontent').animate({
						height: '1050'
					}, 1000, function() {
							$('#innercontent_portfolio').fadeIn('slow', function() {
									$('#innerservices').fadeOut('slow', function() {
										$('#services').animate({
											height: '0'
										  }, 500, function() {
											  
											  $('#unterservices').animate({
													marginTop: '46'
												  }, 400, function(){
													  
											  });
										 });
									});
								
							 });
							
					});
			});
		
		} else if($('#innercontent_about').is(":visible")) {
			$('#about').removeClass('active');
			$('#innercontent_about').fadeOut('slow', function() {
					$('#innercontent').animate({
						height: '1050'
					}, 700, function() {
							$('#innercontent_portfolio').fadeIn('slow');
					});
			});
						   
		}
	
	}
	
	
	
	$('#portfolio').bind('click', function() {
		funShowPortfolio();
	});
	
	$('#hineinspaziert').bind('click', function() {
		funShowPortfolio();
	});
	
	$('#home').bind('click', function() {
		$('#home').addClass('active');
		if($('#innercontent_portfolio').is(":visible")) {
			$('#portfolio').removeClass('active');
			$('#innercontent_portfolio').fadeOut('slow', function() {
					$('#innercontent').animate({
						height: '280'
					}, 700, function() {
							$('#innercontent_start').fadeIn('slow', function() {
									$('#services').animate({
										height: '218'
										}, 700, function() {
											$('#unterservices').animate({
												marginTop: '33'
												}, 500, function(){
													$('#innerservices').fadeIn('slow');
										  	});
									 });
								
							 });
							
					});
			});
				
				
		} else if($('#innercontent_about').is(":visible")) {
			$('#about').removeClass('active');
			$('#innercontent_about').fadeOut('slow', function() {
					$('#innercontent').animate({
						height: '280'
					}, 700, function() {
							$('#innercontent_start').fadeIn('slow', function() {
									$('#services').animate({
										height: '218'
										}, 700, function() {
											$('#unterservices').animate({
												marginTop: '33'
												}, 500, function(){
													$('#innerservices').fadeIn('slow');
										  	});
									 });
								
							 });
					});
			});
		
		}
		
	});
	
	
	$('#about').bind('click', function() {
		$('#about').addClass('active');
		
		if($('#innercontent_start').is(":visible")) {
			$('#home').removeClass('active');
			$('#innercontent_start').fadeOut('slow', function() {
					$('#innercontent').animate({
						height: '420'
					}, 1000, function() {
							$('#innercontent_about').fadeIn('slow', function() {
									$('#innerservices').fadeOut('slow', function() {
										$('#services').animate({
											height: '0'
										  }, 500, function() {
											  
											  $('#unterservices').animate({
													marginTop: '46'
												  }, 400, function(){
													  
											  });
										 });
									});
								
							 });
							
					});
			});
			
		} else if($('#innercontent_portfolio').is(":visible")) {
			$('#portfolio').removeClass('active');
			$('#innercontent_portfolio').fadeOut('slow', function() {
					$('#innercontent').animate({
						height: '420'
					}, 700, function() {
							$('#innercontent_about').fadeIn('slow');
					});
			});
						   
		}
		
	
	});
	
	
	/* ########## portfolio ########## */
	
	
	/*$('.portfolio_box_4x').bind('mouseenter', function() {
		//alert("hallo");
		//$(this).children(".portfolio_desc_white").animate({top: "1px"});
		$(this).children(".portfolio_desc_white").animate({top: "1px"}, 800, "easeOutBounce");
		//$(this).children(".portfolio_desc_white").animate({top: "1px"}, {duration: 1000, easing: easeInBounce});
	});
	$('.portfolio_box_4x').bind('mouseleave', function() {	
		$(this).children(".portfolio_desc_white").animate({top: "-188px"}, 500);
	});*/
	
	/*$('.portfolio_box_4x').bind('mouseenter', function() {
		$(this).children(".portfolio_desc").fadeIn('slow');
	});
	$('.portfolio_box_4x').bind('mouseleave', function() {	
		$(this).children(".portfolio_desc").fadeOut('slow');
	});*/
	
	$('.portfolio_box_4x').bind('mouseenter', function() {
		$(this).children(".portfolio_desc_white").fadeIn('slow');
	});
	$('.portfolio_box_4x').bind('mouseleave', function() {	
		$(this).children(".portfolio_desc_white").fadeOut('slow');
	});
	
	/*$('.portfolio_box_ohne').bind('mouseenter', function() {
		$(this).children(".portfolio_desc_white").fadeIn('slow');
	});
	$('.portfolio_box_ohne').bind('mouseleave', function() {	
		$(this).children(".portfolio_desc_white").fadeOut('slow');
	});*/
	
	
});


