(function($) {
    $.fn.jSelect_lien = function(settings) {
        settings = jQuery.extend({
            delai_close     : 700
        },settings);
        //
        var total_height = 0;
        var opened = false;
        var select = this;
        var height_depart = this.outerHeight();
        var nom_timeout = 'delai_' + Math.ceil(Math.random() * 10000);

        this.children().each(function(i){
            //alert($(this).height());
            if (!i) $(this).bind('click', function(){
                clic_select();
            });
            total_height = total_height + $(this).outerHeight();
        });

        function clic_select() {
            if (!opened) {
                select.animate({
                    height  : total_height
                });
                opened = true;
            } else {
                select.animate({
                    height  : height_depart
                });
                opened = false;
            }
        }

        select.hover(function(){
            clearTimeout(nom_timeout);
        }, function(){
            if (opened) {
                nom_timeout = setTimeout(function() {
                    clic_select();
                }, settings.delai_close);
            }
        });
    };
})(jQuery);
