var TotalPrice=0;
var AccoPrice=0;
var Price=0;
var TransPrice =0;

//	Add additional Fees to document		
window.onload = function()
{
if(EnrollmentFee >0){
enf = document.createTextNode(' + Enrollment fee (' + EnrollmentFee + ' €)');	
document.getElementById('EnFee').appendChild(enf)  ;
}
if(PlacementFee >0){
plf = document.createTextNode(' + Placement fee (' + PlacementFee + ' €)');	
document.getElementById('plafe').appendChild(plf)  ;
}
calcCourse();
}
// Main Function Price calculation
function calcCourse()
{
var Course = document.anmeldung.course_type.selectedIndex  ;
var Week = document.anmeldung.course_weeks.selectedIndex;
Price= CoursePrices[Course][Week];
Price= Price + EnrollmentFee;
document.anmeldung.course_fee.value = Price;
calcTotPrice()
}

// Funktionen Accomodation

function calcAcco()
{
var Aloj = document.anmeldung.accommodation_type.selectedIndex;
var Semanas=document.anmeldung.accommodation_weeks.selectedIndex;
var Week = document.anmeldung.course_weeks.selectedIndex;
if (Aloj > 0 && Semanas > 0)
{
AccoPrice= AccoPrices[Aloj-1][Semanas-1];
AccoPrice= AccoPrice + PlacementFee;
}
else{
	if(Aloj > 0 && Semanas == 0)
	{
	document.anmeldung.accommodation_weeks.selectedIndex = (Week+1);
	AccoPrice= AccoPrices[Aloj-1][Week];
	AccoPrice= AccoPrice + PlacementFee;
	}
	if(Aloj ==0){
		document.anmeldung.accommodation_weeks.selectedIndex = 0;
		AccoPrice = 0
		}
	
	}
	document.anmeldung.accommodation_fee.value= AccoPrice ;  
	calcTotPrice()
}
// Transfer Price
function calcTransPrice()
{	
if(Transfer.length > 0)
{
var calcFakt = 0;
		TransPrice = 0;
	for(i=0; i< Transfer.length; i++)
	{var transfname = "transfer" + i;
	if(document.anmeldung[transfname].checked == true)
		 {
	calcFakt = 1;
		 }
		 else{calcFakt = 0;
		 }
	TransPrice = TransPrice + Transfer[i]*calcFakt ;
		 }
		calcTotPrice();
}
		}
//Function Calculate Total Price
 function calcTotPrice()
 {
TotalPrice= Price + AccoPrice + TransPrice;

document.anmeldung.total_fee.value=TotalPrice;
}