#c// options: -crop
#c// options: -geometry 133x100
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
#c// ###################################################################
#c// Album Theme by David Ljung Madison
#c// Design by Dave Simmer of DaveWeb.com
#c// -- Au##to generated by simmer_theme v3.00
#c// -- Can only auto gen if you remove the image page borders,
#c// -- this one can't stretch.
#c// -- From: http://MarginalHacks.com/Hacks/album/
#c// ###################################################################
#c//
<:

  # Path setting - this is the path to the images
  $PATH = Theme_URL();

$text_color = "#000000";
$link_color = "#603913";
$TITLE_FONT = "size='4' color='$text_color' face='Times New Roman,Georgia,Times'";
$MAIN_FONT = "face='Times New Roman,Georgia,Times'";
$CREDIT_FONT = "size='-1' face='Verdana' color='$text_color'";
$BODY = "bgcolor='white' link='$link_color' alink='$link_color' vlink='$link_color' text='$text_color'";

  # Icons/graphics
  @Locked =	("$PATH/Locked.gif", 8, 11);

  # Thumbnail border
  @Bord_L =	("$PATH/Bord_L.gif", 39, 100);
  @Bord_R =	("$PATH/Bord_R.gif", 55, 100);
  @Bord_T =	("$PATH/Bord_T.gif", 227, 53);
  @Bord_B =	("$PATH/Bord_B.gif", 227, 55);
  @Border = (\@Bord_TL,\@Bord_T,\@Bord_TR,\@Bord_RT,\@Bord_R,\@Bord_RB,\@Bord_BR,\@Bord_B,\@Bord_BL,\@Bord_LB,\@Bord_L,\@Bord_LT);
sub Bar {
  my ($colspan) = @_;
  return unless @Bar_L;
:>
			<tr>
				<td colspan='<:=$colspan:>' height="<:=$bar_H:>">
					<div align="center" style="white-space: nowrap">
						<: print Image_Array(@Bar_L),Image_Array(@Bar_M),Image_Array(@Bar_R);:>
					</div>
				</td>
			</tr>
<:
}

:>//
#c//
#c// ###################################################################
#c// Everything beyond here is the same for every DaveWeb theme..
#c// ###################################################################
<:
  # Shorthand for column info specified by -columns
  $Cols = Option('columns');
  $Col_Perc = int(100/$Cols)."%";

:>//
<html>
	<head>
		<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
		<meta http-equiv="Content-Style-Type" content="text/css">
		<: Meta() :>
		<title>Album: <:= Path('album_name') :></title>
	</head>

	<body <:=$BODY:>>
		<table border="0" cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td colspan="<:=($Cols-1):>" height="10"><:=Image_Array("$PATH/Null.gif",11,10):></td>
			</tr>
			<tr>
				<td colspan="<:=($Cols-1):>">
<: if (@Icon) {
          print Image_Array(@Icon,"align='middle'");
					print "\n<br />\n";
   } _:>
					<font <:=$TITLE_FONT:>>
					&nbsp;&nbsp;&nbsp;&nbsp;<:= Parent_Albums(':'); :>
					</font></td>
				<td valign='top' width="25%">
					<div align="right">
						<:
							$back=Back();
							if ($back && $back ne "''") {
								print "<a href=$back>";
								print @Back ? Image_Array(@Back,"align='middle'") : "<h2>Back</h2>";
								print "</a>\n";
							}
						:>
					</div>
				</td>
			</tr>
<: if (isHeader()) { _:>
			<tr>
				<td colspan="<:=$Cols:>">
					<br />
					<center>
						<:pHeader():>
					</center>
				</td>
			</tr>
<: } _:>
<: Bar($Cols) :>
			<tr>
				<td colspan="<:=$Cols:>"><:=Image_Array("$PATH/Null.gif",20,10):></td>
			</tr>

