// FUNCTIONS FOR DESTINATION PAGE
// =====================================================

function setFaqs()
{
	$('dl').mousedown(function(){
		$(this).toggleClass('fold');
	});
};

function setLastElements()
{
	$('.box-info div.item:first').css('padding-top','0');
	$('.box-info div.item:first').css('background-position','10px 6px');
	$('.box-info .content dl:first').css('padding-top', '0');
};

function showPhotos()
{
	var currentURL = window.location.pathname;
	// check op slash aan eind
	var newURL = currentURL.substr(currentURL.length-1) == '/' ? currentURL + 'fotos' : currentURL + '/fotos/';
	//window.open( newURL ,'tripPhotos','width=570,height=500');
	var day = new Date();
	var id = day.getTime();
	eval( "page"+ id +" = window.open( '"+ newURL +"', '"+ id +"', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=570,height=500,left = 675,top = 350' );" );
};

function showDatesPrices()
{
	var currentURL = window.location.pathname;
	// check op slash aan eind
	var newURL = currentURL.substr(currentURL.length-1) == '/' ? currentURL + 'data-en-prijzen' : currentURL + '/data-en-prijzen';
	window.open( newURL ,'tripDatesPrices','width=570,height=500,scrollbars=yes');
};


function startSelectionScroll()
{
	
	//alert("startselectionscroll");
	
	//var currentURL = window.location.href;
	//var newURL = currentURL.substr(currentURL.length-1) == '/' ? currentURL.substr(currentURL.length-1) + '#startSelection' : currentURL + '#startSelection';
	//var newURL = currentURL + '#startSelection';
	
	//var newURL = ( currentURL.substr(currentURL.length-1) == '/' ) ? currentURL.substr(currentURL.length-1) + '#startSelection' : currentURL + '#startSelection';
	
	
	
//	alert( newURL );
	
	//#startSelection
	
//	
//	var currentURL = window.location.href;
//	var newURL = currentURL + "#startSelection";
//	window.location.href = newURL;
};


// Photobox with Map & Photo
// -----------------------------------------------------
function setPhotobox()
{

	var bImages = ( isSet( top.bImages ) ) ? top.bImages : "";
	var tFlashVars = {sImages:bImages};
	var tParams = {wmode:"transparent"};

	if( bImages != ""){
		$('.trip-photos').prepend('<div id="photobox"></div>');
		swfobject.embedSWF("/swf/photobox_reis.swf", "photobox", "480", "200", "8.0.0", "", tFlashVars, tParams );
	}
};

function setPhotobox2() {
	var tFlashVars = {
		XMLPath:"xmldata.php"
	};
	
	var tParams = {
		wmode:"transparent"
	};
	
	$('.trip-photos').prepend('<div id="photobox"></div>');
	swfobject.embedSWF("/swf/photobox_reis.swf", "photobox", "496", "224", "9.0.0", "", tFlashVars, tParams );
	
}

// On Document Ready
// Initiate functions
$(document).ready(function()
{

	//	Check for bImages - if var is found, show the photobox through 'setPhotobox' function
	/*var bImages = ( isSet( top.bImages ) ) ? top.bImages : "";
	if( bImages != "" ) setPhotobox();*/

	// Show popup with Dates & Prices
	// (invoked when clicking on a price-link or the general link below the table)
	$(".box-dataprijzen a").click(function(){ showDatesPrices(); });
			
	setFaqs();
	setLastElements();
	
});