var trees = [
    {
        title: "Thésaurus de l'Architecture et de l'Urbanisme : Secteur urbain",
        tree: {
            label: "secteur urbain",
            contents: [
                {
                    label: "banlieue",
                    contents: [
                        {
                            label: "faubourg"
                        }
                    ]
                },
                {
                    label: "îlot"
                },
                {
                    label: "quartier",
                    contents: [
                        {
                            label: "centre-ville"
                        }
                    ]
                },
                {
                    label: "secteur urbain concerté",
                    contents: [
                        {
                            label: "grand ensemble"
                        },
                        {
                            label: "lotissement",
                            contents: [
                                {
                                    label: "lotissement concerté",
                                    contents: [
                                        {
                                            label: "cité-jardin"
                                        },
                                        {
                                            label: "cité ouvrière"
                                        },
                                        {
                                            label: "courée"
                                        },
                                    ]
                                }
                            ]
                        }
                    ]
                },
            ]
        }
    },
    {
        title: "Thésaurus Garnier : Architecture d'habitation",
        tree: {
            label: "architecture d'habitation",
            contents: [
                {
                    label: "cité-jardin"
                },
                {
                    label: "édifice d'habitation",
                    contents: [
                        {
                            label: "demeure",
                            contents: [
                                {
                                    label: "chalet"
                                },
                                {
                                    label: "château"
                                },
                                {
                                    label: "château-fort",
                                    contents: [
                                        {
                                            label: "chemin de ronde"
                                        },
                                        {
                                            label: "donjon"
                                        }
                                    ]
                                },
                                {
                                    label: "hôtel particulier"
                                },
                                {
                                    label: "maison"
                                },
                                {
                                    label: "manoir"
                                },
                                {
                                    label: "palais"
                                }
                            ]
                        },
                        {
                            label: "abri",
                            contents: [
                                {
                                    label: "buron"
                                },
                                {
                                    label: "cabane"
                                },
                                {
                                    label: "campement",
                                    contents: [
                                        {
                                            label: "tente"
                                        },
                                        {
                                            label: "tipi"
                                        },
                                        {
                                            label: "igloo"
                                        }
                                    ]
                                }
                            ]
                        }
                    ]
                }
            ]
        }
    },
    {
        title: "Thésaurus Garnier : Sciences occultes",
        tree: {
            label: "sciences occultes",
            contents: [
                {
                    label: "alchimie"
                },
                {
                    label: "astrologie"
                },
                {
                    label: "divination"
                },
                {
                    label: "magie",
                    contents: [
                        {
                            label: "sorcellerie"
                        },
                        {
                            label: "sorcière"
                        }
                    ]
                }
            ]
        }
    }
];
$(function() {
    $(".column").each(function(_key) {
        var _tree = trees[_key],
            _el = $(this);
        _el.find("h3").text(_tree.title);
        $.getJSON(
            endpoints.fill_tree,
            { tree: JSON.stringify(_tree.tree) },
            function(_data) {
                renderData(_el.find(".cattree"), _data, 2);
                _el.find("p.theme:contains('cité-jardin')")
                    .css("background-color","#ffff80")
                    .parent()
                    .parentsUntil(".cattree")
                        .removeClass("folded");
            }
        );
    });
});
