$(document).ready(function() {

    //update title
    document.title += $("h1").text();

    $(".blue").before("<div><img src=\"/img/bluetop.png\"/></div>").after("<div><img src=\"/img/bluebottom.png\"/></div>");

    //h2collapse
    $.each($(".h2collapse h2"), function() {
        var proximos = $(this).nextAll();
        var proximoH2 = $(this).nextAll("h2");


        var ateProximo = -1;
        if (proximoH2.length)
            ateProximo = $.inArray(proximoH2[0], proximos);
        if (ateProximo > 0) {
            proximos = proximos.splice(0, ateProximo);
        }
        if (proximos.length) {
            this.proximos = $(proximos);
            this.proximos.hide();
            $(this).click(function() {
                this.proximos.slideToggle();
            });
            $(this).css("cursor", "pointer");
            $(this).append(" (+)");
        }
    });
});

