jQuery.noConflict();

jQuery(document).ready(function($) {
	
    ////////////////// ALERTE FLASH   /////////////////////////
	try{
    var strurl = new String(document.location).toUpperCase();

    if (strurl.indexOf('/WIFI/FR-FR') > -1)
        $('#div_alert').load('http://services.aeroportsdeparis.fr/ADP.AlerteFlash/default.aspx?TARGET=2&lang=fr #div_alert');

    if (strurl.indexOf('/WIFI/EN-GB') > -1) 
        $('#div_alert').load('http://services.aeroportsdeparis.fr/ADP.AlerteFlash/default.aspx?TARGET=2&lang=en #div_alert');

    if (div_alert.innerHtml == "")
        div_alert.style.display = "none";
		}
	catch(err){}
    ////////////////// ALERTE FLASH   /////////////////////////
	
    //JCAR sur SHP infovol : actus des compagnies
    //En commentaire car posé sur un fichier indépendant (init_carrousel_infocie.js), appelé uniquement dans la ss-home VOL
    //pour éviter d'appeler le plugin sur toutes les pages du site
    /*jQuery('.actus-compagnies ul').jcarousel({
    auto: 5,
    wrap: 'circular',
    scroll : 1
    });
	*/

	jQuery('#bt-fermer img').hover(
		function(){
			jQuery('#bt-fermer img').attr('src', $('#bt-fermer img').attr('src').replace(/.gif/g, '_on.gif'));
		},
		function(){
			jQuery('#bt-fermer img').attr('src', $('#bt-fermer img').attr('src').replace(/_on.gif/g, '.gif'));
		}
	);
	
	jQuery('#expand-bt').click(function() {
		if(jQuery('#expand').hasClass('on')){
			
		}else{
			jQuery('#expand').addClass('on');
			jQuery('#expand-content').animate({
				left:'0'
			}, 400, function(){
			});
		}
	});
	
	jQuery('#bt-fermer').click(function() {
		if(jQuery('#expand').hasClass('on')){
			jQuery('#expand').removeClass('on');
			jQuery('#expand-content').animate({
				left:'-750'
			}, 400, function(){
			});
		}else{
			
		}
	});
	
	jQuery('#bt-pars').click(function() {
		if(jQuery(this).hasClass('on')){
		
		}else{
			jQuery('#expand-menu li').removeClass('on');
			jQuery(this).addClass('on');
			jQuery('#expand-theme #accompagne').hide();
			jQuery('#expand-theme #jarrive').hide();
			jQuery('#expand-theme #transit').hide();
			jQuery('#pars').show();
		}
	});
	jQuery('#bt-accompagne').click(function() {
		if(jQuery(this).hasClass('on')){
		
		}else{
			jQuery('#expand-menu li').removeClass('on');
			jQuery(this).addClass('on');
			jQuery('#expand-theme #pars').hide();
			jQuery('#expand-theme #jarrive').hide();
			jQuery('#expand-theme #transit').hide();
			jQuery('#accompagne').show();
		}
	});
	jQuery('#bt-arrive').click(function() {
		if(jQuery(this).hasClass('on')){
		
		}else{
			jQuery('#expand-menu li').removeClass('on');
			jQuery(this).addClass('on');
			jQuery('#expand-theme #pars').hide();
			jQuery('#expand-theme #accompagne').hide();
			jQuery('#expand-theme #transit').hide();
			jQuery('#jarrive').show();
		}
	});
	jQuery('#bt-transit').click(function() {
		if(jQuery(this).hasClass('on')){
		
		}else{
			jQuery('#expand-menu li').removeClass('on');
			jQuery(this).addClass('on');
			jQuery('#expand-theme #pars').hide();
			jQuery('#expand-theme #accompagne').hide();
			jQuery('#expand-theme #jarrive').hide();
			jQuery('#transit').show();
		}
	});
	
	//ONGLET
	jQuery('.onglet-ory').css('opacity','0').hide();
	
	jQuery('.onglet-acess-airport .ory').click(function() {

		if(jQuery('.onglet-acess-airport .ory').hasClass('on-ory')){
			
		}else{
			
			jQuery('.onglet-cdg').animate({
				opacity: 0
			}, 150, function() {
				jQuery('.onglet-acess-airport .ory').addClass('on-ory');
				jQuery('.onglet-acess-airport .cdg').removeClass('on-cdg');
				jQuery('.onglet-ory').show();
				jQuery('.onglet-ory').animate({
					opacity: 1
				}, 150, function() {
					
				});
			});
		}
														
	});
	
	jQuery('.onglet-acess-airport .cdg').click(function() {
		
		if(jQuery('.onglet-acess-airport .cdg').hasClass('on-cdg')){
			
		}else{
			jQuery('.onglet-ory').animate({
				opacity: 0
			}, 150, function() {
				jQuery('.onglet-acess-airport .cdg').addClass('on-cdg');
				jQuery('.onglet-acess-airport .ory').removeClass('on-ory');
				jQuery('.onglet-ory').hide();
				jQuery('.onglet-cdg').animate({
					opacity: 1
				}, 150, function() {
					
				});
			});
		}
														
	});
	
	//NYROMODAL
	jQuery('a.nyroModal').nyroModal(
		{
			bgColor: '#ffffff',
			zIndexStart: 1000,
			closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="Fermer">Fermer</a>'
		}
	);
	
	jQuery('.enquete-link').nyroModal(
		{
			bgColor: '#ffffff',
			zIndexStart: 1000,
			closeButton: '<a href="#" class="nyroModalClose" id="closeBut" title="Fermer">Fermer</a>'
		}
	);


	//MOVING BOXES
	if((document.location.href.indexOf("frameless.htm")<1 && document.location.href.indexOf("frameless%2ehtm")<1) || document.location.href.indexOf("WBCMODE=AuthoringPreview")>-1 || document.location.href.indexOf("NRMODE=Published")>-1){
		jQuery('#boxes').movingBoxes({
			// Appearance
			startPanel   : movingboxespanel,         // start with this panel
			width        : 655,       // overall width of movingBoxes (not including navigation arrows)
			panelWidth   : 0.27,       // current panel width adjusted to 50% of overall width
			reducedSize  : 0.75,     // non-current panel size: 80% of panel size
			fixedHeight  : true,      // if true, slider height set to max panel height; if false, slider height will auto adjust.

			// Behaviour
			speed        : 500,       // animation time in milliseconds
			hashTags     : false,     // if true, hash tags are enabled
			buildNav     : false,     // if true, navigation links will be added
			navFormatter : null,      // function which returns the navigation text for each panel
			easing       : 'swing',   // anything other than "linear" or "swing" requires the easing plugin

			// Selectors & classes
			currentPanel : 'current', // current panel class
			tooltipClass : 'tooltip', // added to the navigation, but the title attribute is blank unless the link text-indent is negative
			disabled     : 'disabled',// class added to arrows that are disabled (left arrow when on first panel, right arrow on last panel)

			// Callbacks
			initialized     : null,   // callback when MovingBoxes has completed initialization
			initChange      : null,   // callback upon change panel initialization
			beforeAnimation : function(e, slider, tar){


				/* Initialise + à chaque changement la marge des blocs à 20px du haut */
				jQuery('#boxes li:nth-child(' + slider.curPanel + ')').stop().animate({
						'padding-top': 20
					}, 500, function() {
						/* Diminue le padding du bloc 'info-carrousel' sur la réduction pour conserver la hauteur du h3 */
						jQuery('#boxes li:nth-child(' + slider.curPanel + ') .content-container-carrousel .info-carrousel').stop().animate({
							'padding-top': 8
						}, 300, function() {
							// Animation complete.
					});
				});
				/* Abaisse le contenu du bloc sortant */
				jQuery('#boxes li:nth-child(' + slider.curPanel + ') .content-container-carrousel').stop().animate({
						'bottom': -54
					}, 300, function() {
						// Animation complete.
				});
				
				/* Initialise + à chaque changement la marge haute du bloc actif à 5px */
				jQuery('#boxes li:nth-child(' + tar + ')').stop().animate({
						'padding-top': 5
					}, 500, function() {

				});

			},   // callback before any animation occurs

			completed : function(e, slider, tar){
				/* Monte le contenu du bloc sortant */
				jQuery('#boxes li:nth-child(' + tar + ') .content-container-carrousel').stop().animate({
						'bottom': 17
					}, 300, function() {
						// Animation complete.
				});

				/* Augmente le padding du bloc 'info-carrousel' sur la réduction pour conserver la hauteur du h3 */
				jQuery('#boxes li:nth-child(' + slider.curPanel + ') .content-container-carrousel .info-carrousel').stop().animate({
						'padding-top': 8
					}, 300, function() {
						// Animation complete.
				});
				
			}    // callback after animation completes
		});
	}
	
	/* PRO *********************************************************************************************************************************/
	/* news */
	jQuery('.news .read-more').click(function() {
		jQuery(this).parent().find('.contenu-news-plus').slideDown();
		jQuery(this).hide();
		jQuery(this).parent().find('.read-less').show();
	});
	jQuery('.news .read-less').click(function() {
		jQuery(this).parent().find('.contenu-news-plus').slideUp();
		jQuery(this).hide();
		jQuery(this).parent().find('.read-more').show();
	});
	
});

// valeur par default de la variable movingboxespanel, pour le plugin Moving Boxes
var movingboxespanel = 3;
		
