$(document).ready(function(){

	// open block -- SLIDING -- ************************************************
	$('a.click-link').click(function(){
		$(this).parents('div.news-box').children('div.hidden-text').slideDown();
		$(this).parents('div.txt-special').children('div.hidden-text').slideDown();
		$(this).remove();
		return false;
	});

	// lightbox ****************************************************************
	var _lightboxLink = $('a.lightbox-link, a.lightbox');
	var _currentPost = 1;
	var _last = false;
	var _urlContent = $('a.lightbox-link, a.lightbox').attr('rel');

	/*
		$('a.p-volgende').live('click', function(){
			if (!$('div.popup-text').is(':animated')) {
				$('a.p-vorige').show();
				_currentPost += 1;
				if (_currentPost == _last) $(this).hide();
				if (!$('#popupContent'+_currentPost).length) {
					postLoad();
				} else {
					$('div.popup-text:visible').fadeOut(300, function(){
						$('#popupContent'+_currentPost).fadeIn(300);
					});
				}
			}
			return false;
		});
	
		$('a.p-vorige').live('click', function(){
			if (!$('div.popup-text').is(':animated')) {
				$('a.p-volgende').show();
				_currentPost -= 1;
				if (_currentPost-1 == 0) $(this).hide();
				$('div.popup-text:visible').fadeOut(300, function(){
					$('#popupContent'+_currentPost).fadeIn(300);
				});
			}
			return false;
		});
	
		function postLoad(){
			var _lastBlock = $('div.popup-text:last');
			$.ajax({
				url: _urlContent,
				data: 'textNum='+_currentPost,
				success: function(msg){
					$('div.popup-text:visible').fadeOut(300, function(){
						_lastBlock.after('<div class="popup-text" style="display:none" id="popupContent' + _currentPost + '"></div>');
						$('#popupContent'+_currentPost).fadeIn(300).html(msg);
	
						if ($('#popupContent'+_currentPost).find('.last').length) {
							_last = _currentPost;
							$('a.p-volgende').hide();
						}
					})
				}
			});
		}
	*/

	if (typeof $().simpleLightbox == 'function') {
		_lightboxLink.simpleLightbox({
			faderOpacity: 0,
			faderBackground: '#000000',
			closeLink:'a.sluit'
		});

		$('a.lightbox-link').trigger('click');
	}
});
