$(document).ready(function() {
	nav_port();	
	$("a.volgende").click(function(){	
		$('#port> li:not(:hidden):first').hide("slide");
		
		nav_port();	
		$("a.vorige").css({'visibility':'visible' });
	});	
	$("a.vorige").click(function(){	
		$('#port> li:not(:visible):last ').show("slide");	
		nav_port();	
		$("a.volgende").css({'visibility':'visible' });
	});

	if($('#photo > .fadein').length>1){
		$('#photo').cycle({ fx:'fade', timeout: 40, speed: 3000,  pause:  1, next:  '#photo > .fadein'  });
	}else{
		$('#photo > .fadein').fadeIn(2000);
	}
	$('#imenus0').css({'width':'400px'});
	
	var a=$('.imgBox a:first').attr('href');
	
	if(a!=''){
		$('.imgBox a:first').remove();
		$('#menu .lightbox').attr('href',a);
	}
	
	
	$('.lightbox').fancybox({ 
		'hideOnContentClick': false,
		'fixedNavigation':true,'overlayShow': true
	});
	
	var bodyheight = $('body').height();
	var windowheight = $(window).height();
	var maxHeight=Math.max(bodyheight,windowheight);
	
	if(maxHeight>600){
		$('#fancy_overlay').css({'height':maxHeight});
	}
	
	
		
	
	
});

function nav_port(){
	var n=$('#port> li:not(:visible)').length;
	var n2=$('#port> li:not(:hidden)').length;
	//alert(n);
	//alert(n2);

	if(n==0){
		$("a.vorige").css({'visibility':'hidden' });
	}else{
		$("a.vorige").css({'visibility':'visible' });
	}
	if(n2==3){
		$("a.volgende").css({'visibility':'hidden' });
	}else{
		$("a.volgende").css({'visibility':'visible' });
	}
	
}




