/*
 *
 *  Cette partie est lancÃ©e une fois la page chargÃ©e complÃ©tement.
 *  
 */
$(document).ready(function() {

    //le click sur le logo renvoit à l'accueil en français !!!
    
    $("#bt_logo").bind('click',function() {
            afficher_accueil();
        });
        
    //le click sur le bouton français renvoit à l'accueil français
    $("#bt_french").bind('click',function() {
        afficher_accueil();
    });

    //le click sur le bouton english renvoit à l'accueil anglaise
    $("#bt_english").bind('click',function() {
        afficher_english();
    });

    //le click sur le bouton ok de recherche simple renvoit vers la page de recherche simple
    $("#bt_search_simple").bind('click',function() {
        afficher_search_simple();
    });
    
    //le click sur le bouton ok de recherche avancée renvoit vers la page de recherche avancée

    $("#bt_search_complex").bind('click',function() {
        afficher_search_complex();
    });
   
    // We only want these styles applied when javascript is enabled
    $('div.navigation').css({ 'width' : '930px', 'float' : 'left'});
    $('div.content').css('display', 'block');

    // Initially set opacity on thumbs and add
    // additional styling for hover effect on thumbs
    var onMouseOutOpacity = 0.67;


    var galleryAdv = $('#gallery').galleriffic('#thumbs', {
                delay:                  2000,
                numThumbs:              8,
                preloadAhead:           10,
                enableTopPager:         true,
                enableBottomPager:      true,
                imageContainerSel:      '#slideshow',
                controlsContainerSel:   '#controls',
                captionContainerSel:    '#caption',
                loadingContainerSel:    '#loading',
                renderSSControls:       true,
                renderNavControls:      true,
                playLinkText:           'Lecture diaporama',
                pauseLinkText:          'Arrêt diaporama',
                prevLinkText:           'Photo précédente',
                nextLinkText:           'Photo suivante',
                nextPageLinkText:       'Suivant',
                prevPageLinkText:       'Précédent',
                enableHistory:          true,
                autoStart:              false,
                onChange:               function(prevIndex, nextIndex) {
                        $('#thumbs ul.thumbs').children()
                                .eq(prevIndex).fadeTo('fast', onMouseOutOpacity).end()
                                .eq(nextIndex).fadeTo('fast', 1.0);
                },
                onTransitionOut:        function(callback) {
                        $('#caption').fadeTo('fast', 0.0);
                        $('#slideshow').fadeTo('fast', 0.0, callback);
                },
                onTransitionIn:         function() {
                        $('#slideshow').fadeTo('fast', 1.0);
                        $('#caption').fadeTo('fast', 1.0);
                },
                onPageTransitionOut:    function(callback) {
                        $('#thumbs ul.thumbs').fadeTo('fast', 0.0, callback);
                },
                onPageTransitionIn:     function() {
                        $('#thumbs ul.thumbs').fadeTo('fast', 1.0);
                }
        });


});

function afficher_accueil() {
    window.location=$('#lien_site_francais').attr('href');
}

function afficher_english() {
    window.location=$('#lien_site_english').attr('href');
}

function afficher_search_simple() {
    window.location=$('#lien_search_simple').attr('href');
}

function afficher_search_complex() {
    window.location=$('#lien_search_complex').attr('href');
}
