function BookStep2Check() {
	var lRet = false;
	
	with(document.forms["BookForm"]) {
		if(isNaN(DepartureDate.length)) {
			DepartureDate.checked = true;
			lRet = true;
		}
		else {
			for(i=0;i<DepartureDate.length; i++) {
				if(DepartureDate[i].checked) 
					lRet = true;
			}
		}
		if(!lRet)	{
			alert(oAlerts.duration);
		} 
		else {
			if(Persons.tagName == "SELECT") {
				if(Persons[Persons.selectedIndex].value=='0') {
					alert(oAlerts.persons);
					Persons.focus();
					lRet = false;
				}
			}
			else {
				if(isNaN(Persons.value)) { 
					alert(oAlerts.persons);
					Persons.focus();
					lRet = false;					
				}
			}
		}
	}
	return lRet;
}

function BookStep3Check() {
	var cPaymentType = ReadRadio(document.getElementsByName("PaymentType"));
	if(Check()) {
		if(!document.getElementById('AgreeConditions').checked) {
			alert(oAlerts.conditions)
			return false;
		}
		if(cPaymentType=='') {
			alert(oAlerts.payment);
			return false;
		}
		else {
			if(cPaymentType=='Withdrawal') {
				with(document.forms['BookForm']) {
					if(PaymentTypeWithdrawalAccount.value=='') {
						alert(oAlerts.bankaccount);
						PaymentTypeWithdrawalAccount.focus();
						return false;
					}
					if(PaymentTypeWithdrawalBank.value=='') {
						alert(oAlerts.bankname);
						PaymentTypeWithdrawalBank.focus();
						return false;
					}
					if(PaymentTypeWithdrawalBankTown.value=='') {
						alert(oAlerts.banktown);
						PaymentTypeWithdrawalBankTown.focus();
						return false;
					}
				}
			}
		}
		return true;
	}
	return false;
}

function CopyTraveller1(oInput,cSource) {
	var oSource=document.getElementById(cSource);
	if(oSource) {
		switch(oInput.tagName) {
			case "SELECT":
				oSource.selectedIndex=oInput[oInput.selectedIndex].index;
			case "INPUT":
				oSource.value=oInput.value;
		}
	}
}

function DisplayCancellationExplanation(checkObj, warningStr) {
	if (warningStr.length >4 && !checkObj.checked) {
		if(confirm(warningStr)) {
		checkObj.checked=false;
			CalculateAndShowPrice();
		}
		else {
			checkObj.checked = true;
			CalculateAndShowPrice();
		}
	}
	else {
		CalculateAndShowPrice();
	}
}

function CalculateAndShowPrice()
{
lCancellation=document.getElementById("CancellationInsurance").checked;
lHandlingCosts=ReadRadio(document.getElementsByName("PaymentType"))=="Mail";


	var oCancellationDisplay = document.getElementById("CancellationInsurancePriceDisplay1");
	var oHandlingCostsDisplay = document.getElementById("HandlingCostsPriceDisplay1");
	var oTravelSumTotalDisplay = document.getElementById("ReservationTotalPriceDisplay")

	if(!lCancellation) {
		oCancellationDisplay.innerHTML = "&euro; 0,00";		
	} else {
		oCancellationDisplay.innerHTML = document.getElementById("CancellationCosts").value;
		
	}
	
	if(!lHandlingCosts) {
	 oHandlingCostsDisplay.innerHTML = "&euro; 0,00";
	} else {
	 oHandlingCostsDisplay.innerHTML = "&euro; "+document.getElementById("DefaultHandlingCosts").value;
	}
	
	if(!lCancellation) {
	 if(!lHandlingCosts) 
	  oTravelSumTotalDisplay.innerHTML = document.getElementById("TravelSumNoCancellationNoHandlingCosts").value;	
	 else 
	  oTravelSumTotalDisplay.innerHTML = document.getElementById("TravelSumNoCancellationWithHandlingCosts").value;	
	} else {
  if(!lHandlingCosts) 
	  oTravelSumTotalDisplay.innerHTML = document.getElementById("TravelSumWithCancellationNoHandlingCosts").value;	
	 else 
	  oTravelSumTotalDisplay.innerHTML = document.getElementById("TravelSumWithCancellationWithHandlingCosts").value;	
	}	
}

function showHidePaymentTypeData(obj) {
	if(obj.value == "Withdrawal")
		if(obj.checked)
			document.getElementById('PaymentTypeWithdrawalData').style.display = 'block';
		else
			document.getElementById('PaymentTypeWithdrawalData').style.display = 'none';
	else
		document.getElementById('PaymentTypeWithdrawalData').style.display = 'none';
}
