$(document).ready(function(){
	
	//ACCORDION BUTTON ACTION
	$('div.accordionButton').click(function() {
		if ( $(this).next().hasClass('active')) {
			$(this).next().removeClass('active');
			$(this).next().slideUp('normal');
		} else {
			$('div.contentAccItem').slideUp('normal');
			$('div.contentAccItem').removeClass('active');		
			$(this).next().slideDown('normal');
			$(this).next().addClass('active');
		}
	});

	//HIDE THE DIVS ON PAGE LOAD
	$("div.contentAccItem").hide();

	// SITE INTERN LINKAGE WITHIN TABS
	$('span.intern').click(function() {
		var target = $(this).attr("title");
		$("div#" + target).next(".acc_tab_content").hide();
		$("div#" + target).prev(".acc_tab_content").hide();
		// close all items
		$('div.contentAccItem').slideUp('normal');
		$('div.contentAccItem').removeClass('active');
		//show tap		
		$("div#" + target).show();
		//open accordion		
		$("div#" + target).parent(".contentAccItem").slideDown('normal');
		$("div#" + target).parent(".contentAccItem").addClass('active');		
	});
	
	// TAB FUNCTION
	$(function () {
			var tabContainers = $('div.contentAccItem > div');

			$('div.contentAccItem ul.tabs a').click(function () {
					tabContainers.slideUp();
					tabContainers.filter(this.hash).slideDown();

					$('div.contentAccItem ul.tabs a').removeClass('active');
					$(this).addClass('active');

					return false;
			}).filter(':first').click();
			
	});
	
	// TOOLTIP - OVERLAY KOPFSTAND
	$("div#buttonKopfstand").mouseenter(function(){
		$("div#tooltipKopfstand").fadeIn(100);
	});

	$("div#buttonKopfstand").mouseleave(function(){
		$("div#tooltipKopfstand").fadeOut(500);
	});



	// MODAL WINDOW OVERLAY Settings
	$("a.impressumbox").fancybox({
		'autoScale'	 	: true,
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'type'				: 'iframe',
	});

	$("a.kontaktbox").fancybox({

		'autoScale'	 	: true,
		'type'				: 'iframe',
		'zoomSpeedIn'		: 500,
		'zoomSpeedOut'		: 500,
		'overlayShow'		: true,
		'overlayOpacity'	: 0.3,
		'overlayColor'		: '#000',
		'scrolling'			: 'no',
		'width'				: 650,
		'height'			: 300,

	});
});

