$(document).ready(function() {

    $(".arrive_precedent").hide();
    
    $(".arrive_suivant").click(function(){
        $(".arrive_precedent").show();
    })
	
    $(".arrive_bouton,.depart_bouton").click(function(){
        $(".arrive_precedent").hide();
        
    })
    $(".depart_bouton").click(function(){
        $(".title > .provenance").html('Destination');
    })
        
    $(".arrive_bouton").click(function(){
        $(".title > .provenance").html('Provenance');
        
    })
	
	
    $('img').error(function() {
        $(this).hide();
    })
	
    $("#pane-target2").hide();
    $(".jarrive,.descriptionalerte").hide();
    $(".depart_bouton a").addClass('actif');
    $(".flux2").hide();
    $(".depart_bouton a,.arrive_bouton a").css('cursor', 'pointer');
    $("#jeparsboutton").css('cursor', 'pointer');
    $("#jarriveboutton").css('cursor', 'pointer');
    $(".slider li,.more").css('cursor', 'pointer');
    $("#jeparsboutton").addClass('actif');

    $("#jarriveboutton").click(function() {
        $("#jeparsboutton").removeClass('actif');
        $("#jarriveboutton").addClass('actif');
        $(".jarrive").show("fade", 'slow');
        $(".jepars").hide();
    })

    $("#jeparsboutton").click(function() {
        $("#jarriveboutton").removeClass('actif');
        $("#jeparsboutton").addClass('actif');
        $(".jarrive").hide();
        $(".jepars").show("fade", 'slow');
    })

    /* Heure d'arrivee */

    $(".arrive_bouton").click(function() {
        $(".depart_bouton a").removeClass('actif');
        $(".arrive_bouton a").addClass('actif');
        $("#pane-target").hide();
        $("#pane-target2").show();
        var api = $("#pane-target2 .arrive").data("scrollable");
        api.begin();
    })

    $(".depart_bouton").click(function() {
        $(".arrive_bouton a").removeClass('actif');
        $(".depart_bouton a").addClass('actif');
        $("#pane-target").show();
        $("#pane-target2").hide();
        var api = $("#pane-target .arrive").data("scrollable");
        api.begin();
    })

    $(".slider1").tabs(".scrolable1 .scroll1", {
        effect : 'fade',
        current : 'actif',
        rotate : true
    }).slideshow( {
        next : '.suivant1',
        prev : '.precedent1',
        clickable : false
    });
    $(".slider2").tabs(".scrolable2 .actu", {
        effect : 'fade',
        current : 'actif',
        rotate : true
    }).slideshow( {
        next : '.suivant2',
        prev : '.precedent2',
        clickable : false
    });
    $(".slider3").tabs(".scrolable3 .actu", {
        effect : 'fade',
        current : 'actif',
        rotate : true
    }).slideshow( {
        next : '.suivant3',
        prev : '.precedent3',
        clickable : false
    });
    $(".actualite_scroll div").scrollable( {
        vertical : true,
        mousewheel : true,
        next : '.actualite_suivant',
        prev : '.actualite_precedent'
    });
    $("#pane-target .arrive").scrollable( {
        vertical : true,
        mousewheel : true,
        next : '.arrive_suivant',
        prev : '.arrive_precedent'
    });
    $("#pane-target2 .arrive").scrollable( {
        vertical : true,
        mousewheel : true,
        next : '.arrive_suivant',
        prev : '.arrive_precedent'
    });

    $('#slider').nivoSlider( {
        directionNav : false,
        controlNav : false,
        effect : 'fade',
        pauseTime : 5000,
        animSpeed : 2000,
        pauseOnHover:false
    });
	
	
	
    $("#un").click(function(){
        $("#deux,#trois,#quatre").removeClass("actif");
        $(this).addClass("actif");	
        $("#two,#tree,#foor").hide();
        $("#one").show();
        return false;
    })
	
    $("#deux").click(function(){
        $("#un,#trois,#quatre").removeClass("actif");
        $(this).addClass("actif");
        $("#one,#tree,#foor").hide();
        $("#two").show();
        return false;
    })
	
    $("#trois").click(function(){
        $("#un,#deux,#quatre").removeClass("actif");
        $(this).addClass("actif");
        $("#one,#two,#foor").hide();
        $("#tree").show();
        return false;
    })
		
    $("#quatre").click(function(){
        $("#un,#deux,#trois").removeClass("actif");
        $(this).addClass("actif");
        $("#one,#two,#tree").hide();
        $("#foor").show();
        return false;
    })
	
    $("#two,#tree,#foor").hide();
	
    $("#newsletter,#de,#email2").click(function(){
		
        $(this).val("");
    })
	
	
    $("#oknews,#newsletter1").click(function(){
		
		
		
        $.ajax({
            type: "POST",
            url: "/ajax/mail",
            data: "mail="+$(this).prev("input").val(),
            success: function(html){
			
                $('.oknews').dialog({
                    modal: true,  
                    hide: 'slide'
                });		
			
            }
        });
	
    });	
	
    $("#bloc-2,#bloc-3").hide();
	
    $("#serv").click(function(){
        $("#news,#guide").removeClass("actif");
        $(this).addClass("actif");
        $("#bloc-2,#bloc-3").hide();
        $("#bloc-1").show();
    })
	
    $("#news").click(function(){
        $("#serv,#guide").removeClass("actif");
        $(this).addClass("actif");
        $("#bloc-1,#bloc-3").hide();
        $("#bloc-2").show();
    })
	
    $("#guide").click(function(){
        $("#serv,#news").removeClass("actif");
        $(this).addClass("actif");
        $("#bloc-1,#bloc-2").hide();
        $("#bloc-3").show();
    })
});
