#-*-Perl-*-

#Tack on the names of the subroutines to the list of functions
$hof{"helen"} = 0;

# 6 strips every 14 days (released on mondays) ...
# Base data : 15 mars 1999 = 410 to 415
# Dispatched as one strip a day ...
# ex : Monday : 410 to Saturday : 415. None on sunday. And none the next week.
sub helen {
  my $today = shift;
  my @lt = localtime($today);
  
  my $fourteendays = 24 * 3600 * 14;
  my $sixdays  = 24 * 3600 * 6;
  my $oneday = 24 * 3600;
  my $myvalue = 921517200 + $sixdays - $oneday;
  my $mynumber = 415;
  
  if ($today >= $myvalue) { # After the 14th of March 1999
    while ($today > $myvalue) {
      $myvalue += $fourteendays;
      $mynumber += 6;
    }
    return undef if ($today <= ($myvalue - $sixdays));
    while ($today < $myvalue) {
      $myvalue -= $oneday;
      $mynumber--;
    }
  } else { # Before the 15th of March 1999
    while (($myvalue - $sixdays) > $today) {
      $myvalue -= $fourteendays;
      $mynumber -= 6;
    }
    $myvalue -= $sixdays;
    $mynumber -= 6;
    return undef if ($myvalue >= $today);

    my $inc = 0;
    while ($myvalue < $today) {
      return undef if ($inc++ == 6);
      $myvalue += $oneday;
      $mynumber++;
    }
  }

  my $rec = {
      'name' => strftime("Helen_Sweetheart_of_the_Internet-${date_fmt}.gif",
			 @lt),
      'base' => "http://www.peterzale.com/",
      'page' => "$mynumber.gif"
      };
  
  return $rec;
}

1;
