$(function() {
    $(".cinecard_lightbox_background").click(function() {
        $("#renkan_container").children().remove();
        $(".cinecard_wrap").hide();
    });
    
    $(".show_cinecard").click(function() {
        var movieli = $(this).parents(".gift_movie");
        $(".cinecard_title").text(movieli.find(".gift_movie_title").text());
        $(".cinecard_sender label").text(movieli.find(".gift_user label").text());
        $(".cinecard_sender p").text(movieli.find(".gift_user p").text());
        $(".cinecard_wrap").fadeIn();
        
        //Renkan initialization
        var _renkan = new Rkns.Renkan({
            user_id: "u-iri",
            language: "fr_cg",
            container: "renkan_container",
            editor_mode: false,
            show_bins: false,
            show_top_bar: false,
            show_minimap: false,
            show_node_circles: false,
            clip_node_images: false,
            node_size_base: 40,
            autoscale_padding: 100,
            default_user_color: "#808080",
            buttons_background: "#101010",
            static_url: renkan_base,
            label_untitled_nodes: false,
            show_node_tooltip_image: false,
            show_node_tooltip_color: false,
            show_edge_tooltip_color: false
        });
        
        Rkns.jsonIO(_renkan, {
            url: cinecard_url_template.replace('{{gift-id}}', movieli.attr("data-gift-id"))
        });
        
        return false;
    });
    
    
});
