options: -known_images
#c// ##################################################
#c// The index frame
#c// ##################################################

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>

  <head>
    <title>Album: <: pAlbum_Name() :></title>
    <: Meta() :>
  </head>

  <frameset cols='160,*'>
    <noframes>
      You need to have frames!
    </noframes> 

    <frame scrolling='auto' src='Thumbs.html'>
    <frame marginwidth='10' scrolling='auto' name='Photo' src='Albums.html' border="0" framespacing="0" frameborder="0">
  </frameset>

</html>

<:
  # Write the Title.html and Thumbs.html
  my $album = Album_Filename();
  my $path = $album;  $path =~ s|[^/]+$||;
  $path = "." unless $path;

  sub PrintChildAlbum {
    my $obj = get_obj($CHILD_ALBUM_CNT,'dirs');
    my $name = Name($obj);
    my $url = Get($obj,'URL','dir');
    print "<a target='_top' href=$url>$name</a>";
  }

  sub ParentAlbum {
    my @PARENT_ALBUMS = @{Path('parent_albums')};
    return "" unless Parent_Albums_Left() > 0;
    if ($PARENT_ALBUM_CNT == num('parent_albums')-1) {
      return "<a href='Albums.html'>$PARENT_ALBUMS[$PARENT_ALBUM_CNT]</a>" unless Image_Page();
      return "<a target='_top' href='../".Option('index')."'>$PARENT_ALBUMS[$PARENT_ALBUM_CNT]</a>";
    }
    my$str = "<a target='_top' href='";
    $str .=   "../"x(Parent_Albums_Left() - (Image_Page()?0:1));
    $str .=   Option('index');
    $str .=   "'>$PARENT_ALBUMS[$PARENT_ALBUM_CNT]</a>";

    return $str;
  }

:>

#c//
#c// ##################################################
#c// Albums.html
#c// ##################################################
<:
  open(STDOUT,">$path/Albums.html") || die("Theme can't write [$path/Albums.html]\n");
:>

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title>Album: <: pAlbum_Name() :></title>
    <: Meta() :>
    <base target=_parent>
  </head>

  <body bgcolor=white>

  <: if (isHeader()) { _:>
    <br/>
    <center>              
      <:pHeader():>         
    </center>
  <: } _:>

#c// Are there more albums below this one?
  <: if (Child_Albums()) { _:>
    <br/>
    <font size='+2'><i>More albums:</i></font>
    <br/>
    <ul>
  
#c// Loop on all the albums
      <: while (Child_Albums()) { _:>
        <li>
        <font size='+1'>
          <: PrintChildAlbum() :>
        </font>
        <: Next_Child_Album() :>
      <: } _:>
    </ul>

#c// No child albums
  <: } else { _:>
    <br/>
    <font size='+2'><i>No child albums</i></font>
    <br/>
  <: } :>

  <: if (isFooter()) { _:>
    <center>              
      <:pFooter():>         
    </center>
    <br/>
  <: } _:>

  <hr/>
  <font size='-1'>
    <: Credit() :> on <:=scalar localtime:>
  </font>

  </body>
</html>

<: close STDOUT :>

#c// ##################################################
#c// Thumbs.html
#c// ##################################################

<:
  open(STDOUT,">$path/Thumbs.html") || die("Theme can't write [$path/Thumbs.html]\n");
:>

<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
  <head>
    <title>Album: <:=pAlbum_Name():></title>
    <: Meta() :>
    <base target=Photo>
  </head>

  <body bgcolor=white>
    <h2>Path</h2>
    <font size="-1">
    <: while(Parent_Albums_Left() > 0) {
         print ParentAlbum();
         Next_Parent_Album();
         print "<br/>\n";
       }
    _:>
    </font>

    <: if (Child_Albums()) { _:>
      <h2><a href='Albums.html'>Children</a></h2>
    <: } _:>

    <: if (Images()) { _:>
      <h2>Images</h2>

      <: while(Images()) { _:>
        <:pImage():>
        <br/>
        <font size='-2'>
          <:pImage_Caption():>
        </font>
        <br/>
        <br/>

        <:Next_Image():>
      <: } _:>
    <: } _:>
  </body>
</html>

<: close STDOUT; :>
