
function slideSwitch() 
{
	if ($('#foto')[0])
	{
	    var $active = $('#thumbs a.current');
	
	    if ( $active.length == 0 ) $active = $('#thumbs a:last');
	
	    var $next =  $active.next().length ? $active.next()
	        : $('#thumbs a:first');
	
		$('#foto').css({'background-image':'url(' + $next[0].getElementsByTagName('img')[0].src.replace('148', '') + ')'});
	    $('#foto img, #fototxt').css({opacity: 1.0})
	        .animate({opacity: 0.0}, 1000, function() {
		        $('#thumbs .current').removeClass('current');
	            $next.addClass('current');
	            $('#foto img')[0].src = $next[0].getElementsByTagName('img')[0].src.replace('148', '');
	            $('#fototxt').html('<a href="' + $next[0].href + '">' + $next[0].getElementsByTagName('img')[0].alt + "</a><br /><span>" + $next[0].getElementsByTagName('img')[0].title + "</span>");
	            $('#fototxt').animate({opacity: 1.0}, 200);
	        });
        }
}
var peepShow;

$(document).ready(function(){

	$('.homehalf div').hover(function()
	{
		$(this).css({'background-color':'#D1D8DF'});		
	},
	function()
	{
		$(this).css({'background-color':'transparent'});
		
	});
	
	$('.homehalf div').click(function()
	{
		if ($('a', this)[0])
		{
			document.location.href = $('a', this)[0].href;
			return false;
		}
	});
	
	$('#thumbs a').click(function()
	{
		$('#thumbs a').removeClass('current');
		$(this).addClass('current');
		clearInterval(peepShow);
		var ur = this.href;
		peepShow = setInterval( "slideSwitch()", 9000 );
		var $next = $(this);
		$('#foto').css({'background-image':'url(' + $next[0].getElementsByTagName('img')[0].src.replace('148', '') + ')'});
	    $('#foto img, #fototxt').css({opacity: 1.0})
	        .animate({opacity: 0.0}, 1000, function() {
		        $('#thumbs .current').removeClass('current');
	            $next.addClass('current');
	            $('#foto img')[0].src = $next[0].getElementsByTagName('img')[0].src.replace('148', '');
	            $('#fototxt').html('<a href="' + ur + '">' + $next[0].getElementsByTagName('img')[0].alt + "</a><br /><span>" + $next[0].getElementsByTagName('img')[0].title + "</span>");
	            $('#fototxt').animate({opacity: 1.0}, 200);
	            
	        });		
			return false;
		
		
		

	});	


	$(function() 
	{
	    peepShow = setInterval( "slideSwitch()", 9000 );
	});
	
	$('#vervolgleft img.rnd').wrap('<div class="img"></div>');
//	$('.img').append('<div class="subtitle">' + this.getElementsByTagName('img')[0].alt + '</div>');
	$('.img').append('<div class="tr"></div>');
	$('.img').append('<div class="tl"></div>');
	$('.img').append('<div class="br"></div>');
	$('.img').append('<div class="bl"></div>');
	
	function do_spons()
	{
		first = $('#spinner a:first').clone();
		$('#spinner a:first').animate(
			{marginTop: "-=40px"},1500)
			.fadeOut(6000, function()
			{
				$(this).remove();
				$('#spinner').append(first);
				do_spons();
			})
			;
	}
	setTimeout(function(){do_spons()}, 6000);
	
	$('#foto').click(function()
	{
		document.location.href = $('a', this)[0].href;
		return false;
	});
	


	$("#lister .item").click(function()
	{
		document.location.href = this.getElementsByTagName('a')[this.getElementsByTagName('a').length-1].href;
		return false
	});

	$('#lister .item').hover(function()
	{
		$(this).css({'background-color':'#D1D8DF'});		
	},
	function()
	{
		$(this).css({'background-color':'transparent'});
		
	});


	$("h1").click(
	function()
	{
		document.location.href = '/';
		return false;
	}
	);
	
	$("#fotoalbum a").fancybox(
	{
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'titlePosition' 	: 'over',
				'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
				    return '<span id="fancybox-title-over"><h3>' + (title?title:'') + '&nbsp;</h3>' +  (currentIndex + 1) + '/' + currentArray.length + '</span>';
				}
	});






	$('a.ver').toggle(
		function()
		{
			$(this).next().show('normal');
			$(this).html('contact &amp; bestuur &laquo;');
			return false;
		},
		function()
		{
			$(this).next().hide('normal');
			$(this).html('contact &amp; bestuur &raquo;');
			return false;
		}
	);
		












	if (top.frames.length>0 && !$('iframe')[0]) {top.location.href="http://www.kndsb.nl/";}


});