/**
 * Gere le menu horizontal
 *
 * @author     Eric Giovannetti <eric@bleuroy.com>
 * @copyright   BleuRoy.com
 * @version    1.0.0 Modified
 */
 
j.fn.horizontalMenu = function() {
    
    // Gestion de l'affichage
    j('#nav > li.main')
    .each(function(){
        j('.sNav', this).find('a:last').addClass('last');
    })
    .find('> a').bind('mouseenter', function(){
        // Gestion de l'etat survol
        if(j(this).parent().is(':not(.actif)')){
            var imgSrc = j('img', this).attr('src');
            j('img', this).attr('src', imgSrc.replace(/.png/ig,'-on.png'));
        }
    }).end()
    .find('> a').bind('mouseleave', function(){
        // Gestion de l'etat normal
        if(j(this).parent().is(':not(.actif)')){
            var imgSrc = j('img', this).attr('src');
            j('img', this).attr('src', imgSrc.replace(/-on.png/ig,'.png'));
        }
    }).end()
    .bind('mouseenter', function(){
        if(j('#onglet').is(':hidden') && j(this).is('#summits')) {
            j('#onglet').slideDown();
        }
    })
    .bind('mouseleave', function(){
        if(j('#onglet').is(':visible') && j(this).is('#summits')) {
            j('#onglet').slideUp();
        }
    });
};
