// Frontpage Slider
jQuery.noConflict()
jQuery(document).ready(function($) {				
	// Frontpage Slider

	$('#slider-wrapper').loopedSlider({
		autoStart: 8000, 
		containerClick: false
	});
	var tabs = $("ul.tabs").tabs("div.panes > div" );
	
	
	$("#c2a-submit").click(function() {
		$("form.wpcf7-form").submit();
	});
	
	
	// We only want these styles applied when javascript is enabled
	$('div.content').css('display', 'block');



	// Initially set opacity on thumbs and add
	// additional styling for hover effect on thumbs
	var onMouseOutOpacity = 1;
	$('#thumbs ul.thumbs li').opacityrollover({
		mouseOutOpacity:   onMouseOutOpacity,
		mouseOverOpacity:  0.67,
		fadeSpeed:         'fast',
		exemptionSelector: '.selected'
	});
	
	// Initialize Advanced Galleriffic Gallery
	if($('ul.thumbs').children().length > 0) {
		var gallery = $('#thumbs').galleriffic({
			delay:                     5000,
			numThumbs:                 15,
			preloadAhead:              10,
			enableTopPager:            true,
			enableBottomPager:         true,
			maxPagesToShow:            7,
			imageContainerSel:         '#slideshow',
			controlsContainerSel:      '#controls',
			captionContainerSel:       '#caption',
			loadingContainerSel:       '#loading',
			renderSSControls:          true,
			renderNavControls:         true,
			playLinkText:              'Play Slideshow',
			pauseLinkText:             'Pause Slideshow',
			prevLinkText:              '&lsaquo; Vorige afbeelding',
			nextLinkText:              'Volgende afbeelding &rsaquo;',
			nextPageLinkText:          'Volgende &rsaquo;',
			prevPageLinkText:          '&lsaquo; Vorige',
			enableHistory:             false,
			autoStart:                 true,
			syncTransitions:           true,
			defaultTransitionDuration: 1500,
			onSlideChange:             function(prevIndex, nextIndex) {
				// 'this' refers to the gallery, which is an extension of $('#thumbs')
				this.find('ul.thumbs').children()
					.eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
					.eq(nextIndex).fadeTo('fast', 1.0);
			},
			onPageTransitionOut:       function(callback) {
				this.fadeTo('fast', 0.0, callback);
			},
			onPageTransitionIn:        function() {
				this.fadeTo('fast', 1.0);
			}
		});
	}

	jQuery('#cases-container').show();
	if($('#cases-container').children().length > 8) {
		$('#cases-container').easyPaginate({
			step:8
		});
	} else {
		$('#cases-container').children().each(function(i){
			var child = $(this);
			child.hide();
			setTimeout(function(){ child.fadeIn('fast') }, ( i-( Math.floor(i/8) * 8) )*200 );
		});	
	}
	jQuery('#cases-container-12').show();
	if($('#cases-container-12').children().length > 12) {
		$('#cases-container-12').easyPaginate({
			step:12
		});
	} else {
		$('#cases-container-12').children().each(function(i){
			var child = $(this);
			child.hide();
			setTimeout(function(){ child.fadeIn('fast') }, ( i-( Math.floor(i/12) * 12) )*200 );

		});	
	}	
	jQuery('#bericht-container').show();
	if($('#bericht-container').children().length > 6) {
		$('#bericht-container').easyPaginate({
			step:6
		});
	} else {
		$('#bericht-container').children().each(function(i){
			var child = $(this);
			child.hide();
			setTimeout(function(){ child.fadeIn('fast') }, ( i-( Math.floor(i/12) * 12) )*200 );

		});	
	}	
	if ($('.featured_item').length > 0 ) {
		$('#featured').levitate({  
			duration:500, 					      // transition duration 
			transition:"easeInOutCubic", 	      // transition easing
			opacity:1,					          // opacity of second row
			opacity_level2:1,				      // opacity of third row
			autoStart: my_inuitslider.autoStart   // interval between auto rotate, set to false if you want to disable outorotation
		});
	}
});
