#-*-Perl-*-

foreach (qw(pretzel thatlife dilbertcl)) {
    $hof{$_} = 0;
}

#Mercury Center Comics 	
sub mercury {
    my ($time,$title,$author,$file,$wd_type,$sun_type,$wd_size,$sun_size,$id)
	= @_;
    my @ltime = gmtime($time);
    if ($ltime[6] == 0) {
        $size = $sun_size;
        $type = $sun_type;
    } else {
        $size = $wd_size;
        $type = $wd_type;
    }                                      
    my $daysago = (time - $time)/(3600*24);
    $daysago =~ s/\..*$//;
    #since the website uses %m_%d to organize comics, last year's
    #gets overwritten as the current year's are produced.
    return undef if ($daysago > 365) ||
	! defined($size) || ! defined($type);
    my $rec = {
	'title' => $title,
	'author' => $author,
	'type' => $type,
	'main' => "http://cgi.mercurycenter.com/cgi-bin/comics/show.cgi?ID=$id&DATE=TODAY",
	'archives' => "http://cgi.mercurycenter.com/cgi-bin/comics/show.cgi?ID=$id&DATE=TODAY",
	'base' => "http://cgi.mercurycenter.com/premium/comics/",
	'page' => strftime("%m_%d/$file.$type",@ltime),
	'size' => $size
	};
    return $rec;
}

#Pretzel Logic
sub pretzel {
#appears to be only TThSa
    my $time = shift;
    my @ltime = gmtime($time);
    return undef if ($ltime[6] !~ /[246]/);
    return mercury($time,"Pretzel Logic","Frank Deale","pretzel",
		       'gif','gif',[250,296],[250,296],89);
}


#Dilbert Classics
sub dilbertcl {
    my $time = shift;
    return mercury($time,"Dilbert Classics","Scott Adams","dilbert",
                       'gif','gif',[725,509],[250,296],116);
}

#That's Life
sub thatlife {
    my $time = shift;
    return mercury($time,"Thats Life","Mike Twohy","thats_life",
                       'gif','gif',[252,310],[620,308],123);
}

1;
