#!/usr/bin/perl
use lib '.';
#if($ENV{HTTP_REFERER} !~ /suave\.net|lugnet\.com/i) {
#    print "Content-type: text/html\n\n Sorry, Page has been removed temporarily\-\- unfortunately excessive traffic from being bluesnews\'s Link of the Day has caused a bit more bandwidth than anticipated. We\'re happy to be a popular link and all, but it's a bit more than we can take at the moment :\(\n";
#    exit(0);
#}

require "pagelib.pl";
header();
head();

$dir = "images/trogdor";
if(!opendir(DIR,$dir)) {
    print "Internal error locating images!<br>\n";
}
@files = readdir(DIR);
foreach(@files) { push @images,$1 if(/(\w+)\.jpg/); }
%used = ();

print qq`
<br><br>
<B><font size=+1>Trogdor! (and friends)</font></B><br>
<br>
After becoming addicted to <a href=\"http://www.homestarrunner.com/trogdor.html\">The Cheat's favorite game</a>,
I started thinking about making a minifig scale Trogdor. Pretty soon
I was able to play Trogdor! without even needing my computer! All I need
now is a scoreboard...
`;

show_images('trogdor',
	    'trogdorwings',
	    'burnination',
	    'trogdorgame');
print qq`
And sure enough, a minifig scale Strong Bad and The Cheat were sure to follow:
`;
show_images('sb_and_cheat',
	    'cheat_butt');

print qq`
<br><br>
What? How do you build Trogdor? That's easy! Feel free to follow
along with my simple step by step instructions. I make building
FUN!!<br>
<table>
<tr><td><img src="images/trogdor/step1.jpg"></td>
<td valign=center align=left>To begin, build an "S", for 'snake'. Or, uh, dragon. Whatever.</td></tr>
<tr><td><img src="images/trogdor/step2.jpg"></td>
<td valign=center align=left>Next, we'll build a more different 'S'.</td></tr>
<tr><td><img src="images/trogdor/step3.jpg"></td>
<td valign=center align=left>Close it up real good at the top for his head.</td></tr>
<tr><td><img src="images/trogdor/step4.jpg"></td>
<td valign=center align=left>And then, using consummate bricks, give him teeth, spinities, and angry eyebrows.</td></tr>
<tr><td><img src="images/trogdor/step5.jpg"></td>
<td valign=center align=left>And you can add smoke, or fire, and maybe some wings. Y'know, if he's a wing-a-ling dragon.</td></tr>
<tr><td><img src="images/trogdor/step6.jpg"></td>
<td valign=center align=left>Let's put one of those beefy arms on him for good measure. That looks really good-- coming out of the back of his neck, there.</td></tr>
<tr><td><img src="images/trogdor/step7.jpg"></td>
<td valign=center align=left>Oh yeah! Check out all his majesty!</td></tr>
</table>
`;

foot();

sub show_images {
    my(@pics) = @_;
    my($i) = 0;
    print "<table width=100\%><tr>\n";
    foreach(@pics) {
	next if($used{$_});
	$used{$_} = 1;
	if(!($i++%4)) {
	    print "</tr>\n<tr>\n";
	}
	print "<td align=center><a href=\"$dir/$_.jpg\"><img src=\"$dir/$_\_th.jpg\" border=0></a></td>\n";
    }
    print "</tr></table>\n";
}



