[% USE date;
   books = [
    { title => "Practical mod_perl",
      url   => "http://modperlbook.org/", 
      image => { uri => "/images/books/practical_modperl.jpg",
                 height => 169,
                 width => 128,
               },
      authors => "Stas Bekman, Eric Cholet",
    },
    { title => "The mod_perl Developer's Cookbook",
      url   => "http://www.modperlcookbook.org/", 
      image => { uri => "/images/books/modperlcookbook.jpg",
                 height => 140,
                 width => 113,
               },
      authors => "Geoffrey Young, Paul Lindner, Randy Kobes",
    },
    { title => "mod_perl Pocket Reference",
      url   => "http://www.oreilly.com/catalog/modperlpr/", 
      image => { uri => "/images/books/modperlpr.jpg",
                 height => 140,
                 width => 85,
               },
      authors => "Andrew Ford",
    },
    { title => "Writing Apache Modules with Perl and C",
      url   => "http://www.modperl.com/", 
      image => { uri => "/images/books/wrapmod.jpg",
                 height => 140,
                 width => 107,
               },
      authors => "Lincoln Stein, Doug MacEachern",
    },
    { title => "Embedding Perl in HTML with Mason",
      url   => "http://www.masonbook.com/",
      image => { uri => "/images/books/masonbook.jpg",
                 height => 140,
                 width  => 107,
               },
      authors => "Dave Rolsky, Ken Williams",
    },
  ];
  
  max_items = 3;
  num_items = books.size;
  seconds = date.format(date.now, '%S'); 
  first_book = seconds % num_items;
-%]

[%- WRAPPER wrap_box
    title = "<a href=\"${doc.dir.abs_doc_root}/docs/offsite/books.html\">Books</a>"
-%]
     
[%- i_max = max_items - 1;
    FOREACH i = [0..i_max];
      cur = (i + first_book) % num_items;
      book = books.$cur;
%]
        <tr>
            <td class="menu-border" width="1"><br></td>
            <td class="ad-bg">
                <div class="adtext">
                    [% book.title %]<br><br>
                    <a href="[% book.url %]">
                        <img src="[% doc.dir.abs_doc_root %][% book.image.uri %]" border="1" align="middle" width="[% book.image.width %]" height="[% book.image.height %]" class="img-border" alt="[% book.title %]"></a>
                    <br><br>
                    <em>By [% book.authors %]</em>
                </div>
            </td>
            <td class="menu-border" width="1"><br></td>
        </tr>

        <tr>
            <td class="menu-border" colspan="3" height="1"><small class="nbr"><small class="nbr"><br class="smallbr"></small></small></td>
        </tr>

[% END %]

        <tr>
            <td class="menu-border" width="1"><br></td>
            <td class="ad-bg">
                <div class="adtext">
                    <div class="nonselectedmenuitem">
                        <em><a href="[% doc.dir.abs_doc_root %]/docs/offsite/books.html">More mod_perl books...</a></em>
                    </div>
                </div>
            </td>
            <td class="menu-border" width="1"><br></td>
        </tr>

        <tr>
            <td class="menu-border" colspan="3" height="1"><small class="nbr"><small class="nbr"><br class="smallbr"></small></small></td>
        </tr>

[% END %]