function searchClick() {
	
	var search = $('.header .search');
	
	search.bind('click', function() {
		search.addClass('search-active').animate({
			"width": "110px"
		},200,function() {
			search.find('input[name=zoom_query]').val('').show().focus();
			var activeButton = search.find('img').attr('active');
			search.find('img').attr('src',activeButton);
			search.unbind('click');
			$('.header .search #searchform img').bind('click', function() {
				$('form[name=search]').submit();
			});
			
		});
	});
}

$(document).ready(function () {
            
	/* Animation for Search-Field - Start */

	searchClick();
	
	$('.header .search').focusout( function() {
		$(this).find('input[name=zoom_query]').hide();
		
		var inactiveButton = $(this).find('img').attr('inactive');
		
		$(this).find('img').attr('src',inactiveButton);
		$(this).animate({
			"width":"48px"
		},200,function() {
			$('.header .search img').unbind('click');
			searchClick();		
		}).removeClass('search-active');
	});
	
	/* Animation for Search-Field - END */
	/* Animation of Top-Navi - START */
	
	// If cursor is out of the navigation-area remove all active classes
	$('.first-level').hover(
		function() {
			$(this).removeClass('active');
		}
	);
	
	$('.first-level-item').hover(
		function() {
			// If navigation is not marked as active
			if($('.top-navigation .active:first').length <= 0) {
				
				// Stop all animations on any pulldown-layer
				$('.pulldown-layer').stop();
				
				// 1. Clean current pulldown-layer from existing style-attribute
				// 2. Set height to 1 pixel and display to none to prepare for animation
				// 3. Animate height from 1 to 320 pixel
				// 4. Set mark navigation that it is open with the class "active".
				$(this).next('.pulldown-layer').removeAttr('style').css({
					"height":"1px",
					"display":"none"
				}).animate({
					"height":"330px"
				}, 300, "swing",function() {
					$('.first-level').addClass('active');
				});
				
				// Go through each product-navigation and set second entry as active/over
				$('.top-navigation .product ul li ul').each(function () {
					$(this).children('li:eq(0)').addClass('over');
				}).mouseleave(function() {
					$(this).children('li:eq(0)').addClass('over');
				});
				
			} else {
			
				// If navigation is marked as active then do no animation
				// Stop all existing animations
				$('.pulldown-layer').stop();
				// Set current menu-item as active
				$(this).addClass('active');
				

				
			}
		},
		function() {
			$('.pulldown-layer').hide().removeAttr('style');
			$(this).removeClass('active');
			
			$('.top-navigation .product ul li ul').each(function () {
				$(this).children('li:eq(0)').addClass('over');
			});
			
		}
	);
	$('.pulldown-layer').hover(
		function() {
			$(this).css({"min-height":"320px"}).show().parent().find('a:eq(0)').addClass("active");
		},
		function() {
			$(this).hide().removeAttr("style").parent().find('a:eq(0)').removeClass("active");
		}
	);
	
	/* Animation of Top-Navi - END */
	/* Animation of Product-Subnavi - START */
	$('.top-navigation .product ul li ul li').hover(
		function() {
			$('.top-navigation .product li').removeClass('over');
			$(this).addClass('over');
		},
		function() {
			$(this).removeClass('over');
		}
	);
	
	$('.top-navigation').mouseleave(function() {
		$('.pulldown-layer').stop();
		$('.first-level').removeClass('active');
	});
	
	/* Animation of Product-Subnavi - END */
	
	/* Helper-Function for AddThis-Button - START */
	$('#footer div.addthis').hover(function() {
		$(this).find('.addthis_button_compact').focus();
	});
	/* Helper-Function for AddThis-Button - END */
	
	/* Animation of Select-Country - START */
	$('#footer .rightarea .select-country').hover(
		function() {
			$(this).children('ul').slideDown('fast');
		},
		function() {
			$(this).children('ul').slideUp('fast');
		}
	);
	
	/* Animation of Select-Country - End */

	/* Animation/DropDown Left Box - Start */                
	$('#display-box').hover(function() {
		$('#box').css('display','block');
		$('#open-arrow').css('display','none');
		$('#close-arrow').css('display','block');
	}, function() {
		$('#box').css('display','none');
		$('#close-arrow').css('display','none');
		$('#open-arrow').css('display','block');
	});
	/* Animation/DropDown Left Box - End */

});
 
