#!/usr/bin/perl
use lib '.';
require "pagelib.pl";
header();
head();

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

print qq`
<br><br>
<B><font size=+1>5 Easy Steps to Modifying Your AT-AT Kit</font></B><br>
<br>
Initially I thought that modifying Lego's new <a href="http://guide.lugnet.com/set/4483">AT-AT</a>
set would be difficult. But strangely enough I found that I could do it
fairly quickly and easily, using pieces I already had laying around the
house.<br>
<br>
<table>
<tr><td><img src="images/spacer.gif" width=200 height=1></td></tr>
<tr><td><b>1.</b> Start by setting your AT-AT out as assembled from the instructions.</td>
<td>`;
show_image("step1");
print qq`</td></tr><tr><td><b>2.</b> You'll notice first that the feet aren't
quite in proportion to the rest of the model, or to proper scale. Replace the
feet with new feet that are slightly larger.</td><td>`;
show_image("step2");
print qq`</td></tr><tr><td><b>3.</b> While the new feet modification grossly
improves the model and we could stop there and have a beautiful looking AT-AT,
you'll notice (if you've done step 2 properly) that the legs are now forced
to bow out to the sides because of the increase in foot size. Therefore, the
legs must also be replaced.</td><td>`;
show_image("step3");
print qq`</td></tr><tr><td><b>4.</b> After modifying the legs, you may see
that the side guards no longer fit as intentioned. Therefore, we must tweak
the body design just slightly by completely rebuilding it.</td><td>`;
show_image("step4");
print qq`</td></tr><tr><td><b>5.</b> Although there are no more actual
conflicts in design, you may want to improve on the head design slightly to
give it better proportions.<br><br>Presto! Now you have an AT-AT you can be
proud of! Wasn't that easy?</td><td>`;
show_image("step5");
print qq`</table>
<br><br>
How does the modified AT-AT compare to the actual set? Although the
differences may be hard to spot at first, a closer look reveals quite a few
distinctions between the two models.
`;

show_images(@images);

foot();

sub show_image {
    my($pic) = @_;
    print "<a href=\"$dir/$pic.jpg\"><img src=\"$dir/$pic\_med.jpg\" border=0></a>";
    $used{$pic} = 1;
}

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";
}


