$('.factbox.fact').each(
	function(index)
	{
		$(this).append('<span class="bold label block">Feit</span>');
	}
);
$('.factbox.non_fact').each(
	function(index)
	{
		$(this).append('<span class="bold label block">Geen feit</span>');
	}
);
$('.factbox.quote').each(
	function(index)
	{
		$(this).append('<span class="bold label block">Quote van: '+$(this).attr('quote_from')+'</span>');
	}
);
$('.factbox.comment').each(
	function(index)
	{
		$(this).append('<span class="bold label block">Commentaar/toevoeging van auteur</span>');
	}
);
$('.content_boxes_box_header').click(
	function()
	{
		if($(this).parent().hasClass('flipped'))
		{
			$('.content_boxes_box_content', $(this).parent()).slideDown('fast');
		} else {
			$('.content_boxes_box_content', $(this).parent()).slideUp('fast');
		}
		$(this).parent().toggleClass('flipped');
	}
);
$('.bible_text').click(
	function()
	{
		var $left = $(this).offset().left + $(this).width()/2;
		var $top = $(this).offset().top + $(this).height()/2;
		
		$left = $left - $('#scripture_box').width()/2;
		$top = $top - $('#scripture_box').height()/2;
		
		if($left < 0) { $left = 0; }
		
		$('#scripture_box').css({left: $left, top: $top});
		$('#scripture_box').fadeIn(500);
	}
);
$('#scripture_box').click(
	function()
	{
		$(this).fadeOut(500);
	}
);
$('#scripture_box').hide();
$('textarea').keyup(
	function(event){
		if($(this).attr('scrollHeight') < 250)
		{
			$(this).css('overflow', 'hidden');
			$(this).height(0);
			$(this).height($(this).attr('scrollHeight') + 30);
		} else {
			$(this).css('overflow', '');
			$(this).height(250);
		}
	}
);
$('textarea').keyup();
