$(document).ready(function() {
		
		
		// init tooltip
		$(".item").tooltip({ effect: 'slide', slideInSpeed: 300, delay: 50, position: 'top center', offset: [13, 0]});
		
		//$("#Map area[title]").tooltip({position: 'top left'});
		
		// init accordion
		$("#accordion .element").addClass("hidden");
		var duration = 650;
		var easing = 'easeOutQuad';
		var targetColor = '#8A9088';
		var minImageSize = 50;
		var maxImageSize = 125;
		
		
		//$("#accordion h2").click(function() {
		$("#accordion .toggler").click(function() {
		
				// close opened acc
				$("#accordion .activeElement").animate({
					height: 0,
					color: '#fff'
				  }, duration, easing, function() {$(this).removeAttr("style");});
				
				if ($("#accordion").hasClass("referenzen") == false) { 
					$("#accordion .activeToggler img").animate({
						width: minImageSize,
						height: minImageSize
				  	}, duration, easing);
				  }
				  
				  
				if ($(this).hasClass("activeToggler") == false) {

					$("#accordion .activeToggler").removeClass("activeToggler");
					$("#accordion .activeElement").removeClass("activeElement");
					
					// open clicked acc
					$(this).next().addClass("activeElement");
					$(this).addClass("activeToggler");
					
					// init animation
					var targetHeight = $(this).next().innerHeight();
					
					
					$(this).next().css("height", 0);
					$(this).next().css("color", "#fff");
					
					// animate content and image
					$(this).next().animate({
						height: targetHeight,
						color: targetColor
					  }, duration, easing);
					
					if ($("#accordion").hasClass("referenzen") == false) { 
						$(this).find('img').animate({
							width: maxImageSize,
							height: maxImageSize
					  	}, duration, easing);
					 }
				}
				else {
					$("#accordion .activeToggler").removeClass("activeToggler");
					$("#accordion .activeElement").removeClass("activeElement");
				}
		});	
	});

