// ----------------------------------------------------------------------------
// Legende, a simple Javascript wrapper to link a legend to <img>
// v 1.0 - 8/07/2011
// Free for all under your own responsability
// ----------------------------------------------------------------------------
// Copyright (C) 2011 iwcweb
// Developer : James Dervin
// http://www.iwcweb.be/
// ----------------------------------------------------------------------------

(function($){
    $.fn.legende = function(path) {
        return this.each(function() {
            var $$ = $(this);
                        
            var src = $$.attr('src');
            var align = $$.attr('align') ? $$.attr('align') : 'left';
            
             $.getJSON(path,{src:src}, function(data) {
                // Itère toutes les lignes du menu #dashboard
                
                $$.wrap('<div class="cadre_legende ' + align + '" />')
                    .after('<div class="legende">' + data['legende'] + '</div>');
            });
        });
    }
})(jQuery);
