<?php
include_once('mapcfg.php');

echo '<html>
<head>
	<meta http-equiv=Content-Style-Type content=text/css>
	<link rel=stylesheet href=', $cssloc, ' type=text/css>
	<LINK REL="SHORTCUT ICON" href="favicon.ico">
	<title>', $dbdecarray['campaignname'], ' Webmap</title>
</head>
<body>
	<br>
	<center><h2><b><font color="#FFCC33">', $dbdecarray['campaignname'], ' Webmap</font></b></h2></center>
	<table width="75%" cellspacing=0 cellpadding=0 border=0 align="center">
		<tr class="catbg">
			<td width="10%" align="center">
			</td>
			<td width="80%" align="center">
				<br>
				<form action="ffmap.php" method=post name="ffmap">
					<select size=1 name="layer">
						<option selected value="Empire">-Layer-</option>
						<option value="Empire">Empire</option>
						<option value="Cartel">Cartel</option>
					</select> 
					<select size=1 name="mtype">
						<option selected value="Terrain">-Filter-</option>						
						<option value="Terrain">Terrain</option>
						<option value="Economy">Economy</option>
						<option value="Defence">Defence</option>
					</select> 
					<select size=1 name="zoom">
						<option selected value="4">-Zoom-</option>
						<option value="1">100%</option>
						<option value="2">50%</option>
						<option value="3">33%</option>
						<option value="4">25%</option>
						<option value="10">10%</option>
					</select> 
					<input type=submit value="Load Map" name="submit">
				</form>	
			</td>
			<td width="10%" align="center">
			</td>
		</tr>
		<tr class="windowbg2">
			<td width="10%" align="center">
			</td>
			<td width="80%" align="center">
				<br>
				<font face="Arial" size="2">
				<b>Campaign Description:</b><br><br>
				', $dbdecarray['campdesc'], '
				<br><br>';

				$Diff = array();
				$Diff[0] = "Captain";
				$Diff[1] = "Commodore";				
				$Diff[2] = "Admiral";

echo				'Campaign Difficulty: ', $Diff[$dbdecarray['campdifficulty']], '<br>';

				$TurnNoDec = $dbdecarray['campturnssofar'];
				$TurnsPerYearDec = $dbdecarray['campturnsperyear'];
				$MilliSecondsPerTurnDec = $dbdecarray['camplengthofturn'];
				$BaseYearDec = $dbdecarray['campbaseyear']; 

				$stardate = floor(($BaseYearDec + ($TurnNoDec / $TurnsPerYearDec))).".".fmod($TurnNoDec, $TurnsPerYearDec);

				echo ("Stardate: ");
				echo $stardate;
				echo ("<br>");


				echo ("Population: ");
				echo $dbdecarray['campnumaccounts'];
				echo ("/");
				echo $dbdecarray['campmaxaccounts'];
				echo (" players, ");
				echo $dbdecarray['campnumplaying'];
				echo ("/");
				echo $dbdecarray['campmaxplaying'];
				echo (" logged on.");
				echo ("<br><br>");
				echo ("Empires / Cartels:");
				echo ("<br>");

				$RaceListNoCount = $dbdecarray['campnumraces'];
				for ($m=1; $m <= $RaceListNoCount; $m++) {
					echo $empstring[$dbdecarray['camprace'.$m]];
					echo ("<br>");
					
				}
				echo ("<br>");
				echo ("Server Version: ");
				echo $dbdecarray['campversion'];
				echo ("<br><br>");
				$turnlengthmins	= $dbdecarray['camplengthofturn']/60000;
				echo ("<I>Data is current to the end of the last $turnlengthmins minute turn...</I>");
				echo ("</font>");		
	echo ("<br><br>");	
	echo ("</td>");
    	echo ("<td width=10% align=center>");
	echo ("</td>");
	echo ("</tr>");

  	echo ("<tr class=catbg>");
    	echo ("<td width=10% align=center>");
	echo ("</td>");
    	echo ("<td width=80% align=center>");
	echo ("<br>");
		echo ("<font face=Arial size=2>");
		echo ("<a href=mapsum.php>Summary</a>");
		echo ("&nbsp;&nbsp;&nbsp;<a href=politics.php>Politics</a>");
		if ($usekills == 1) {
			echo ("&nbsp;&nbsp;&nbsp;<a href=kills.php target=_blank>Kills</a>");
		}
		if ($usets == 1){
			echo ("&nbsp;&nbsp;&nbsp;<a href=$TSlink target=_blank>TS</a>");				
		}
		if ($usejavairc == 1){
			echo ("&nbsp;&nbsp;&nbsp;<a href=dynachat/irc_chat.php target=_blank>IRC</a>");				
		}
		if ($useforumslink == 1){
			echo ("&nbsp;&nbsp;&nbsp;<a href=$forumsroot target=_blank>Forums</a>");
		}
		//echo ("<a href=politics.php>Politics</a>");
		echo ("</font>");
	echo ("<br><br>");			
	echo ("</td>");
    	echo ("<td width=10% align=center>");
	echo ("</td>");
	echo ("</tr>");


echo ("</table>");
echo ("<br><br>");
echo ("<center>");
echo ("<A HREF=http://www.php.net target=_blank><IMG SRC=php-power-white.png ALT='Powered by PHP' BORDER=0 WIDTH=88 HEIGHT=31></A>");
echo ("</center>");
echo ("</body>");
echo ("</html>");
?>