// Start functioning when DOM is ready
$( function()
{
	// Get the id if it isset
	if ( window.location.toString().indexOf('#') !== -1 )
		var id = parseInt( window.location.toString().split('#')[1] );
	
	// Check if a news item needs to be opened by default
	if ( typeof id != 'undefined' && id != '' )
	{
		$('.nieuwsitem[rel="'+id+'"] .more').show();
		$('.nieuwsitem[rel="'+id+'"] .less').hide();
	}
	
	$('.nieuwsitem:not(.newshome) .overlay .less').click( function()
	{
		// Recover all visible items
		$('.nieuwsitem .overlay a.more:visible').hide();
		$('.nieuwsitem div.more:visible').hide( 'blind' );
		$('.nieuwsitem .overlay .less:hidden').show();
		
		// Set target
		var t	= $(this).parent();
		var tt	= $(t).parent();
		
		// Open the current item
		$(this).hide();
		$('a.more', t).show();
		$('div.more', tt).show( 'blind' );
		
		return false;
	});
});