$(function() {
		   
	// header images
	$('#header-images').innerfade({ speed: 'slow', timeout: 5000, type: 'random'}); 
	
	// sponsers
	$('#sponsers').innerfade({ speed: 'slow', timeout: 4000, type: 'sequence'}); 
	
	// left menu
	$('#left-menus ul li').each(function() {
		$(this).find('ul li:last a').css('border-bottom', '0');
	});
	
	$('#left-menus > ul > li > a').click(function(evt) {
		
		if (evt.target == $('#left-menus > ul > li > a.active-menu')[0]) {
			$(this).removeClass('active-menu').next().slideUp('slow');
			return false;
		}
		
		$('#left-menus > ul > li > a').each(function() {
			$(this).removeClass('active-menu').next().hide();
		});
		
		if ($(this).next().is(':hidden')) {
			$(this).addClass('active-menu').next().slideDown('slow');
		} else {
			$(this).removeClass('active-menu').next().slideUp('slow');
		}
		
		return !$(this).next().is('ul');
	});
	
	// search field
	$('#search').focus(function() {
		var value = $(this).val();
		
		if (value == 'Zoeken op deze website') {
			$(this).val('');
		}		
	}).blur(function() {
		var value = $(this).val();
		
		if (value == '') {
			$(this).val('Zoeken op deze website');
		}
	});
	
	// search form
	$('#search-form').submit(function() {
		var value = $('#search').val();
		
		if (value == '') {
			alert('Geef iets te zoeken');
			$('#search').val('').focus();
			return false;
		} else if (value.length < 3) {
			alert(' U dient minimaal 3 letters op te geven. Probeer opnieuw a.u.b.');
			$('#search').focus();
			return false;
		}
		
		return true;
	});
		
	// news items right
	$('#news-block > ul > li > a').click(function() {
		
		if ($(this).next().is(':visible')) {
			$(this).next().slideUp('fast');
			return false;
		}
		
		$('#news-block > ul > li > a').each(function() {
			$(this).next().hide();
		});
		
		if ($(this).next().is(':hidden')) {
			$(this).next().slideDown('slow');
		} else {
			$(this).next().slideUp('fast');
		}
		
		return false;
	});
	
	$('#news-block > ul > li > a:first').next().show();
});
