			function checkAantal() {
				if ( document.forms[0].aantal.value < 1  ) {
					alert ( "Bij aantal graag 1 of meer invullen" );
					return false;
				} else {	
					return true;
				}
			}

$(document).ready(function(){

	if ( mode == 'story' )
	{
		$("#content").hide();
		$("#content").fadeIn('slow');
		
		var $cookie_name = "pal-settings";
		var $cookie_options = { path: '/', expires: 60*24*365 };		
		
		if( $.cookie($cookie_name) ) {
			var $getSize = $.cookie($cookie_name);
			// $("#verhaal").css({fontSize : $getSize + ($getSize.indexOf("px")!=-1 ? "" : "px")});
			$('#body').css('font-size', $getSize);
		} else {} 	
	
	}
	
	$("#close").click(function(){
		$("#search_results").hide();
	});	
	
	$('#search').keyup(function(){
		if ( $('#search').val().length > 3 ) {
			$("#search_results").show();
			$.ajax({
			  url: "/pages/ajax.php?s=" + $('#search').val(),
			  cache: false,
			  success: function(html){
				$("#search_results").html(html);
			  },
			  error: function(){
				$("#search_results").html('Fout tijdens het zoeken, excuses voor het ongemak.');
			  }
			});
		} else {
			$("#search_results").hide();
		}
	});
	
	$(".resetFont").click(function(){
		$.cookie($cookie_name, null, $cookie_options);
		$('#body').css('font-size', '16px');
		$('#content').css('margin-left', '240px');
		$('#content').css('width', '600px');
	});
	
	$(".increaseFont").click(function(){
		var currentFontSize = $('#body').css('font-size');
		var currentFontSizeNum = parseFloat(currentFontSize, 10);

		var currentWidth = $('#content').css('width');
		var currentMargin = $('#content').css('margin-left');
		
		var newFontSize = currentFontSizeNum*1.2;
		var newWidth = parseFloat(currentWidth)+10;
		var newMargin = parseFloat(currentMargin)-10;
		
		if ( newFontSize < 30 )
		{
			$('#body').css('font-size', newFontSize + 'px');
			$.cookie($cookie_name, newFontSize + 'px', $cookie_options);
			if ( newMargin > 210 )
			{
				$('#content').css('width', newWidth + 'px');
				$('#content').css('margin-left', newMargin + 'px');
			}
		}
		return false;
	});
});

/*
textresize : function(){
		// show text resizing links
		$(".FontSize").show();
		var $cookie_name = "sitename-FontSize";
		var originalFontSize = $("html").css("font-size");
		// if exists load saved value, otherwise store it
		if($.cookie($cookie_name)) {
			var $getSize = $.cookie($cookie_name);
			$("html").css({fontSize : $getSize + ($getSize.indexOf("px")!=-1 ? "" : "px")}); // IE fix for double "pxpx" error
		} else {
			$.cookie($cookie_name, originalFontSize);
		}
		// reset link
		$(".FontSizeReset").bind("click", function() {
			$("html").css("font-size", originalFontSize);
			$.cookie($cookie_name, originalFontSize);
		});
		// text "+" link
		$(".FontSizeInc").bind("click", function() {
			var currentFontSize = $("html").css("font-size");
			var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var newFontSize = currentFontSizeNum*1.2;
			if (newFontSize  11) {
				$("html").css("font-size", newFontSize);
				$.cookie($cookie_name, newFontSize);
			}
			return false;	
		});
*/ 


