function calc_total() {
	var subtotal=total=tax=0;
	if (document.getElementById('student').checked==true){
		var prices=student_prices;
	} else {
		var prices=regular_prices;
	}

	for (var item in prices) {
		
		if (document.getElementById(prices[item].field) && document.getElementById(prices[item].field).checked==true) {
			subtotal+=prices[item].price;
		}
	}

	//if (document.getElementById('type').value=="Single room"){
	//	total+=single_room_price*document.getElementById('number_of_nights').value;
	//}
	//if (document.getElementById('type').value=="Twin room"){
	//	total+=twin_room_price*document.getElementById('number_of_nights').value;
	//}

	if (document.getElementById('j_j_course').checked==true) {
		subtotal+=j_j_course_price;
	}

	if (document.getElementById('accompanying_persons').value>0) {
		subtotal+=accompanying_person_price*document.getElementById('accompanying_persons').value;
	}
	
	tax=(taxpercent/100)*subtotal;
	
	total=subtotal+tax;
	$('#subtotal').fadeOut(100);
	$('#tax').fadeOut(100);	
	$('#total').fadeOut(100, function() {
		$('#subtotal').html(subtotal.toFixed(2)+" &euro;");
		$('#tax').html(tax.toFixed(2)+" &euro;");
		$('#total').html(total.toFixed(2)+" &euro;");
	});
	
	$('#subtotal').fadeIn(100);
	$('#tax').fadeIn(100);	
	$('#total').fadeIn(100);
	
	return true;
}

function make_initials() {
	var firstname=document.getElementById('firstname').value;
	var parsename=firstname.replace("-"," ");
	var tmp=parsename.split(" ");
	var initial="";
	for (var part in tmp) {
		if (tmp[part][0]!=undefined) {
			if (initial.length>0) { initial+=" "; }
			initial+=tmp[part][0]+".";
		}
	}
	document.getElementById('initial').value=initial;
}
