

jQuery(document).ready(function() {


/* ACCORDION */


	//mit flexibler hoehe
	jQuery('.accordion_typ1, .accordion_typ2').accordion({
		active: false,
		header: '.head',
		navigation: true,
		active: '.selected',
		event: 'click',
		//animated: 'easeslide',
		alwaysOpen: false,
		autoheight: false
	});



	function formatText(index, panel) {
	  return index + "";
	}

	jQuery(function () {
	
		jQuery('.anythingSlider_typ1').anythingSlider({
			easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
			autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
			delay: 5000,                    // How long between slide transitions in AutoPlay mode
			startStopped: false,            // If autoPlay is on, this can force it to start stopped
			animationTime: 500,             // How long the slide transition takes
			hashTags: false,                // Should links change the hashtag in the URL?
			buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
			pauseOnHover: false,            // If true, and autoPlay is enabled, the show will pause on hover
			startText: "Go",             	// Start text
			stopText: "Stop",               // Stop text
			navigationFormatter: formatText // Details at the top of the file on this use (advanced use)
		});

		
	});
	




	function setWidth() {
		/*carousels - breite fuer ul setzen*/
		jQuery('.anythingSlider ul').each(function() {
			var li_count 	= jQuery(this).find('li').length;
			var li_width 	= parseInt( jQuery(this).find('li').width() );
	
			var ul_sum		= li_count*li_width;
			jQuery(this).css('width', ul_sum);
		});
	}
	setWidth();
	

	/* prev-link im carouselpager flexibel machen */
	/* gezählt wird die pager-link-anzahl, nicht die li's, wegen der cloned li's */
	jQuery('.workspace .anythingSlider').each(function() {
		var pL_count 	= jQuery(this).find('.thumbNav a').length;
		var pL_width 	= parseInt( jQuery(this).find('.thumbNav a').css('width') );
		var pL_margin	= parseInt( jQuery(this).find('.thumbNav a').css('margin-right') );
		var thNav_right	= parseInt( jQuery(this).find('.thumbNav').css('right') );

		var pl_sum		= pL_count*(pL_width+pL_margin)+thNav_right+pL_margin;
		jQuery(this).find('.back').css('right', (pl_sum+'px'));
	});
	

	jQuery('#carouselDiv').addClass("accordCarouselLoad");
	jQuery('a#carousel').click();

	jQuery('a#carousel').click(function() {
		jQuery('.thumbNav').children().click();
	});								




	// detailansicht slider

	jQuery('a.close, .detail').click(function() {
	    jQuery('.detail').fadeOut('fast', function() {
        	// Animation complete
      	});
		jQuery('#carousel .box h3').css('color','#000');
		return false;
	});
	jQuery('#carousel').click(function() {
		jQuery('#carousel .box h3').css('color','#000');
	});

	jQuery(".inhalt .pic img").click(function() {
	    jQuery(this).parent().parent().parent().find('.detail').fadeIn('fast', function() {
        	// Animation complete
      	});
		jQuery('#carousel .box h3').css('color','#FFF');
	});


	var ct_slides = jQuery('.thumbNav').children().size();
	var slider_pos = (280+((5-ct_slides)*15));

	if(ct_slides < 5) {
		jQuery('.thumbNav').css('left',slider_pos+'px')
	}


});
