
(function($) {
    $.fn.accordeon = function() {	       
        this.each(function() {            
            $(this).find('div.item').each(function() {
                var $item = $(this);
                //var $contents = $item.find('div').last();
                var $contents = $item.find('div.content_right_elt');
                var heigth = $contents.outerHeight() + 20;
                //alert(heigth);
                $contents.css('height', '0px')
                .css('display', 'none')
                .css('overflow','hidden') ;
                         
                $item.click(function() {                     
                    if (!$contents.is(':visible')) {
                        $contents.css('display', 'block');
                        $contents.animate({
                            height: heigth + 'px'
                            },600);
                        $item.siblings('div.item').each(function(){
                            $(this).find('div.content_right_elt').animate({
                                height: '0px'
                            },600, 
                            function(){
                                $(this).css('display','none');
                            }
                            );
                        });
                    } else {
                        $contents.animate({
                            height: '0px'
                        },600, 
                        function(){
                            $(this).css('display','none');
                        }
                        );
                    }
                });
            });
        });
        	
        return this;
    };
})(jQuery);
