// "resize" links
$("a.gallery").each(function() {
	wmax = $(window).width() * 0.5;
	hmax = $(window).height() * 0.5;

	url = $(this).attr('href');
	url = url +  "?w=" + wmax + "&h=" + hmax + "&algo=fill";
	$(this).attr('href',url);

});

$("a.gallery").lightBox();
$('#pp_afb').click(function() {
	$('a.gallery :first').click();
});
$('#pp_afb').css('cursor','pointer');

/*
var grooturl = $('#pp_afb > img').attr('src');
imgas = $("a[class='gallery'] > img").each(function() {
	$(this).mouseenter(function () {
		url = $(this).attr('src');
                url = url.split('?')[0] + "?w=322&amp;h=328&amp;algo=fill";
		$('#pp_afb > img').attr('src', url);
	});
	$(this).mouseleave(function () {
		$('#pp_afb > img').attr('src', grooturl);
	});
});
*/


popup_image_viewer = function() {
	// de foto's
	imgas = $("a[class='gallery'] > img");
	content = "<div id='photos' class='galleryview'>";
	imgas.each(function () {
		url = $(this).attr('src');
		url = url.split('?')[0] + "?w=200&amp;h=200&amp;algo=crop";	
		content += "<div class='panel'>";
		content += "<img src='" + url  + "' />";
		content += "</div>";	
	});	
	content += "<ul class='filmstrip'>";
	imgas.each(function () {
		alt = $(this).attr('alt');
		content += "<li><img src='" + $(this).attr('src')  + "' alt='" + alt  + "' title='" + alt  + "' /></li>";
	});
	content += "</ul>";
	content += "</div>";
}

// zorg dat er alleen getallen in dit vak komen
$('input.p_count').keyup(function () {
	val = $(this).val().replace(/\D/g,'');
	$(this).val(val);
});

// counter
$('.pp_plus').click(function() {
	var currentVal = parseInt($(".p_count").val());
	$(".p_count").val(currentVal + 1);
});
$('.pp_min').click(function() {
	var currentVal = parseInt($(".p_count").val());
	if(currentVal > 1) {
		$(".p_count").val(currentVal - 1);
	}
});

