<? include $DOCUMENT_ROOT."/zzzfilelist.inc"; ?>
<? include Inc("functions_general.inc.php"); ?>
<? include Inc("functions_images.inc.php"); ?>
<html>
<head><title>MeToo : Middle-Earth Tool for Overcoming Opposition</title></head>
<body>
<?
	echo "<table border=1>";
	for ($t=1; $t<=5; $t++) {
		echo "<tr>";
		$imbase=@imagecreatefromgif ("gfx/town".$t."_basic4.gif");

		for ($i=1; $i<=25; $i++) {
			echo "<td>";
			if ($i==11) { imagecolorset($imbase, 1, 0, 0, 0); }
			if ($i==21) { imagecolorset($imbase, 1, 115, 181, 198); }
			for ($j=1; $j<=3; $j++) {
				$c[$j]=substr($imgcolor[$i], ($j-1)*2+1, 2);
				$c[$j]=hexdec($c[$j]);
#				echo $c[$j].",";
			}
			if ($i<=10) { $index=1; } else { $index=0; }
			imagecolorset($imbase, $index, $c[1], $c[2], $c[3]); 
			$fn=$i."";
			if ($i<10) { $fn="0".$i; }
			$fn="gfx/town".$t."_".$fn.".gif";
#			echo $fn."<br>";
			imagegif($imbase, $fn);
			echo "<img src='$fn'>";
			echo "</td>";
		}
		echo "</tr>";
	}

	$imbase=@imagecreatefromgif ("gfx/flag.gif");
	echo "<tr>";
	for ($i=1; $i<=25; $i++) {
		if ($i==11) { echo "</tr>"; echo "<tr>"; imagecolorset($imbase, 1, 0, 0, 0); }
		if ($i==21) { echo "</tr>"; echo "<tr>"; imagecolorset($imbase, 1, 115, 181, 198); }
		echo "<td>";
		for ($j=1; $j<=3; $j++) {
			$c[$j]=substr($imgcolor[$i], ($j-1)*2+1, 2);
			$c[$j]=hexdec($c[$j]);
#			echo $c[$j].",";
		}
		if ($i<=10) { $index=1; } else { $index=0; }
		imagecolorset($imbase, $index, $c[1], $c[2], $c[3]); 
		$fn=$i."";
		if ($i<10) { $fn="0".$i; }
		$fn="gfx/flag_".$fn.".gif";
#		echo $fn."<br>";
		imagegif($imbase, $fn);
		echo "<img src='$fn'>";
		echo "</td>";
	}
	echo "</tr>";

	echo "<tr>";
	for ($t=1; $t<=5; $t++) {
		$imbase=@imagecreatefromgif ("gfx/fortif".$t.".gif");

		for ($i=1; $i<=3; $i++) {
			echo "<td>";
			if ($i==1) { imagecolorset($imbase, 0, 0, 0, 0); imagecolorset($imbase, 1, 160, 160, 160); }
			if ($i==2) { imagecolorset($imbase, 0, 160, 160, 160); imagecolorset($imbase, 1, 0, 0, 0); }
			if ($i==3) { imagecolorset($imbase, 0, 0, 0, 0); imagecolorset($imbase, 1, 154, 111, 77); }
			$fn=$i."";
			if ($i<10) { $fn="0".$i; }
			$fn="gfx/fortif".$t."_".$fn.".gif";
#			echo $fn."<br>";
			imagegif($imbase, $fn);
			echo "<img src='$fn'>";
			echo "</td>";
		}
	}
	echo "</tr>";

	$imbase=@imagecreatefromgif ("gfx/army1.gif");
	echo "<tr>";
	for ($i=1; $i<=25; $i++) {
		if ($i==11) { echo "</tr>"; echo "<tr>";  $imbase=@imagecreatefromgif ("gfx/army2.gif"); }
		if ($i==21) { echo "</tr>"; echo "<tr>";  $imbase=@imagecreatefromgif ("gfx/army3.gif"); }
		echo "<td>";
		for ($j=1; $j<=3; $j++) {
			$c[$j]=substr($imgcolor[$i], ($j-1)*2+1, 2);
			$c[$j]=hexdec($c[$j]);
#			echo $c[$j].",";
		}
		imagecolorset($imbase, 1, $c[1], $c[2], $c[3]); 
		$fn=$i."";
		if ($i<10) { $fn="0".$i; }
		$fn="gfx/army_".$fn.".gif";
#		echo $fn."<br>";
		imagegif($imbase, $fn);
		echo "<img src='$fn'>";
		echo "</td>";
	}
	echo "</tr>";

	$imbase=@imagecreatefromgif ("gfx/hero1.gif");
	echo "<tr>";
	for ($i=1; $i<=25; $i++) {
		if ($i==11) { echo "</tr>"; echo "<tr>";  $imbase=@imagecreatefromgif ("gfx/hero2.gif"); }
		if ($i==21) { echo "</tr>"; echo "<tr>";  $imbase=@imagecreatefromgif ("gfx/hero3.gif"); }
		echo "<td>";
		for ($j=1; $j<=3; $j++) {
			$c[$j]=substr($imgcolor[$i], ($j-1)*2+1, 2);
			$c[$j]=hexdec($c[$j]);
#			echo $c[$j].",";
		}
		imagecolorset($imbase, 1, $c[1], $c[2], $c[3]); 
		$fn=$i."";
		if ($i<10) { $fn="0".$i; }
		$fn="gfx/hero_".$fn.".gif";
#		echo $fn."<br>";
		imagegif($imbase, $fn);
		echo "<img src='$fn'>";
		echo "</td>";
	}
	echo "</tr>";

	echo "<tr><td>";
	$fn="gfx/anchor1.gif";
	echo "<img src='$fn'>";
	echo "</td><td>";
	$fn="gfx/anchor2.gif";
	echo "<img src='$fn'>";
	echo "</td></tr>";
	echo "</table>";
?>