$(document).ready(function () {	
	//Variabele
	var parent = ".slideshow ";
	var fadespeed = 200;
	var fadeslow = 750;
	var timer = 10000;
	//Eerste element infaden
	$(parent+ ".slide:first-child").fadeIn(fadespeed, function(){
		$(parent+ ".slide:visible span").slideDown(fadespeed);
	});
	//Stel timer in voor auto sliden	
	function startSlide()
	{  
		interval = setInterval(autoSlide, timer);  
	}
	//Denkwerk
	function slideCode(){
		$(parent+ ".slide:visible span").slideUp(fadespeed, function(){
			if ($(parent+ ".slide:visible").next().length == 0){
				$(parent+ ".slide:first-child").fadeIn(fadespeed);
				$(parent+ ".slide:last-child").fadeOut(fadeslow, function(){
					$(parent+ ".slide:visible span").slideDown(fadespeed);
				});
			}
			else{
				$(parent+ ".slide:visible").next().fadeIn(fadeslow, function(){
					$(parent+ ".slide:visible").prev().hide();
					$(parent+ ".slide:visible span").slideDown(fadespeed);
				});
			}
		});
	}
	//Voer denkwerk uit
	function autoSlide()
	{
		slideCode();
	}
	//Slider stop zetten
	function resetSlide()
	{  
		clearInterval(interval);			
	}
	startSlide();
});


/*$(document).ready(function () {						
						//jCarousel Plugin
						$('#carousel').jcarousel({
							vertical: true,
							scroll: 1,
							auto: 1,
							wrap: 'last',
							initCallback: mycarousel_initCallback
						});
						
						//Set auto slide. Slide speed in milliseconden
						var slideSpeed = 5000;
						function startSlide()  
						{  
							interval = setInterval(autoSlide, slideSpeed);  
						}
						//Auto slide
						var countEq = 0;
						var countEl = $('div#slideshow-main li').size();
						function autoSlide(){
							//Big images
							var largeHolder = $('div#slideshow-main li');
							//Nav images
							var smallHolder = $('div#slideshow-carousel li a');
							largeHolder.eq(countEq).removeClass("active").hide(1, function(){
								smallHolder.eq(countEq).children('img').css({'opacity': '0.5'});
								smallHolder.eq(countEq+1).children('img').css({'opacity': '1.0'});
								$(this).next('div#slideshow-main li').addClass("active").show(1);
							});
							if (countEq == (countEl-1)){
								countEq = 0;
								largeHolder.eq(countEq).addClass("active").show(1);
								smallHolder.eq(countEq).children('img').css({'opacity': '1.0'});
							}
							else{
								countEq++;
							}
						}
						//Clear slider
						function stopSlide()  
						{
							clearInterval(interval);				
						}
						//Start slider
						startSlide();

						//Front page Carousel - Initial Setup
						$('div#slideshow-carousel a img').css({'opacity': '0.5'});
						$('#slideshow-carousel li a span').css({'opacity': '0.8'});
						$('div#slideshow-carousel a img:first').css({'opacity': '1.0'});
						//$('div#slideshow-carousel li a:first').append('<span class="arrow"></span>')

					  
						//Combine jCarousel with Image Display
						$('div#slideshow-carousel li a').hover(
							function () {
									
								if (!$(this).has('span').length) {
									$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
									$(this).stop(true, true).children('img').css({'opacity': '1.0'});
								}		
							},
							function () {
									
								$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
								$('div#slideshow-carousel li a').each(function () {

									if ($(this).has('span').length) $(this).children('img').css({'opacity': '1.0'});

								});
									
							}
						).click(function () {

							//$('span.arrow').remove();        
							//$(this).append('<span class="arrow"></span>');
							//Stop slider
							stopSlide();
							$('div#slideshow-main li').removeClass('active');        
							$('div#slideshow-main li.' + $(this).attr('rel')).addClass('active');	
							return false;
						});
				});


				//Carousel Tweaking

				function mycarousel_initCallback(carousel) {
					
					// Pause autoscrolling if the user moves with the cursor over the clip.
					carousel.clip.hover(function() {
						carousel.stopAuto();
					}, function() {
						carousel.startAuto();
					});
				}
					*/
