
function cent(amount) {
	return (amount == Math.floor(amount)) ? amount + '.00' : (  (amount*10 == Math.floor(amount*10)) ? amount + '0' : amount);
}

function update(form) {
	if (document.getElementById) {
		hoeveelheid1		=	document.getElementById("nummer1")
		hoeveelheid2		=	document.getElementById("nummer2")
		hoeveelheid3		=	document.getElementById("nummer3")
		hoeveelheid4		=	document.getElementById("nummer4")		
		
		sub1				=	document.getElementById("subtotal1")
		sub2				=	document.getElementById("subtotal2")
		sub3				=	document.getElementById("subtotal3")		
		sub4				=	document.getElementById("subtotal4")

		totaal				=	document.getElementById("total")
		
		if(hoeveelheid4.checked)
		   { 
		   sub4.value = '2';
		   }
		   else
		   { 
		   sub4.value = '0';
		   }
		
		var subtotal1 = hoeveelheid1.value * 0.65;
		subtotal1 = Math.floor(subtotal1 * 1000)/1000;
		sub1.value = '€' + cent(subtotal1);
		
		var subtotal2 = hoeveelheid2.value * 0.55;
		subtotal2 = Math.floor(subtotal2 * 1000)/1000;
		sub2.value = '€' + cent(subtotal2);
		
		var subtotal3 = hoeveelheid3.value * 1.40;
		subtotal3 = Math.floor(subtotal3 * 1000)/1000;
		sub3.value = '€' + cent(subtotal3);
		
		var subtotal4 = sub4.value;
		subtotal4 = Math.floor(subtotal4 * 1000)/1000;
		sub4.value = '€' + cent(subtotal4);
		
		total = subtotal1 + subtotal2 + subtotal3 + subtotal4;
		total = Math.round(total * 1000)/1000;
		totaal.value = '€' + cent(total);
		}
}

