$(document).ready(function(){
	$("a#recherche").click(function(){
	$("form#recherche").submit();
	});	
	// map
	$(".googlemap").fancybox({
		'width'				: 950,
		'height'			: 545,
        'autoScale'     	: false,
		'type'				: 'iframe',
		'index'				: 2,
		'centerOnScroll'	: true
	});
	$(".back-map").fancybox({
		'width'				: 950,
		'height'			: 545,
        'autoScale'     	: false,
		'type'				: 'iframe',
		'index'				: 2,
		'centerOnScroll'	: true
	});
	
	$("a[rel=gallery]").fancybox({
		'hideOnContentClick': true,
		'titleShow' : false,
		'transitionIn' : 'elastic',
		'transitionOut' : 'elastic'
		});
	//search
	$("#q").focusin(function(){
			$(this).val("");
	});
	$("#q").focusout(function(){
			if($(this).val()==""){
				$(this).val("Search");
			}
	});
	// liste des pays - map
	$("#pays").change(afficherFicheOffice);
	
	// travel agencies
	$("span#pays2").click(afficherInfosAgencies);
	
	// back to the map link
	if(afficherCarte){
	   afficherMap();
	   }
	
	//scroll des pays
	$("div.texte-defilant").fadeIn();
	$(function(){ $("ul#ticker01").liScroll({travalocity: 0.15}); });
	
	$("#vignette_video").click(function(){
		$(this).css('display','none');
	});
	
});
// map (select)
function afficherFicheOffice(e){
	window.location.href="/en/worldwide-office-map?"+$(this).val();
}
// travel agencies
function afficherInfosAgencies(e){
	//$.fancybox.showActivity();
	$("#travel-agencies-link").fancybox({
		'width'				: 955,
		'height'			: 610,
        'autoScale'     	: false,
		'type'				: 'iframe'
	});
	//$("#travel-agencies-link").attr('href','/en/travel-agency-portal/interline-e-ticketing-apg-iet/?country/'+$(this).val());
	$("#travel-agencies-link").trigger('click');
}
// back to the map
function afficherInfosOffice(url){
	window.location.href="/en/worldwide-office-details/?"+url;
}
function afficherMap(){
	//console.log("AFFICHER MAP");   
	$("#map-fancy-link").fancybox({
		'width'				: 950,
		'height'			: 545,
        'autoScale'     	: false,
		'type'				: 'iframe',
		'index'				: 1500
	});
	$("#map-fancy-link").trigger('click');
}

