$(document).ready(function(){
	if ($(window).height() < 820) {
		$('#wrapper').css({'bottom' : 'auto', 'height' : '460px'});
		$('#footer1').show(); $('#footer2').hide();
	} else {
		$('#wrapper').css({'bottom' : '150px', 'height' : 'auto'});
		$('#footer2').show(); $('#footer1').hide();
	}

	$(window).resize(function() {
	if ($(window).height() < 820) {
		$('#wrapper').css({'bottom' : 'auto', 'height' : '460px'});
		$('#footer1').show();
		$('#footer2').hide();
	} else {
		$('#wrapper').css({'bottom' : '150px', 'height' : 'auto'});
		$('#footer2').show();
		$('#footer1').hide();
	}
	});

	$('.logoAnchor').hoverIntent({over:logoOver, timeout:50, out:logoOut});
});



	function logoOver(){
		$(this).css({'z-index'	: '100'});
		currentAnchor = $(this).attr('id');

		image = $(this).find('img');
		$.data(image, 'size', {width : $(this).width(), height : $(image).height()});

		image.animate({
			'width' : $.data(image,'size').width*1.2,
			'height' : $.data(image,'size').height*1.2,
			'margin-left' : ($.data(image,'size').width*1.2-$.data(image,'size').width)/2*-1,
			'margin-top' : ($.data(image,'size').height*1.2-$.data(image,'size').height)/2*-1
		}, 200, function(){
			switch(currentAnchor){
				case 'technik':
				$('#bg_div').css('background-image', 'url(startseite/images/bg_technik.png)');
				$('#energie').find('img').delay(50).fadeOut(150, function(){
					$('#production').find('img').fadeOut(150, function(){
						$('#projekt').find('img').fadeOut(150);
					}); 
				});
				break;
				case 'energie':
				$('#bg_div').css('background-image', 'url(startseite/images/bg_energie.png)');
				$('#production').find('img').delay(50).fadeOut(150, function(){
					$('#projekt').find('img').fadeOut(150, function(){
						$('#technik').find('img').fadeOut(150);
					}); 
				});
				break;
				case 'projekt':
				$('#bg_div').css('background-image', 'url(startseite/images/bg_projekt.png)');
				$('#technik').find('img').delay(50).fadeOut(150, function(){
					$('#energie').find('img').fadeOut(150, function(){
						$('#production').find('img').fadeOut(150);
					}); 
				});
				break;
				case 'production':
				$('#bg_div').css('background-image', 'url(startseite/images/bg_production.png)');
				$('#projekt').find('img').delay(50).fadeOut(150, function(){
					$('#technik').find('img').fadeOut(150, function(){
						$('#energie').find('img').fadeOut(150);
					}); 
				});
				break;

			}
		});
	}

	function logoOut(){
		$(this).css({'z-index'	: '0'});
		image.animate({
			'width' : $.data(image,'size').width,
			'height' : $.data(image,'size').height,
			'margin-left' : 0,
			'margin-top' : 0
		}, 200, function(){
			switch(currentAnchor){
				case 'technik':
				$('#energie').find('img').fadeIn(150, function(){
					$('#production').find('img').fadeIn(150, function(){
						$('#projekt').find('img').fadeIn(150);
					}); 
				});
				break;
				case 'energie':
				$('#production').find('img').fadeIn(150, function(){
					$('#projekt').find('img').fadeIn(150, function(){
						$('#technik').find('img').fadeIn(150);
					}); 
				});
				break;
				case 'projekt':
				$('#technik').find('img').fadeIn(150, function(){
					$('#energie').find('img').fadeIn(150, function(){
						$('#production').find('img').fadeIn(150);
					}); 
				});
				break;
				case 'production':
				$('#projekt').find('img').fadeIn(150, function(){
					$('#technik').find('img').fadeIn(150, function(){
						$('#energie').find('img').fadeIn(150);
					}); 
				});
				break;
			}
		});
	}
