/*
**  Utilisation de la librairie jQuery
**  http://docs.jquery.com/Downloading_jQuery#Download_jQuery
*/

jQuery.noConflict();
jQuery(function($) {

    // On lance le carousel slider

    $('#slider .carousel, #content .colContent .carousel').carouselSlide({
        manual: true,
        auto: true,
        speed: 1000,
        frequency: 6000
    });


    /* Gestion de la toolbar taille texte et impression */

    // Définir la taille par défaut, la taille maximale et la taille minimale
    var tailleTxt = 1;
    var tailleTxtMax = 1.5;
    var tailleTxtMin = 0.8;

    $('#content .toolBar .diminuerTxt').click(function (e) {
        if(tailleTxt > tailleTxtMin) {
            tailleTxt -= 0.1;
            $('div.resizer').css('font-size', tailleTxt+'em');
        }
        e.preventDefault();
    });

    $('#content .toolBar .augmenterTxt').click(function (e) {
        if(tailleTxt <= tailleTxtMax) {
            tailleTxt += 0.1;
            $('div.resizer').css('font-size', tailleTxt+'em');
        }
        e.preventDefault();
    });

    $('#content .toolBar .imprim').click(function (e) {
        window.print();
        e.preventDefault();
    });

    /*
    $(window).bind('load resize',function() {
        $('#global').height($(window).height());
    });
    */

    /* Lightbox */


    $(".btLightbox").click(function(){
        $("#overlayLightbox").show();
        $("#"+$(this).attr('rev')+"box").show();
        this.blur();
        return false;
    });

    $(".lightBox .fermer a").click(function(){
        $("#overlayLightbox").hide();
        $(this).parent().parent().hide();
        this.blur();
        return false;
    });

    $("a.restricted").click(function()
    {
        $("#overlayLightbox").show();
        $("#loginLightbox").show();
    });


    /* DOUBLE LIST */

    $("div.double_list").each(function(item)
       {
           var classes      = $(this).attr("class");
           var classesSplit = classes.split(" ");
           var myClass      = "";

           for(i = 0; i < 2; i++)
               if(classesSplit[i] !== "double_list")
                   myClass = classesSplit[i];

           if(myClass !== "")
               sfDoubleList.init(document.getElementById(myClass), "double_list_select");
       })
}); /* jQuery end */
