function makeTxt(id,txt){
	var obj = document.getElementById(id);
	obj.firstChild?obj.firstChild.data=txt:obj.appendChild(document.createTextNode(txt))
}

function checkTotal()
{
		var total = 0;
		var totalFormat = "";
		if(document.form1.harga0.checked) {
			total = total + 12000;
		}
		if(document.form1.harga1.checked) {
			total = total + 12000;
		}
		if(document.form1.harga2.checked) {
			total = total + 30000;
		}
		if(document.form1.harga3.checked) {
			total = total + 12000;
		}
		if(document.form1.harga4.checked) {
			total = total + 12000;
		}
		if(document.form1.harga5.checked) {
			total = total + 30000;
		}
		if(document.form1.harga6.checked) {
			total = total + 0;
		}
		if(document.form1.harga7.checked) {
			total = total + 8000;
		}
		if(document.form1.harga8.checked) {
			total = total + 20000;
		}
		totalFormat = formatCurrency(total);
		makeTxt('text2',totalFormat)

}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+'.'+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + 'Rp ' + num);
}
