
function adjust_search_input_pane() {
    //if ($("#textshow").is(":visible")) {
    if (K.visible("#textshow")) {
        const search_input_width = 200;
        //console.log(K.right("#textshow") + " " + K.right("#focus") + " " +
        //            K.right("#linkshow") + " " +  K.right("#search_clear"));
        const button_right = Math.max(
            K.right("#textshow"), K.right("#focus"), K.right("#linkshow"), K.right("#search_clear"));
        const help_left = K.left("#help");
        //console.log("help_left: " + help_left);
        //console.log("button_right: " + button_right);
        //console.log("Search input: " + (help_left - button_right - 90));
        let new_width = Math.min(search_input_width, help_left - button_right - 90);
        if (new_width < 10) {
            new_width = search_input_width;
        }
        K.width("#search_input", new_width);
    }
}


function resize() {
    /*
    adjust_search_input_pane();
    var height = $(window).height();

    var title_height = K.height("#title");
    var nav_height = K.height("#nav");
    var status_height = K.height("#status");

    K.height("#middle", height - title_height - nav_height - status_height + 1);
    */
    //resize_text_width();
    /*
    set_annotate_max_width();
    set_code_comment_width();
    set_imagecode_width();
    // adjust_footnotes();
    adjust_slanted_header_table();
    check_visible_link_boxes();

    set_code_caption_width();

    resize_images();
    adjust_widths();
    center_elements();
    */
}

/*
$(window).on("load", function() {
    $(window).on("resize", function(event) {
        console.log("RESIZE");
        event.preventDefault();
        resize();
        //maintain_text_position(resize);
    });
    $("#toc").scroll( function() {
        adjust_toc_slider_height();
    });
    //$("#toc").resizable({handles : "e"});
});
*/


window.addEventListener("load", function (event) {
    window.addEventListener(
        "resize",
        function (event) {
            event.preventDefault();
            resize_images();
            maintain_text_position(resize);
            highlight_headers_in_toc();
            /*
              var top_header = get_top_header();
              var original_pos = top_header.position().top;
              resize();
              set_top_pos(top_header, original_pos);
            */
        });
    resize();
    //highlight_headers_in_toc();
});
