$(document).ready(function () {

    //
    // Login
    //
    $.getScript(document.skinPath + 'js/login.js');



    // 
    // MENU
    //

    // Initialisation au chargement
    $('div.menuReso>div>ul').addClass('mainMenu');

    $('ul.mainMenu>li').each(function (index) {
        $(this).addClass('root').addClass('li' + index);
    });

    $('li.root').each(function () {

        // Ajout de classes css au éléments enfants
        if ($(this).find('ul').length > 0) {
            $(this).addClass('parent');
            $(this).find('ul').addClass('child');
        }

        // Détection de la page en cours
        var idEnCours = 'dnn_NAV1_ctlNAV1ctr' + document.tabID;
        if ($(this).attr('id') == idEnCours) {
            // niveau root
            $(this).addClass('sel');
        } else {
            // niveau enfant
            var parent = $(this);
            parent.find('ul.child li').each(function () {
                if ($(this).attr('id') == idEnCours) {
                    parent.addClass('sel');
                }
            });
        }

    });

    // Actions en cours de navigation
    $('li.parent').hover(function () {
        $(this).find('ul.child').show();
    }, function () {
        $(this).find('ul.child').hide();
    });

    // Admin
    if ($('div.ControlPanel').length > 0) {
        $('li.root:last').addClass('admin');
    }
    // Admin catalog
    if ($('div.optaManagement').length > 0) {
        $('div#menu').hide();
    }



    //
    // Slider Top
    //
    $('#sliderTop').hevoq({
        easingUse: 'jswing',
        typeSlide: 'sequential',
        nCol: 1,
        itemItem: 1,
        delay: 5000,
        duration: 1500
    });



    //
    // Slider Accueil
    //
    $('#sliderAccueil').hevoq({
        easingUse: 'easeOutQuint',
        typeSlide: 'slide',
        typeSlideFX: 'horizontal',
        delay: 4000,
        duration: 1000
    });


    //
    // Slider Annonce
    //
    $('div.containerSliderAnnonces').optaSlider({
        'delay' : 5000,
        'autoPrevNextPosition' : false
    });

//
// Shadowbox
//
Shadowbox.init();



//
// Le Blog
//
$('div.blogRss div.itemBloc').hover(function () {
    $(this).find('div.caption').stop().animate({
        bottom: '0px'
    }, 200);
}, function () {
    $(this).find('div.caption').stop().animate({
        bottom: '-78px'
    }, 200);
});



$("a.postuler").colorbox({ width: "80%", height: "90%", iframe: true });

});
