jQuery.fn.justtext = function() {
    return $(this).clone()
            .children()
            .remove()
            .end()
            .text();
 
};
$(document).ready(function(){
   $("h1").each(function(){
        $("#sidebar").append(
            "
"
        );
        ul = $("");
        $("h2",$(this).parent().parent()).each(function(){
            ul.append(
            ""
            );
            subul = $("");
            $("h3",$(this).parent()).each(function(){
                subul.append(
                ""
                );
            });
            ul.append(subul);
        });
        $("#sidebar").append(ul);
   });
});