<:
  # Newfloat theme version 0.2 for album <http://marginalhacks.com/Hacks/album/>
  # Copyright 2003 Helmar Wieland <heldhelm@gmx.de> <http://helmar.dyndns.org/>
  # License: GPLv2 or later

  sub helmIsImageCaption {
    if (($IMAGE_CAPTION_FILES[$IMAGE_CNT] && (-r $IMAGE_CAPTION_FILES[$IMAGE_CNT])) || $IMAGE_CAPTIONS[$IMAGE_CNT]) {
      return 1;
    }
    return 0;
  }
  sub helmImageCaption {
    if ($IMAGE_CAPTION_FILES[$IMAGE_CNT] && (-r $IMAGE_CAPTION_FILES[$IMAGE_CNT])) {
      my ($buffer) = "";
      return 0 unless (open(FILE,"$IMAGE_CAPTION_FILES[$IMAGE_CNT]"));
      while(<FILE>) { $buffer .= $_; }
      close FILE;
      return $buffer;
    }
    elsif ($IMAGE_CAPTIONS[$IMAGE_CNT]) {
      return $IMAGE_CAPTIONS[$IMAGE_CNT];
    }
    return 0;
  }
  sub helmStripMarkup {
    if (@_) {
      $_ = $_[0];
      s/\<(.*?)>//gi; # this is kinda stupid
      return $_;
    }
    return 0;
  }
:>//
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title><: pAlbum_Name() :> | <:=helmStripMarkup(Image_Name()):></title>
  <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" />
<: if (helmIsImageCaption()) { :>//
  <meta name="description" content="<:=helmStripMarkup(helmImageCaption()):>" />
<: } :>//
  <: Meta() :>//
  <link rel="start" href="<: $_ = Parent_Album(); s/^<a href='(.+)'>.*<\/a>$/$1/; print; :>" />
  <link rel="stylesheet" type="text/css" href="<:=Theme_URL():>/newfloat.css" title="newfloat album style" />
  <style type="text/css"><!--
  h1 {
    background-image: url("<:=Theme_URL():>/h1.gif");
  }
  ul.breadcrums {
    background-image: url("<:=Theme_URL():>/bread1.gif");
  }
  ul.breadcrums:hover {
    background-image: url("<:=Theme_URL():>/bread2.gif");
  }
  ul.navithumbs div {
    background-image: url("<:=Theme_URL():>/thumb2.gif");
  }
  ul.navithumbs div:hover {
    background-image: url("<:=Theme_URL():>/thumb1.gif");
  }
  ul.navithumbs div.current {
    background-image: url("<:=Theme_URL():>/thumb3.gif");
  }
  --></style>
  <script type='text/javascript'><!--
  if (document.images) {
    Image1 = new Image(); Image1.src = '<:=Theme_URL():>/thumb1.gif';
    Image2 = new Image(); Image2.src = '<:=Theme_URL():>/bread2.gif';
  }
  --></script>
</head>
<body>

<h1>
  <:=helmStripMarkup(Image_Name()):>
</h1>

<ul class="breadcrums">
<: while (Parent_Albums_Left() > 0) {
     print "  <li>\n    ";
     pParent_Album();
     if (Parent_Albums_Left() > 1) {
	print " &raquo;";
     }
     print "\n  </li>\n";
     Next_Parent_Album()
   } :>//
</ul>

<: if ($#IMAGE_NAMES > 6 && $#IMAGE_NAMES - $THIS_IMAGE < 3) {
     $helmLower = $#IMAGE_NAMES - 6;
   }
   elsif ($#IMAGE_NAMES > 6 && $THIS_IMAGE > 3) {
     $helmLower = $THIS_IMAGE - 3;
   }
   else {
     $helmLower = 0;
   }
   $helmUpper = $helmLower + 6;
   if ($helmUpper > $#IMAGE_NAMES) {
     $helmUpper = $#IMAGE_NAMES;
   }
   # print "Size: " . $#IMAGE_NAMES . "\nCurrent: " . $THIS_IMAGE . "\nLower: " . $helmLower . "\nUpper: " . $helmUpper . "\n";
   print "<ul class=\"navithumbs\" style=\"width: " . (($helmUpper - $helmLower + 1) * 105 + 5) . "px;\">";
   for ($helmCount = $helmLower; $helmCount <= $helmUpper; $helmCount++) {
     $IMAGE_CNT = $helmCount;
     if ($IMAGE_CNT == $THIS_IMAGE) {
       print "  <li><div class=\"current\">";
     }
     else {
       print "  <li><div>";
     }
     :>
    <a href=<:=Image_Page_URL():>>
      <img src=<:=Image_Thumb():> alt=<:=helmStripMarkup(Image_Alt()):> title=<:=helmStripMarkup(Image_Alt()):> />
    </a>
  </div></li>
<: } :></ul>

<div class="spacer">&nbsp;</div>

<div class="fullimage">
  <a href=<: Set_Image_This(); print Image_URL(); :>>
  <: pImage_Src() :></a>
  <div class="name"><:=Image_Name():></div>
<: if (helmIsImageCaption()) { :>//
  <div class="caption"><: pImage_Caption() :></div>
<: } :>//
</div>

<address>
<: Credit() :> on <:=scalar localtime:><br />
<span class="helmar">Newfloat theme 0.2 by <a href="http://helmar.dyndns.org/">Helmar Wieland</a></span>
</address>

</body>
</html>