#c// Are there more albums below this one?
<:
  my $alb = First('dirs');
  if ($alb) { _:>
			<tr>
				<td colspan="<:=$Cols:>">

	<table width='100%' align='center' cellspacing='3'>
		<tr>
<:    if (@More) { :>
			<td height='50' align='center' width='<:=$Col_Perc:>' valign='top'>
				<:=Image_Array(@More):>
			</td>
<:    } else { :>
			<td height='50' align='center' width='<:=$Col_Perc:>' valign='top'>
				<h2>More albums:</h2>
			</td>
<:    } :>
#c//
#c// Loop on all the albums
<:  my @save;
    while ($alb) {
_:>
			<td align='center' width='<:=$Col_Perc:>' valign='middle'>
					<: Border($alb, 'thumb','dir', @Border) if Get($alb,'thumb','x') :>
          <: push(@save,$alb); :>
			</td>
<:    my $new_row = (!((Get($alb,'num')+2) % $Cols) && Next($alb)) ? 1 : 0; :> 
<:    if ($new_row || !Next($alb)) { _:>
		</tr><tr>
<:      foreach my $save ( @save ) { _:>
      <:= "<td></td>\n" unless Get($save,'num') :>
			<td align='center' width='<:=$Col_Perc:>' valign='top'>
				<font <:=$TITLE_FONT:>>
					<:= Image_Array(@Locked) if -e Get($save,'path').'/.htaccess'; :>
					<:=Get($save,'href','dir'):>
					<:=Name($save):></a>
					<: my $cap = Caption($save);
					   my $num_pics = Get($save,'num_pics');
					   $num_pics = $num_pics ? $num_pics>1 ? "$num_pics images\n" : "1 image\n" : "";
					   my $num_dirs = Get($save,'num_dirs');
					   $num_dirs = $num_dirs ? $num_dirs>1 ? "$num_dirs folders\n" : "1 folder\n" : "";
					   if ($cap || $num_pics || $num_dirs) { _:>
						<br />
						<font size='-2'>
						<:=$cap if $cap:>
						<:="<br />" if $cap && ($num_pics || $num_dirs):>
						<:=$num_dirs:>
						<:=", " if $num_pics && $num_dirs:>
						<:=$num_pics:>
						</font>
          <: } :>
				</font>
<:
        }
        undef @save;
        if ($new_row) { _:>
		</tr><tr>
<:
        }
      }
      $alb = Next($alb);
    } # End child album loop
_:>

		</tr>
	</table>

				</td>
			</tr>

#c// Bar after child albums
<: Bar($Cols) :>

#c//
#c// End if albums
<:  } :>

#c//
#c// The images
<:
  my $img = First('pics');
  if ($img) { _:>//
			<tr>
<:  my @save;
    while ($img) {
_:>
				<td align='center' valign='middle' width='<:=$Col_Perc:>'>
					<font <:=$MAIN_FONT:>>
					<: Border($img,'thumb','image', @Border) if Get($img,'thumb','x') :>
          <: push(@save,$img); :>
			  </td>

<:    my $new_row = (!((Get($img,'num')+1) % $Cols) && Next($img)) ? 1 : 0; :> 
<:    if ($new_row || !Next($img)) { _:>
		</tr><tr>
<:      foreach my $save ( @save ) { _:>
				<td align='center' valign='top' width='<:=$Col_Perc:>'>
					<:=Get($save,'href','image'):>
					<:=Name($save):></a>
					<: if (my $cap = Caption($save)) { _:>
						<br />
						<font size='-2'>
						<:=$cap:>
						</font>
					<: } :>
					</font>
				</td>
<:
        }
        undef @save;
        if ($new_row) { _:>
			</tr>
			<tr>
				<td height="20" colspan="<:=$Cols:>"><:=Image_Array("$PATH/Null.gif",20,20):></td>
			</tr>
			<tr>
<:
        }
      }
      $img = Next($img);
    } # End child album loop
_:>

			</tr>
			<tr>
				<td height="20" colspan="<:=$Cols:>"><:=Image_Array("$PATH/Null.gif",20,20):></td>
			</tr>

<: Bar($Cols) :>

<:}:>//

<: if (isFooter()) { _:>
			<tr>
				<td colspan="<:=$Cols:>">
					<br />
					<center>
						<:pFooter():>
					</center>
				</td>
			</tr>

<: Bar($Cols) :>

<: } _:>

			<tr>
				<td colspan="<:=$Cols:>">
					<div align="center">
						<font <:=$CREDIT_FONT:>><: Credit() :> on <:=scalar localtime:></font></div>
				</td>
			</tr>
		</table>
		<p></p>
	</body>

</html>
