$(document).ready(function()
{
    processSlideshow("#content .rechts #afbeelding", slideShow, 5000, 2000);

    

    $('#nieuwsbrief_emailadres').focus(function()
    {
        var defaultText = $(this).val();
        $(this).val('');

        $('#nieuwsbrief_emailadres').blur( function ()
        {
            var userInput = $(this).val();
            if (userInput == '')
            {
                $(this).val(defaultText);
            }
        });
    });
    
    $(".titel_foto, a[rel=foto_groep]").fancybox({
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic',
				
				'overlayColor'		: '#000',
				'overlayOpacity'	: 0.5
    });


    
});



function processSlideshow(elem, imageList, imageDuration, fadeSpeed, current)
{
    var listSize = imageList.length;
    if (!current || current == listSize) current = 0;

    $(elem + " img").attr("src", imageList[current]);
    if (current == (listSize - 1)) { $(elem).css("background", "transparent url(" + imageList[0] + ") no-repeat");
    } else {
        $(elem).css("background", "transparent url(" + imageList[current + 1] + ") no-repeat");
    }
    $(elem + " img").animate({ opacity: "1" }, imageDuration).
	      animate({ opacity: "0.01" }, fadeSpeed, function()
		   {
		     $(this).css("opacity", "1"); processSlideshow(elem, imageList, imageDuration, fadeSpeed, current + 1)
			});


}



