// Swiss Rail Passes - Transfer Ticket Form, step 1.
// globals
var gXXX = '';
//-------------------------------------------------------------
// Handle validating user input data on this form, before the form
// is sent to the backend for real processing...
//-------------------------------------------------------------
function initializeForm()
{
	//alert( 'initializeForm() is working' );
	
	// If both the dropdown menus are set to Zero, then disable the Next... button.
	disableStuffIfBasketIsEmpty();
}
//-------------------------------------------------------------
// Disable the *Order* button, the Update Basket button and the Currency drop menu
//-------------------------------------------------------------
function disableStuffIfBasketIsEmpty()
{
	// If both the dropdown menus are set to Zero, then disable the Next... button.
	var changeCurrencyDropMenu = document.getElementById( 'changeCurrency' );
	var updateBasketButton = document.getElementById( 'updateBtn' );
	var orderButton = document.getElementById( 'submit' );
	
	if ( gTotalItemsInBasket < 1  ) {
		changeCurrencyDropMenu.disabled = true;
		
		updateBasketButton.disabled = true;
		removeClassName ( updateBasketButton, 'updateBtn' );
		addClassName ( updateBasketButton, 'updateBtnDisabled' );
		
		orderButton.disabled = true;
		removeClassName ( orderButton, 'orderBtn' );
		addClassName ( orderButton, 'orderBtnDisabled' );
		
	}
}
//-------------------------------------------------------------
// Handle validating user input data on this form, before the form
// is sent to the backend for real processing...
//-------------------------------------------------------------
function updateCurrency()
{
	//alert( 'changeCurrency() is working' );
	var form = document.getElementById( 'editBasketForm' );
	var hiddenCurrField = document.getElementById( 'autoCurrencyUpdate' );
	
	// update the value of the hidden field that controls whether or not
	// the submitted form acts as a Currency updater or just normal add to 
	// basket...
	hiddenCurrField.value = 'yes';
	
	form.submit();
	
}