// Used for the shopping basket of SwissPasses.com

// globals
var gMiniBasketIsVisible = false;

//-------------------------------------------------------------
// Toggles the Info div for the clicked on button.
//-------------------------------------------------------------
function toggleMiniBasket()
{
	
	if ( gMiniBasketIsVisible == false ) {
		gMiniBasketIsVisible = true;
		//alert( 'Toggled Mini Basket to Visible' );
		// Show mini basket...
		displayMiniBasket( true );
	} else {
		gMiniBasketIsVisible = false;
		//alert( 'Toggled Mini Basket to Hidden' );
		// Hide mini basket...
		displayMiniBasket( false );
	}
	
	// Stop the browser from following the link, as Javascript is
	// working, and we're displaying the mini-basket dynamically.
	return false;
}


//-------------------------------------------------------------
// Hide/Show the mini basket and other animations...
//-------------------------------------------------------------
function displayMiniBasket( visible )
{
	
	//gTimeout = window.setTimeout( 'showNextSlide()', slideShowDelay );
	
	setBasketHeight( '10px' );
	// Update the toggle triangle button
	var basketToggleBtn = document.getElementById( 'basketLabel' );
	basketToggleBtn.style.backgroundPosition = "12px -70px";
	
	var toggleDelay = 50;
	
	if ( visible == true ) {
		// setting height to '' hopefully makes the entire box visible (ie no height set).
		gTimeout = window.setTimeout( 'showBasket()', toggleDelay );
	} else {
		gTimeout = window.setTimeout( 'hideBasket()', toggleDelay );
	}
	
	
}


//-------------------------------------------------------------
// Change height of Basket displayed.
//-------------------------------------------------------------
function setBasketHeight( heightInPix )
{
	var basketBox = document.getElementById( 'miniBasketBox' );
	//basketBox.style.visibility = "visible";	basketBox.style.display = "block";	
	basketBox.style.height = heightInPix;
}

//-------------------------------------------------------------
// Hide Basket
//-------------------------------------------------------------
function hideBasket()
{
	var basketBox = document.getElementById( 'miniBasketBox' );
	//basketBox.style.visibility = "hidden";	basketBox.style.display = "none";
	// Update the toggle triangle button
	var basketToggleBtn = document.getElementById( 'basketLabel' );
	basketToggleBtn.style.backgroundPosition = "12px 2px";
	//basketToggleBtn.style.backgroundPosition = '';
	// Update the title for the basket link
	basketToggleBtn.title = 'Show the Shopping Basket...';
	
}
//-------------------------------------------------------------
// Show Basket
//-------------------------------------------------------------
function showBasket()
{
	var basketBox = document.getElementById( 'miniBasketBox' );
	//basketBox.style.visibility = "visible";	basketBox.style.display = "block";
	basketBox.style.height = '';
	// Update the toggle triangle button
	var basketToggleBtn = document.getElementById( 'basketLabel' );
	basketToggleBtn.style.backgroundPosition = "12px -105px";
	// Update the title for the basket link
	basketToggleBtn.title = 'Close the Shopping Basket...';
	
}












