$(function() {
	$(':checkbox').change(function(object) {
	//refreshForm(false); 
		orderItemId = object.target.id;
		packageId = object.target.value;
		addItem = object.currentTarget.checked;
		referrer = object.currentTarget.baseURI;
		
	
		$.ajax({
			//type : 'GET',
			url : referrer,
			data :"&packageId=" + packageId + "&orderItemId=" + orderItemId + "&addItem=" + addItem,
			dataType: 'json',
			success : function(response) {
				$.each(response, function(p, i){
					$("#price_"+p).html('€ '+i.customPackagePrice); // we might need to make some hidden variable which contains the currencySymbol
					$('input[name="selectedItems'+p+'"]').val(i.orderItems);
					if (i.optionalAmount){ // if there is an optional amount we can try to show it to the customer
						$.each(i.optionalAmount, function(key, id){
							$("#mandatoryAmount"+key).html(" ("+ id+"x)");
				
						});
					}
				});
				
			}
		}); // close ajax
	
	});
	
}); // close jquery function

