
$(document).ready(function() {
	
	/* Tab - Initialisierung
	-------------------------*/
	$(".tabs").accessibleTabs({
        tabhead: '.csc-header h1:first-child, .csc-header h2:first-child',
		tabbody: '.csc-default',
        fx: "fadeIn",
		currentInfoText: 'Aktiver Tab:',
		tabheadRemove: true
    });
	
	
	
	/* Accordion - Initialisierung
	-------------------------------*/
	//Content wrappen
	$('.accordion .csc-default').wrapInner('<div class="acdContent" />');
	
	//Nav-Header vor Content-Wrap einfuegen
	$('<a href="#" class="acdHeader"></a>').insertBefore('.accordion .acdContent');
	
	//CSC-Header Values den jeweiligen Nav-Header zuweisen & urspruenglichen CSC-Header entfernen
	$.each($('.accordion .csc-default'), function() {
		
		navItem = $(this).children('.acdContent').children('.csc-header');
		navItemVal = navItem.children().text();
		$(this).children('.acdHeader').text(navItemVal);
		navItem.remove();
	
	});
	
	//Init
	$(".accordion").accordion({
		header: 'a.acdHeader',
		autoHeight: false,
		active: false,
		collapsible: true
	});
	
	
	
	/* IndexedSearch RatingBar - Initialisierung
	---------------------------------------------*/
	$('.tx-indexedsearch-res .rating').addClass('ratingBar');
		
	$.each($('.tx-indexedsearch-res .ratingBar'), function() {
		$(this).children('.ratingFill').attr('style', 'width:'+$(this).children('.ratingVal').text());
	});
	
	
	
	/* Nummerierte Header 
	----------------------*/
	$.each($('.csc-firstHeader'), function() {
		
		var val = $(this).text();
		if(val.match(/^\[[0-9]\]/)) {
			val = val.replace('[', '<span class="orderedHead">');
			val = val.replace(']', '</span>');
			$(this).html(val);
		}
		
	});
	
	
	
	/* Eyecatcher-Slogan-Animation
	-------------------------------*/
	if ( $('#eyecatcherKpSloganAni').length ) {
		
		var tOut = window.setTimeout( function() {
			//Slide starten
			picSlide();
			//MouseOver-Funktionalität einbinden
			$('<div class="controlButton"></div>').insertBefore('#eyecatcherKpSloganAni .pic1');
			$('#eyecatcherKpSloganAni .controlButton').css('width', $('#eyecatcherKpSloganAni').width()).css('height', $('#eyecatcherKpSloganAni').height());
			$('#eyecatcherKpSloganAni .controlButton').mouseover(function(){ picSlide(); });
		}, 5000);
				
		function picSlide() {
			if( $('#eyecatcherKpSloganAni .pic1').is(':visible') ) {
				$('#eyecatcherKpSloganAni .pic2').fadeIn(1300);
				$('#eyecatcherKpSloganAni .pic1').fadeOut(1300);
			} else {
				$('#eyecatcherKpSloganAni .pic1').fadeIn(1300);
				$('#eyecatcherKpSloganAni .pic2').fadeOut(1300);
			}
		}
		
	}
});








