<? include $DOCUMENT_ROOT."/zzzfilelist.inc"; ?>
<? if (!$dont_inc_general) { include Inc("functions_general.inc.php"); } ?>
<? include Inc("metoo.inc.php"); ?>
<? include Inc("metoo_loc.inc.php"); ?>
<html>
<head><title>MeToo : Middle-Earth Tool for Overcoming Opposition</title></head>
<body>
<center>
<font size=+2><b>Middle-Earth Tool for Overcoming Opposition</b></font><br>
</center>
<hr>
<?
	if (!$goingtologin) { include Inc("testlogin.php");	}
?>
<? $where="sideneutrals"; include Inc("checkgameaccess.inc.php"); ?>
<? $game_checked=$game; include Inc("loaddata.inc.php"); ?>
<?
	if ($action=="update") {
		for ($i=1; $i<=5; $i++) {
			if (($data[$i][4]!=$side[$i]) || ($data[$i][5]!=$turn[$i])) {
				$data[$i][1]=$turntodisplay;
				for ($j=0; $j<=2; $j++) {
			  		if ($side[$i]==$loc[$loctag[1]+32+$j][$lang]) {
						$data[$i][4]=$j;
					}
				}
				$data[$i][5]=$turn[$i];
			}
		}

		$savefile="";
		for ($i=1; $i<=$datalin; $i++) {
			if ($data[$i][1]!="") {
				for ($j=1; $j<=$datacol; $j++) {
					if ($j!=1) {
						$savefile.=";";
					}
					$savefile.=$data[$i][$j];
				}
				$savefile.=chr(10);
			}
		}

		$fp = fopen ($fnsave, "w");
		fwrite($fp, $savefile);
		fclose($fp);

		include Inc("loaddata.inc.php");
	}
?>
<?
	echo "<table align=center border=1 cellspacing=0>";
	echo "<tr align=center>";
	echo "<td></td>";
	for ($i=1; $i<=25; $i++) {
		echo "<td width=21><font size=-2>".$loc[$loctag[1]+35+$i][$lang]."</td>";
	}
	echo "</tr>";
	for ($i=1; $i<=25; $i++) {
		$display=false;
		for ($j=1; $j<=25; $j++) {
			if ($relationlevel[$i][$j]!=0) { $display=true; }
		}
		if ($display) {
			echo "<tr>";
			echo "<td><font size=-1>".$loc[$loctag[1]+35+$i][$lang]."</td>";
			for ($j=1; $j<=25; $j++) {
				if ($i==$j) {
					echo "<td></td>";
				} else {
					echo "<td bgcolor=".$RelationColors[$relationlevel[$i][$j]].">&nbsp;</td>";
				}
			}
			echo "</tr>";
		}
	}
	echo "</table>";
	
	echo "<br>";
	echo "<table align=center border=1 cellspacing=0>";
	echo "<form action='sideneutrals.inc.php' method='post'>";
	echo "<input type='hidden' name='action' value='update'>";
	echo "<input type='hidden' name='game' value='$game'>";
	echo "<tr align=center>";
	echo "<td>People</td><td>Turned...</td><td>Since turn...</td>";
	echo "</tr>\n";
	for ($i=1; $i<=5; $i++) {
		echo "<tr align=center>";
		echo "<td><b>".$loc[$loctag[1]+20+$i][$lang]."</td>";
		echo "<td>";
		echo "<select name='side[$i]'>";
		for ($j=0; $j<=2; $j++) {
	  		echo "<option";
	  		if ($j==$NationSide[$i]) {
	  			echo " selected";
	  		}
	  		echo ">".$loc[$loctag[1]+32+$j][$lang]."\n";
		}
		echo "</select>\n";
		echo "</td>";
		echo "<td><input type='text' name='turn[$i]' size=2";
		if ($NationSideTurn[$i]!=0) {
			echo " value=".$NationSideTurn[$i];
		}
		echo "></td>";
		echo "</tr>";
	}
	echo "<tr align=center>";
	echo "<td colspan=3><input type='submit' value='".$loc[$loctag[2]+12][$lang]."'></td>";
	echo "</form></tr>\n";
	
	echo "</table>";
?>