[%- # parent-docsets navigation bar
    # expects to be set:
    # nav          - cache navigator object
    # rel_doc_root - relative docs path (only for chapters!)
-%]
[%- IF nav -%]

[%- # prepare the sects to show where are we relative 
    # to the absolute root
    parents = [];
    p = nav.up;
    nav_not_empty = 0;
    WHILE p;
        parents.unshift(p);
        p = p.up;
        nav_not_empty = 1; 
    END;

    sects = [];
    FOREACH p = parents;
        SET path = [];
        IF p.parent_rel_path.defined; # top level has no rel_path
            path.push(p.parent_rel_path);
        END;
        IF rel_doc_root.defined;
            path.push(rel_doc_root);
        END;
        
        
        nav_not_empty = 1; 
        link = path.join("/");
        sects.push({link => "$link/index.html", text => p.index_node.stitle});
    END;
    # a page has index as its parent, so we push it here
    IF rel_doc_root.defined;
        nav_not_empty = 1; 
        sects.push({link => "$rel_doc_root/index.html", 
                    text => nav.index_node.stitle});
    END;
-%]


        <!-- breadcrumb and topline begin -->
        
        <!-- this silly width is needed for ns4 due to its default paddings in divs, notably rightbox-div -->
        <td width="1"><small class="nbr"><br class="smallbr"></small></td>

        <td class="navbarglobal" height="31" width="100%" valign="bottom">
            <!-- breadcrumb start -->
[%- IF nav_not_empty == 1 -%]
    [%- WRAPPER button 
            width = "100%"
            align = 'left'
    -%]
        [%- FOREACH sec = sects -%]

            <a href="[%- sec.link -%]"><b>[%- sec.text -%]</b></a> / 
        [%- END -%]
    [%- END -%]
[%- ELSE -%]
    <br>
[%- END -%]

            <!-- breadcrumb end -->
        </td>
        <!-- camel begin -->
        <td rowspan="2" align="right" valign="bottom"><a href="http://www.perl.com"><img src="[%- doc.dir.abs_doc_root -%]/images/logo/blue_sm_camel.gif" border="0" alt="perl icon" width="27" height="37"></a></td>
        <td rowspan="2" width="1"><small class="nbr"><br class="smallbr"></small></td>
        <!-- camel end -->
    </tr>
    <tr valign="top">
        <td colspan="2" height="6"><small class="nbr"><br class="smallbr"></small></td>
    </tr>

    <!-- topline begin -->
    <tr valign="top">
        <td colspan="3" height="1" class="camel-line-top"><small class="nbr"><br class="smallbr"></small></td>
        <td><small class="nbr"><br class="smallbr"></small></td>
   </tr>
    <tr valign="top">
        <td colspan="3" height="1" class="camel-line-bottom"><small class="nbr"><br class="smallbr"></small></td>
        <td><small class="nbr"><br class="smallbr"></small></td>
    </tr>
    <!-- topline end -->

    <tr valign="top">
        <td height="3" colspan="4"><small class="nbr"><br class="smallbr"></small></td>
    </tr>


[%- END -%]
