$(document).ready(function() {
	$('.hidden-checkbox').change( function() {
		if (!$(this).is(':checked')) {
			// haal vinkje weg bij parent checkbox
			input = $(this).parent().prev().prev().prev().prev();
			
			$(input).attr('checked', false);
		}
	});
});

function toggleCheckboxes(obj) {
	$.each(
			$('.subchecks :input', $(obj).parent()), 
			function() {
				$(this).attr('checked', $(obj).is(':checked'));
			}
	);
	checkAantal(obj);
}



function checkAantal(obj) {
	$.get(window.location + '?type=99',
		{form: $(obj.form).serialize()},
		function(data) {
			$.each(
				jQuery.parseJSON(data),
				function(index, value) {
					$.each(value, function(index, value) {
						$('#' + index + ' + label').find('span.aantal').text(value);
				});
			}
		);
	});
}