////
// Custom formatting of ../ autoindex.
//



    /** Amends the autoindex listing, generated by Apache.
      */
    function _amendListing()
    {
        var pre;
        for( var child = document.body.firstChild; child != null; child = child.nextSibling )
        {
            if( child.nodeType != /*element*/1 ) continue;

            if( child.tagName.toLowerCase() == 'pre' )
            {
                pre = child;
                break;
            }
        }
        if( !pre ) return;

        for( var child = pre.firstChild; child != null; child = child.nextSibling )
        {
            if( child.nodeType != /*element*/1 ) continue;

            if( child.tagName.toLowerCase() != 'a' ) continue;

         // var href = child.getAttribute( 'href' );
         //// but IE expands the href, so this is easier:
            var href = child.firstChild.data; // same thing, in these listings
            if(      href == 'a/' ) { appendInListingA( child, '  architectural' ); replaceAfterListingA( child, '      -  -   textbender architectural and application code' ); }
            else if( href == 'd/' ) { appendInListingA( child, '  domain' ); replaceAfterListingA( child, '          -  -  -   recombinant text' ); }
            else if( href == 'g/' ) { appendInListingA( child, '  general' ); replaceAfterListingA( child, '         -  -  -   general library code' ); }
            else if( href == 'o/' ) { appendInListingA( child, '  other' ); replaceAfterListingA( child, '        -  -  -  -   specialized code from other domains' ); }
         // else if( href == 'contributors.xht' ) { appendAfterListingA( child, 'welcome all' ); }
            else if( href == 'licence.xht' ) { appendAfterListingA( child, 'licence is open source, MIT' ); }
        }

    }



//////////////////////////////////////////////////////////////////////////////////////////


    _amendListing();

 // document.writeln( '<img style="position:absolute; left:0; top:0; margin-left:0.4em; margin-top:0.8em" alt="\'textbender\'" src="_/logo-dark-large.png"/>' ); // placed in h1 in case client does not support the position rule (in here, it should overlap the h1 nicely)
 //// Above was in the common autoindex.js, writelnH1(). But it overlaps top parts of page, in 'pre', and z-index does not seem to help. And the following alternative need not be in the common script, be can be coded here in the custom one:
    var toWriteBackgroundImage = true; // till proven otherwise
    var ieIndex = navigator.appVersion.indexOf(" MSIE "); // 4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
    if( ieIndex > -1 )
    {
        var version = parseFloat( navigator.appVersion.substring( ieIndex + 6 ))
        if( version >= 5.5 && version < 7 ) // IE 7 does not need PNG fix
        {
            toWriteBackgroundImage = false; // ie-png32-fix.js fails for background images
        }
    }
    if( toWriteBackgroundImage )
    {
        document.body.style.backgroundImage = 'url("_/logo-dark-large.png")';
        document.body.style.backgroundPosition = '0.4em 0.8em';
        document.body.style.backgroundRepeat = 'no-repeat';
    }

