// JavaScript Document
$(document).ready(function() { //start wanneer alle code excl images geladen zijn
	
	$('#kalenderdrop').change(function(){
		var val = $(this).val();
		window.location.href = BASEHREF+'kalender/'+val;
	});
	
	$('#schoolkeuze').change(function(){
		var val = $(this).val();
		var pag = $(this).attr('lang');
		window.location.href = BASEHREF+pag+'/'+val;
	});
	
	
	$('#infohover').hover(function(){
		$('#infodrop').show();					   
	},function(){
		$('#infodrop').hide();								   
	});
	
	bindToForm('#inlogbutton','#inlogform');
	
	$('a[href=#]').click(function(){ return false });
	initLightbox();
});

$(window).load(function() {  //start pas nadat alle images geladen zijn
	loadColors();
	loadHeights();
});


function loadColors(){
	$('.blok').css({'backgroundColor':KLEUR1}); //maakt gekleurde blokken	
	$('a.sel').css({'backgroundColor':$('a.sel').css('color')});
}

function loadHeights(){
	$('.blok[lang!=noresize]').each(function(){
		var height = $(this).parent().height();	
		$(this).children('.mid').height(height-40);
	});
}


function initLightbox(){
	$("a.fotolightbox").fancybox({
		'zoomSpeedIn':			300, 
		'zoomSpeedOut':			300, 
		'overlayShow':			true,
		'hideOnContentClick':	false,
		'padding':				0
	});
}

function bindToForm(button,form){
	$(button).click(function(){
		$(form).submit();		
		return false;
	});
}
