<? include $DOCUMENT_ROOT."/zzzfilelist.inc"; ?>
<? include Inc("metootop.inc.php"); ?>
<? $where="displaymap"; include Inc("checkgameaccess.inc.php"); ?>
<?
	$fn=Inc("mapdata.csv");
	$fp = fopen ($fn, "r");
	$mapcontent = fread($fp, filesize($fn));
	fclose($fp);
	Decrunch($mapcontent);
	$mapcontentcell=$cell;
	
	$fn=Inc("mapriver.csv");
	$fp = fopen ($fn, "r");
	$mapriver = fread($fp, filesize($fn));
	fclose($fp);
	Decrunch($mapriver);
	$mapriver=$cell;
	
	$fn=Inc("maproad.csv");
	$fp = fopen ($fn, "r");
	$maproad = fread($fp, filesize($fn));
	fclose($fp);
	Decrunch($maproad);
	$maproad=$cell;
	
	$fn=Inc("fileroad.csv");
	$fp = fopen ($fn, "r");
	$fileroad = fread($fp, filesize($fn));
	fclose($fp);
	Decrunch($fileroad);
	$fileroad=$cell;
	
	$fn=Inc("fileriver.csv");
	$fp = fopen ($fn, "r");
	$fileriver = fread($fp, filesize($fn));
	fclose($fp);
	Decrunch($fileriver);
	$fileriver=$cell;

	$fn=Inc("map_names.csv");
	$fp = fopen ($fn, "r");
	$content = fread($fp, filesize($fn));
	fclose($fp);
	Decrunch($content);
	$cellnames=$cell;
	$cellnames_lin=$lin;

	$fn=Inc("regions.csv");
	$fp = fopen ($fn, "r");
	$content = fread($fp, filesize($fn));
	fclose($fp);
	Decrunch($content);
	$mapregions=$cell;
?>
<style type="text/css">
  .a { position:absolute;top:0px;right:0px;z-index:1 }
  .r { position:relative; }
  .c { position:absolute;top:10px;right:18px;z-index:10 }
</style>
<SCRIPT LANGUAGE="JavaScript">
var moveHorse=false, moveUnfed=false, showTurn=false, showWoMarch=false;
var pathFinding=false, displayRange=false;
var displayPlot=true;
var idMem, errorMem=0, color_errorMem;
var waynb=0;
var way_id=new Array(50);
var way_color=new Array(50);
var way_count=new Array(50), way_countUnfed=new Array(50);
var way_countHorse=new Array(50), way_countHorseUnfed=new Array(50);
var way_road=new Array(50);
var Move=new Array (<?
	for ($i=1; $i<=count($MoveCost)-1; $i++) {
		if ($i!=1) echo ", ";
		echo $MoveCost[$i];
	}
?>
);
var roadName=new Array (<?
	for ($i=0; $i<=6; $i++) {
		if ($i!=0) echo ", ";
		echo "'".$loc[$loctag[4]+15+$i][$lang]."'";
	}
?>
);
var MoveRoad=new Array (<?
	for ($i=1; $i<=count($MoveCostRoad)-1; $i++) {
		if ($i!=1) echo ", ";
		echo $MoveCostRoad[$i];
	}
?>
);
var MoveHorse=new Array (<?
	for ($i=1; $i<=count($MoveCostHorse)-1; $i++) {
		if ($i!=1) echo ", ";
		echo $MoveCostHorse[$i];
	}
?>
);
var MoveHorseRoad=new Array (<?
	for ($i=1; $i<=count($MoveCostHorseRoad)-1; $i++) {
		if ($i!=1) echo ", ";
		echo $MoveCostHorseRoad[$i];
	}
?>
);
var Ground=new Array(
<?
	for ($i=1; $i<=$maplin; $i++) {
		if ($i!=1) echo ",\n";
		echo "\t new Array(";
		for ($j=1; $j<=$mapcol; $j++) {
			if ($j!=1) echo ",";
			echo $mapcontentcell[$i][$j];
		}
		echo ")";
	}
?>
);
var GroundColor=new Array(
<?
	for ($i=1; $i<=count($mapcolor); $i++) {
		if ($i!=1) echo ", ";
		echo "'".$mapcolor[$i]."'";
	}
?>
);
var VisionStart=new Array(
<?
	for ($i=0; $i<=count($visionstart); $i++) {
		if ($i!=0) echo ", ";
		echo "'".$visionstart[$i]."'";
	}
?>
);
var River=new Array(
<?
	for ($i=1; $i<=$maplin; $i++) {
		if ($i!=1) echo ",\n";
		echo "\t new Array(";
		for ($j=1; $j<=$mapcol; $j++) {
			if ($j!=1) echo ",";
			if ($mapriver[$i][$j]=="") { $mapriver[$i][$j]="000000"; }
			if ($mapriver[$i][$j]==" ") { $mapriver[$i][$j]="000000"; }
			echo "'".$mapriver[$i][$j]."'";
		}
		echo ")";
	}
?>
);
var Road=new Array(
<?
	for ($i=1; $i<=$maplin; $i++) {
		if ($i!=1) echo ",\n";
		echo "\t new Array(";
		for ($j=1; $j<=$mapcol; $j++) {
			if ($j!=1) echo ",";
			if ($maproad[$i][$j]=="") { $maproad[$i][$j]="000000"; }
			echo "'".$maproad[$i][$j]."'";
		}
		echo ")";
	}
?>
);
var Regions=new Array(
<?
	for ($i=1; $i<=$maplin; $i++) {
		if ($i!=1) echo ",\n";
		echo "\t new Array(";
		for ($j=1; $j<=$mapcol; $j++) {
			if ($j!=1) echo ",";
			echo $mapregions[$i][$j];
			if ($mapregions[$i][$j]=="") { echo "0"; }
		}
		echo ")";
	}
?>
);

function isEven(x) {
	return (x%2)?false:true;
}


function M() {
	if (displayPlot) {
		document.getElementById('plots').style.display='none';
		displayPlot=false;
	} else {
		document.getElementById('plots').style.display='block';
		displayPlot=true;
	}
}

function showRange() {
	var i, r, startx, starty, x, y, cx, cy, c, vs, add=0, dis=0;
	if (displayRange) {
		displayRange=false;
		pathFinding=false;
		notThisTime=true;
		for(i=1; i<=waynb; i++) {
			document.getElementById(way_id[i]).style.backgroundColor = way_color[i];
			document.getElementById(way_id[i]+".c").innerHTML="";
		}
		waynb=0;
	} else {
		if (pathFinding) {
			displayRange=true;
			dis=9;
		}
	}
			vs=idMem.split('.');
			startx=vs[0]*1;
			starty=vs[1]*1;
			if ((starty/2)!=parseInt(starty/2)) { add=-1; }
			
			y=starty-13;
			for (x=startx-6; x<=startx+7; x++) {
				if ((x>=1) && (y>=1) && (x<=44) && (y<=39)) {
					cx=x+add;
					cy=y;
					c=cx+"."+cy;
					document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+dis];
				}
			}
			y=starty+13;
			for (x=startx-6; x<=startx+7; x++) {
				if ((x>=1) && (y>=1) && (x<=44) && (y<=39)) {
					cx=x+add;
					cy=y;
					c=cx+"."+cy;
					document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+dis];
				}
			}
			x=startx-13;
			y=starty+1;
			do {
				y--;
				if ((y/2)!=parseInt(y/2)) { x++; }
				if ((x>=1) && (y>=1) && (x<=44) && (y<=39)) {
					cx=x+add;
					cy=y;
					c=cx+"."+cy;
					document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+dis];
				}
			} while (y>starty-13)
			x=startx-13;
			y=starty-1;
			do {
				y++;
				if ((y/2)!=parseInt(y/2)) { x++; }
				if ((x>=1) && (y>=1) && (x<=44) && (y<=39)) {
					cx=x+add;
					cy=y;
					c=cx+"."+cy;
					document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+dis];
				}
			} while (y<starty+13)
			x=startx+14;
			y=starty+1;
			do {
				y--;
				if ((y/2)==parseInt(y/2)) { x--; }
				if ((x>=1) && (y>=1) && (x<=44) && (y<=39)) {
					cx=x+add;
					cy=y;
					c=cx+"."+cy;
					document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+dis];
				}
			} while (y>starty-13)
			x=startx+14;
			y=starty-1;
			do {
				y++;
				if ((y/2)==parseInt(y/2)) { x--; }
				if ((x>=1) && (y>=1) && (x<=44) && (y<=39)) {
					cx=x+add;
					cy=y;
					c=cx+"."+cy;
					document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+dis];
				}
			} while (y<starty+13)
}

function Col(id) {
	var i, r, startx, starty, x, y, cx, cy, c, xm, vs, t, ts, te;
	if (pathFinding) {
		pathFinding=false;
		notThisTime=true;
		for(i=1; i<=waynb; i++) {
			document.getElementById(way_id[i]).style.backgroundColor = way_color[i];
			document.getElementById(way_id[i]+".c").innerHTML="";
		}
		waynb=0;
	}
	if (id==0) {
		for (y=1; y<=39; y++) {
			for (x=1; x<=44; x++) {
				c=GroundColor[Ground[y-1][x-1]-1];
				document.getElementById(x+"."+y).style.backgroundColor = c;
			}
		}
	} else {
		if (id<=25) {
			xm=9;
			vs=VisionStart[id].split('.');
			startx=vs[0]*1;
			starty=vs[1]*1;
			for (y=1; y<=13; y++) {
				for (x=1; x<=xm; x++) {
					cx=x+startx-1;
					cy=y+starty-1;
					c=cx+"."+cy;
					document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+9];
				}
				if (xm==9) { xm=8; } else { xm=9; }
			}
		} else {
			if (id==26) { ts=1; te=10; }
			if (id==27) { ts=11; te=20; }
			if (id==28) { ts=21; te=25; }
			if (id==29) { ts=1; te=25; }
			
			for (t=ts; t<=te; t++) {
				xm=9;
				vs=VisionStart[t].split('.');
				startx=vs[0]*1;
				starty=vs[1]*1;
				for (y=1; y<=13; y++) {
					for (x=1; x<=xm; x++) {
						cx=x+startx-1;
						cy=y+starty-1;
						c=cx+"."+cy;
						document.getElementById(c).style.backgroundColor = GroundColor[Ground[cy-1][cx-1]-1+9];
					}
					if (xm==9) { xm=8; } else { xm=9; }
				}
			}
		}
	}
}

function Reg(id) {
	var i, r, x, y, c;
	if (pathFinding) {
		pathFinding=false;
		notThisTime=true;
		for (i=1; i<=waynb; i++) {
			document.getElementById(way_id[i]).style.backgroundColor = way_color[i];
			document.getElementById(way_id[i]+".c").innerHTML="";
		}
		waynb=0;
	}
	if (id==0) {
		for (y=1; y<=39; y++) {
			for (x=1; x<=44; x++) {
				c=GroundColor[Ground[y-1][x-1]-1];
				document.getElementById(x+"."+y).style.backgroundColor = c;
			}
		}
	} else {
		for (y=1; y<=39; y++) {
			for (x=1; x<=44; x++) {
				if (Regions[y-1][x-1]==id) {
					document.getElementById(x+"."+y).style.backgroundColor = GroundColor[Ground[y-1][x-1]-1+9];
				}
			}
		}
	}
}

function HL(id) {
	waynb++;
	way_id[waynb]=id;
	way_color[waynb]=document.getElementById(id).style.backgroundColor;
	document.getElementById(id).style.backgroundColor = '#FFFF80';
}

function C(id) {
	var i, t, sum, show, add, limit;
	if (id=='move1') {
		moveHorse=false;
		document.getElementById('move1').style.backgroundColor = '#FFFF80';
		document.getElementById('move2').style.backgroundColor = '#372710';
	}
	if (id=='move2') {
		moveHorse=true;
		document.getElementById('move2').style.backgroundColor = '#FFFF80';
		document.getElementById('move1').style.backgroundColor = '#372710';
	}
	if (id=='move3') {
		moveUnfed=!moveUnfed;
		if (moveUnfed) {
			document.getElementById('move3').style.backgroundColor = '#FFFF80';
		} else {
			document.getElementById('move3').style.backgroundColor = '#372710';
		}
	}
	if (id=='move4') {
		showTurn=false;
		showWoMarch=false;
		document.getElementById(id).style.backgroundColor = '#FFFF80';
		document.getElementById('move5').style.backgroundColor = '#372710';
		document.getElementById('move6').style.backgroundColor = '#372710';
	}
	if (id=='move5') {
		showTurn=true;
		showWoMarch=false;
		document.getElementById(id).style.backgroundColor = '#FFFF80';
		document.getElementById('move4').style.backgroundColor = '#372710';
		document.getElementById('move6').style.backgroundColor = '#372710';
	}
	if (id=='move6') {
		showTurn=true;
		showWoMarch=true;
		document.getElementById(id).style.backgroundColor = '#FFFF80';
		document.getElementById('move4').style.backgroundColor = '#372710';
		document.getElementById('move5').style.backgroundColor = '#372710';
	}
	t=1;
	sum=0;
	for (i=2; i<=waynb; i++) {
		id=way_id[i]+".c";
		if (showWoMarch) { limit=12; } else { limit=14; }
		if (!moveUnfed) {
			if (!moveHorse) {
				show=way_count[i];
				add=way_count[i]-way_count[i-1];
			} else {
				show=way_countHorse[i];
				add=way_countHorse[i]-way_countHorse[i-1];
			}
		} else {
			if (!moveHorse) {
				show=way_countUnfed[i];
				add=way_countUnfed[i]-way_countUnfed[i-1];
			} else {
				show=way_countHorseUnfed[i];
				add=way_countHorseUnfed[i]-way_countHorseUnfed[i-1];
			}
		}
		if (sum+add>limit) {
			t=t+1;
			sum=add;
		} else {
			sum=sum+add;
		}
		if (!showTurn) {
			document.getElementById(id).innerHTML="<font size=2 color=red><b>"+show;
		} else {
			document.getElementById(id).innerHTML="<font size=2 color=green><b>"+t;
		}
	}
}

function S(id) {
	var i, text;
	var ids=id.split('.'), ids2, difx, dify;
	var m, mmem, mHorse, sdir=0, riv, roa;
	var notThisTime=false, newCell=true;
	var canGo=true, moreWay=0;
	if (errorMem!=0) {
		document.getElementById(errorMem).style.backgroundColor = color_errorMem;
		document.getElementById(errorMem+".c").innerHTML="";
		errorMem=0;
	}
	if (pathFinding) {
		if (id==idMem) {
			pathFinding=false;
			notThisTime=true;
			for(i=1; i<=waynb; i++) {
				document.getElementById(way_id[i]).style.backgroundColor = way_color[i];
				document.getElementById(way_id[i]+".c").innerHTML="";
			}
			waynb=0;
		} else {
			for (i=1; i<=waynb; i++) {
				if (id==way_id[i]) { k=i; newCell=false; }
			}
			if (newCell) {
				ids2=way_id[waynb].split('.');
				dify=ids[1]-ids2[1]; difx=ids[0]-ids2[0];
				if (dify==0) {
					if (difx==-1) { sdir=4; }
					if (difx==1) { sdir=1; }
				} else {
					if (dify==-1) {
						if (isEven(ids2[1])) {
							if (difx==0) { sdir=5; }
							if (difx==1) { sdir=6; }
						} else {
							if (difx==-1) { sdir=5; }
							if (difx==0) { sdir=6; }
						}
					}
					if (dify==1) {
						if (isEven(ids2[1])) {
							if (difx==0) { sdir=3; }
							if (difx==1) { sdir=2; }
						} else {
							if (difx==-1) { sdir=3; }
							if (difx==0) { sdir=2; }
						}
					}
				}
				if (sdir==0) {
					canGo=false;
				} else {
					riv=River[ids[1]-1][ids[0]-1].charAt(sdir-1);
					roa=Road[ids[1]-1][ids[0]-1].charAt(sdir-1);
					if (riv==1) {
						if (roa>1) {
							moreWay=1;
						} else {
							canGo=false;
						}
					}
					if (riv==2) {
						if (roa>1) {
							moreWay=1;
						} else {
							moreWay=2;
						}
					}
					m=Ground[ids[1]-1][ids[0]-1];
					mHorse=m;
					if ((roa==1) || (roa>3)) {
						m=MoveRoad[m-1];
						mHorse=MoveHorseRoad[mHorse-1];
					} else {
						m=Move[m-1];
						mHorse=MoveHorse[mHorse-1];
					}
					mmem=m;
					m=m+moreWay;
					mHorse=mHorse+moreWay;
					if (canGo) {
						HL(id);
						way_count[waynb]=way_count[waynb-1]+m;
						way_countHorse[waynb]=way_countHorse[waynb-1]+mHorse;
						way_countUnfed[waynb]=way_countUnfed[waynb-1]+Math.ceil(m*4/3);
						way_countHorseUnfed[waynb]=way_countHorseUnfed[waynb-1]+Math.ceil(mHorse*4/3);
						way_road[waynb]=roadName[sdir];
						C(0);
					}
//					document.getElementById(id+".c").innerHTML="<font size=1 color=red><b>"+sdir+"("+riv+","+roa+","+mmem+","+moreWay+")="+m;
				}
				if (!canGo) {
					color_errorMem=document.getElementById(id).style.backgroundColor;
					document.getElementById(id).style.backgroundColor = '#FF0000';
					errorMem=id;
				}
			} else {
				for (i=k; i<=waynb; i++) {
					document.getElementById(way_id[i]).style.backgroundColor = way_color[i];
					document.getElementById(way_id[i]+".c").innerHTML="";
				}
				waynb=k-1;
			}
		}
		text="";
		for (i=2; i<=waynb; i++) {
			if (i!=2) { text=text+", "; }
			text=text+way_road[i];
		}
		document.getElementById("displayRoad").innerHTML=text;
	}
	if ((!pathFinding) && (!notThisTime)) {
		pathFinding=true;
		idMem=id;
		waynb=0;
		HL(id);
		way_count[waynb]=0;
		way_countHorse[waynb]=0;
		way_countUnfed[waynb]=0;
		way_countHorseUnfed[waynb]=0;
	}
}

function DC(id) {
	openWindow('inc/input_data.inc.php?game_checked=<? echo $game_checked; ?>&id='+id,'400','600');
}

overdiv="0";
//  #########  CREATES POP UP BOXES 
function pL(text){
if (navigator.family == "gecko") {pad="0"; bord="1 bordercolor=black";}
else {pad="1"; bord="0";}
	desc="<table cellspacing=0 cellpadding="+pad+" border="+bord+"  bgcolor=000000><tr><td>\n"
	+"<table cellspacing=0 cellpadding=3 border=0 width=100%><tr><td bgcolor=ffffdd><center><font size=-1>\n"
	+text
	+"\n</td></tr></table>\n"
	+"</td></tr></table>";
if(navigator.family =="nn4") {
	document.object1.document.write(desc);
	document.object1.document.close();
	document.object1.left=x-40;
	document.object1.top=y+20;
	}
else if(navigator.family =="ie4"){
	object1.innerHTML=desc;
	object1.style.pixelLeft=x-40;
	object1.style.pixelTop=y+20;
	}
else if(navigator.family =="gecko"){
	document.getElementById("object1").innerHTML=desc;
	document.getElementById("object1").style.left=x-40;
	document.getElementById("object1").style.top=y+20;
	}
}
function hL(){
if (overdiv == "0") {
	if(navigator.family =="nn4") {eval(document.object1.top="-500");}
	else if(navigator.family =="ie4"){object1.innerHTML="";}
	else if(navigator.family =="gecko") {document.getElementById("object1").style.top="-500";}
	}
}

//  ########  TRACKS MOUSE POSITION FOR POPUP PLACEMENT
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function handlerMM(e){
x = (isNav) ? e.pageX : event.clientX + document.body.scrollLeft;
y = (isNav) ? e.pageY : event.clientY + document.body.scrollTop;
}
if (isNav){document.captureEvents(Event.MOUSEMOVE);}
document.onmousemove = handlerMM;

// This array is used for hotkeys
var keyActions = new Array ();
keyActions [0] = {character:  "q", 
                  actionType: "code", 
                  param:      "C('move1');"};
keyActions [1] = {character:  "z", 
                  actionType: "code", 
                  param:      "C('move2');"};
keyActions [2] = {character:  "e", 
                  actionType: "code", 
                  param:      "C('move3');"};
keyActions [3] = {character:  "x", 
                  actionType: "code", 
                  param:      "showRange('');"};
// End of user defined array

//  End -->
</script>
<div id="object1" style="position:absolute; background-color:FFFFDD;color:black;border-color:black;border-width:20; visibility:show; left:25px; top:-100px; z-index:1000" onmouseover="overdiv=1;"  onmouseout="overdiv=0; setTimeout('hL()',1000)">
pop up description layer
</div>
<? include Inc("loaddata.inc.php"); ?>
<?
	$dirtiles=DirL('tilesrep.txt');
	$fn=$DOCUMENT_ROOT.$dirtiles."tilesdone.txt";
	if (!file_exists($fn)) {
		$fp = fopen ($fn, "w");
		fwrite($fp, "done");
		fclose($fp);

		$createtiles="yes";
		echo "<br><center><font class='jaunePALEpetit'><b>=== creating game tiles ===</b></font></center><br>";
	}
?>
<? include Inc("displaymap_menu.php"); ?>
<?	
	$fortiftop=(int)($mapcell-($mapcell/4)-$imfortifsize);
	$fortifleft=(int)(($mapcell-$imfortifsize)/2);
	$fortifright=(int)(($mapcell-$imfortifsize)/2);
	$towntop=(int)($mapcell-($mapcell/4)-$imtownsize);
	$townleft=(int)(($mapcell-$imtownsize)/2);
	$townright=(int)(($mapcell-$imtownsize)/2);
	$flagtop=(int)($mapcell-($mapcell/4)-$imflagsize);
	$flagleft=(int)(($mapcell-$imflagsize)/2);
	$flagright=(int)(($mapcell-$imflagsize)/2);
	$armytop[1]=(int)($mapcell-$imitemsize);
	$armytop[2]=(int)($mapcell-$imitemsize);
	$armytop[3]=(int)($mapcell-$imitemsize);
	$armyleft[1]=1;
	$armyleft[2]=(int)($mapcell-$imitemsize)-1;
	$armyleft[3]=(int)(($mapcell-$imitemsize)/2);
	$armyright[1]=(int)($mapcell-$imitemsize)-1;
	$armyright[2]=1;
	$armyright[3]=(int)(($mapcell-$imitemsize)/2);
	$anchortop=1;
	$anchorleft=(int)($mapcell-$imitemsize)-1;
	$anchorright=(int)($mapcell-$imitemsize)-1;
	$herotop=1;
	$heroleft=(int)($mapcell-$imitemsize)-3;
	$heroright=1;
	$artefacttop=$imherosize;
	$artefactright=1;
	
	$verbose=false;
	$verbose1=false;
	$verbose2=false;

	$displaymap=true;
?>
<? include Inc("displaynames.inc.php"); ?>
<?
#	$savefileriver=""; $savefileroad=""; # to build river / road images

	echo "<table width=".(($mapcol+0.5)*$mapcell)." cellpadding=0 cellspacing=0 border=0>";
	echo "<tr height=1>";
	for ($i=1; $i<=2*$mapcol+1; $i++) {
		echo "<td width=".(int)($mapcell/2).">";
		echo "</td>";
	}
	echo "</tr>";
	for ($j=1; $j<=$maplin; $j++) {
		echo "<tr height=$mapcell valign=top align=center>\n";
#		if ($j!=1) { $savefileriver.=chr(10); $savefileroad.=chr(10); } # to build river / road images
		for ($i=1; $i<=$mapcol+1; $i++) {
			if (($i==1) && ($j==1)) {
				for ($t=1; $t<=$nbheroes; $t++) {
					$tempname=substr(strtolower($hero[$t]->name), 0, 5);
					trim($tempname);
					
					for ($a=1; $a<=count($Accents); $a++) {
						$tempname=str_replace($Accents[$a],$AccentsR[$a],$tempname);
						$tempname=str_replace("-"," ",$tempname);
					}
					$hero[$t]->handle=$tempname;
				}

				echo "<div id='plots' style='position:absolute;z-index:100;display:block'>\n";
				for ($pm=1; $pm<=25; $pm++) {
					include Inc("extractorders.inc.php");
					$plot="plot".$pm.".gif";
					if ($pm<10) { $pp="0".$pm; } else { $pp=$pm; }
					$iconplot="hero_".$pp.".gif";

					for ($hmhero=1; $hmhero<=$orders; $hmhero++) {
						$startinghex=$hero[$moves[$hmhero][1]]->hex;
#						echo "plotting for ".$hero[$moves[$hmhero][1]]->name." starting $startinghex<br>";
						if ($moves[$hmhero][2]==3) {
							$text="<i>".$loc[$loctag[4]+35][$lang]."</i>";
							$xmove=substr($startinghex,0,2);
							$ymove=substr($startinghex,2,2);
							$hmx=$xmove*$mapcell;
							$hmy=$ymove*$mapcell;
							$hmy-=($mapcell/10);
							if (1&$ymove) { $hmx-=$mapcell/2;}
							$hmx-=5;$hmy-=5;
							echo "<div style='position:absolute; left:".$hmx."px; top:".$hmy."px;'>";
							echo "<img src='gfx/s/battle.gif' onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'>";
							echo "</div>\n";
						}
						if ($moves[$hmhero][2]==2) {
							$text="<i>".$loc[$loctag[4]+34][$lang]."<br>".$hero[$moves[$hmhero][1]]->name."</i>";
							$xmove=substr($moves[$hmhero][3],0,2);
							$ymove=substr($moves[$hmhero][3],2,2);
							$hmx=($xmove-1)*$mapcell+1+$heromoveinhex[$xmove][$ymove]*$imherosize;
							$hmy=($ymove-1)*$mapcell;
							$hmy+=$imherosize+2;
							if (!(1&$ymove)) { $hmx+=$mapcell/2; }
							echo "<div style='position:absolute; left:".$hmx."px; top:".$hmy."px;";
							echo " filter:alpha(opacity=70);-moz-opacity:.70;opacity:.70;'>";
							echo "<img src='gfx/s/$iconplot' onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'>";
							echo "</div>\n";
							$heromoveinhex[$xmove][$ymove]++;
						}
						if ($moves[$hmhero][2]==1) {
							$text="<i>".$loc[$loctag[4]+33][$lang]."<br>".$hero[$moves[$hmhero][1]]->name."</i>";
							$xmove=substr($startinghex,0,2);
							$ymove=substr($startinghex,2,2);
							$hmx=$xmove*$mapcell;
							$hmy=$ymove*$mapcell;
							$hmy-=($mapcell/10);
							if (1&$ymove) { $hmx-=$mapcell/2;}
							$hmx-=3;$hmy-=3;
							echo "<div style='position:absolute; left:".($hmx+$plotting[$hmx][$hmy]*5)."px; top:".$hmy."px;'>";
							echo "<img src='gfx/s/$plot' onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'>";
							echo "</div>\n";
							$plotting[$hmx][$hmy]++;
							$hmxmem=$hmx; $hmymem=$hmy;
	
							for ($hm=1; $hm<=14; $hm++) {
								if (($moves[$hmhero][$hm+2]!="") && ($moves[$hmhero][$hm+2]!=7)) {
#									echo "moving ".$moves[$hmhero][$hm+1]."<br>";
									if (1&$ymove) {
										$xmove+=$ArmyMoveXodd[$moves[$hmhero][$hm+2]];
									} else {
										$xmove+=$ArmyMoveXeven[$moves[$hmhero][$hm+2]];
									}
									$ymove+=$ArmyMoveY[$moves[$hmhero][$hm+2]];
	
									$hmx=$xmove*$mapcell;
									$hmy=$ymove*$mapcell;
									$hmy-=($mapcell/10);
									if (1&$ymove) { $hmx-=$mapcell/2;}
									$hmx-=3;$hmy-=3;
	
									for ($inte=1; $inte<=2; $inte++) {
										$hmxi=(int)(($hmxmem*$inte+$hmx*(3-$inte))/3);
										$hmyi=(int)(($hmymem*$inte+$hmy*(3-$inte))/3);
										echo "<div style='position:absolute; left:".($hmxi+$plotting[$hmxi][$hmyi]*5)."px; top:".$hmyi."px;'>";
										echo "<img src='gfx/s/$plot' onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'>";
										echo "</div>\n";
										$plotting[$hmxi][$hmyi]++;
									}
	
									$hmxmem=$hmx; $hmymem=$hmy;
	
									echo "<div style='position:absolute; left:".($hmx+$plotting[$hmx][$hmy]*5)."px; top:".$hmy."px;'>";
									echo "<img src='gfx/s/$plot' onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'>";
									echo "</div>\n";
									$plotting[$hmx][$hmy]++;
	
									$moves[$hmhero][$hm+1]="";
								}
							}
						}
					}
				}
				echo "</div>\n\n";
			}
			
			$found=true;
			if (!(1&$j)) {
				if ($i==1) {
					echo "<td width=".(int)($mapcell/2).">";
					$found=false;
				}
			}
			if (1&$j) {
				if ($i==$mapcol+1) {
					echo "<td width=".(int)($mapcell/2).">";
					$found=false;
				}
			}
			if ($found) {
				echo "<td colspan=2";
				$k=$i;
				if (!(1&$j)) {
					$k=$i-1;
				}
				echo " id='$k.$j' onclick='S(this.id)' onDblclick='DC(this.id)'";
				echo " bgcolor=".$mapcolor[$mapcontentcell[$j][$k]]."><div class=r>";
				
				if ($fileriver[$j][$k]=="") { $fileriver[$j][$k]="e.gif"; }
				echo "<img src='".$dirtiles.urlencode($fileriver[$j][$k])."' class=a>";
				if ($fileroad[$j][$k]!="") { echo "<img src='".$dirtiles.urlencode($fileroad[$j][$k])."' class=a>"; }

				if ($createtiles=="yes") {
					$found=false;
					if ((int)($mapriver[$j][$k])>0) {
						$v1="";
						$v2="";
						$mapriver[$j][$k]=trim($mapriver[$j][$k]);
						for ($td=1; $td<=6; $td++) {
							if ($mapriver[$j][$k][$td-1]=="1") {
								$v1.="1";
							} else {
								$v1.="0";
							}
							if ($mapriver[$j][$k][$td-1]=="2") {
								$v2.="1";
							} else {
								$v2.="0";
							}
						}
						if ($verbose1) echo $v1."<br>";
						$v1=bindec($v1);
						if ($verbose1) echo $v1."<br>";
						$v=$let2[$v1];
						if ($verbose1) echo $v."<br>";
	
						if ($verbose1) echo $v2."<br>";
						$v2=bindec($v2);
						if ($verbose1) echo $v2."<br>";
						$v.=$let2[$v2];
						if ($verbose1) echo $v."<br>";
						$fn=ImgCreate($v);
	
						echo "<img src='".$dirtiles.urlencode('img_$v.gif')."' class=a>";
						$found=true;
						$savefileriver.="img_$v.gif";
					}
					if (!$found) {
						echo "<img src='".$dirtiles."e.gif' class=a>";
					}
					$savefileriver.=";";
					if ((int)($maproad[$j][$k])>0) {
						$v1="";
						$v2="";
						$v3="";
						$v="--";
						$maproad[$j][$k]=trim($maproad[$j][$k]);
						for ($td=1; $td<=6; $td++) {
							if (($maproad[$j][$k][$td-1]=="1") || ($maproad[$j][$k][$td-1]=="4") || ($maproad[$j][$k][$td-1]=="5")) {
								$v1.="1";
							} else {
								$v1.="0";
							}
							if (($maproad[$j][$k][$td-1]=="2") || ($maproad[$j][$k][$td-1]=="4")) {
								$v2.="1";
							} else {
								$v2.="0";
							}
							if (($maproad[$j][$k][$td-1]=="3") || ($maproad[$j][$k][$td-1]=="5")) {
								$v3.="1";
							} else {
								$v3.="0";
							}
						}
						if ($verbose2) echo $v1."<br>";
						$v1=bindec($v1);
						if ($verbose2) echo $v1."<br>";
						$v.=$let2[$v1];
						if ($verbose2) echo $v."<br>";
	
						if ($verbose2) echo $v2."<br>";
						$v2=bindec($v2);
						if ($verbose2) echo $v2."<br>";
						$v.=$let2[$v2];
						if ($verbose2) echo $v."<br>";
	
						if ($verbose2) echo $v3."<br>";
						$v3=bindec($v3);
						if ($verbose2) echo $v3."<br>";
						$v.=$let2[$v3];
						if ($verbose2) echo $v."<br>";
						$fn=ImgCreate($v, false, 2);
	
						echo "<img src='".$dirtiles.urlencode('img_$v.gif')."' class=a>";
						$savefileroad.="img_$v.gif";
					}
					$savefileroad.=";";
				}  # to build river / road images
				
				$hex="";
				if ($k<10) { $hex.="0"; } $hex.=$k;
				if ($j<10) { $hex.="0"; } $hex.=$j;
				echo "<font size=1px>".$hex."<div id='$k.$j.c' class=c style='z-index:20'></div>";

				if ($getaccesslimited[$game_checked]) {
					if (($k>=$kstart) && ($k<=$kstart+8) && ($j>=$jstart) && ($j<=$jstart+14)) {
						$displaymap=true;
					} else {
						$displaymap=false;
					}
				}
				
				if ($displaymap) {

				if (strlen($towninhex_num[$k][$j])>0) {
					$pieces=explode(";",$towninhex_num[$k][$j]);
					for ($ip=0; $ip<=count($pieces)-1; $ip++) {
						$l=$pieces[$ip]*1;

						$jo=$town[$l]->people;
						if ($jo<10) { $p="0".$jo; } else { $p=$jo; }
						if ($jo<=10) { $pln=1; } else if ($jo<=20) { $pln=2; } else { $pln=3; }
						$pl="0".$pln;

						$town[$l]->def=0;
						# fortifications
						if ($town[$l]->fortif>1) {
							$f=$town[$l]->fortif-1;
							$town[$l]->def+=$FortifDef[$town[$l]->fortif-1];
							echo "<div style='z-index:12; position: absolute;";
							if ($town[$l]->hidden==2) {
								echo " filter:alpha(opacity=30);-moz-opacity:.30;opacity:.30;";
							}
							echo " top: ".$fortiftop."px; right: ".$fortifright."px'><img src='gfx/s/fortif".$f."_".$pl.".gif'></div>";
						}

						# capital
						if ($town[$l]->capital==1) {
							echo "<div style='z-index:13; position: absolute;";
							if ($town[$l]->hidden==2) {
								echo " filter:alpha(opacity=30);-moz-opacity:.30;opacity:.30;";
							}
							echo " top: ".$flagtop."px; right: ".$flagright."px'><img src='gfx/s/flag_".$p.".gif'></div>";
						}
						# town
						$s=$town[$l]->size;
						if ($s>0) {
							$town[$l]->def+=$TownDef[$town[$l]->size];
							$town[$l]->def*=(100+$town[$l]->loyalty)/100;
							$town[$l]->def=(int)($town[$l]->def);
							$text="<b>".$town[$l]->name."</b>";
							$text.="<br><font size=1>".$PeopleName[$town[$l]->people]."</font>";
							$text.="<br><i>".$loc[$loctag[4]+3][$lang]."=".$town[$l]->def."</i>";
							if ($town[$l]->loyalty<20) { $text.="<br><font size=1 color=red><b>".$loc[$loctag[4]+32][$lang]."&nbsp;".$town[$l]->loyalty."!</b></font>"; }
							if ($town[$l]->localprod[8]>0) {
								$text.="<br><font size=1><i>".$loc[$loctag[6]+18][$lang]."=".$town[$l]->localprod[8]."</i>";
							}
							if ($town[$l]->localprodvalue>0) {
								$text.="<br><font size=1><i>".$loc[$loctag[6]+24][$lang]."=".$town[$l]->localprodvalue."</i>";
							}
							echo "<div style='z-index:14; position: absolute;";
							if ($town[$l]->hidden==2) {
								echo " filter:alpha(opacity=30);-moz-opacity:.30;opacity:.30;";
							}
							$pf=$p;
							if ($p==26) { $pf="06"; }
							if ($p==27) { $pf="16"; }
							if ($p==28) { $pf="24"; }
							echo " top: ".$towntop."px; right: ".$townright."px'><img src='gfx/s/town".$s."_".$pf.".gif'";
							if (!$getaccesslimited[$game_checked]) {
								echo " onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'";
							}
							echo "></div>";
						}
						# harbor
						if ($town[$l]->dock>1) {
							$h=$town[$l]->dock-1;
							echo "<div style='z-index:15; position: absolute; top: ".$anchortop."px; right: ".$anchorright."px'><img src='gfx/s/anchor".$h.".gif'></div>";
						}
					}
				}
				
				if (strlen($armyinhex_num[$k][$j])>0) {
					for ($in=1; $in<=3; $in++) {
						$nbici[$in]=0;
					}
					for ($pln=1; $pln<=3; $pln++) {
						$dec_top[$pln]=($armyinhex[$k][$j][$pln]-1)*($imitemsize-3);
					}
					$dec_right_neutre=(int)(($mapcell-$imitemsize)/2);
					for ($in=1; $in<=$armyinhex[$k][$j][3]-1; $in++) {
						$dec_right_neutre+=(int)(($imitemsize-3)/2);
					}
					$pieces=explode(";",$armyinhex_num[$k][$j]);
					for ($ip=0; $ip<=count($pieces)-1; $ip++) {
						$l=$pieces[$ip]*1;
				
							$text="";
							$jo=$army[$l]->people;
							if ($jo<10) { $p="0".$jo; } else { $p=$jo; }
							if ($jo<=10) { $pln=1; } else if ($jo<=20) { $pln=2; } else { $pln=3; }
							if ($army[$l]->leadername!="") {
								$text.="<b>".$army[$l]->leadername."</b>";
								if ($army[$l]->leadercommand>30) { $text.="<br>".$loc[$loctag[4]+25][$lang]."&nbsp;".$army[$l]->leadercommand; } else
								if ($hero[$army[$l]->leader]->command>30) { $text.="<br>".$loc[$loctag[4]+25][$lang]."&nbsp;".$hero[$army[$l]->leader]->command; }
								if ($hero[$army[$l]->leader]->agent>30) { $text.="<br>".$loc[$loctag[4]+26][$lang]."&nbsp;".$hero[$army[$l]->leader]->agent; }
								if ($hero[$army[$l]->leader]->emissary>30) { $text.="<br>".$loc[$loctag[4]+27][$lang]."&nbsp;".$hero[$army[$l]->leader]->emissary; }
								if ($hero[$army[$l]->leader]->mage>30) { $text.="<br>".$loc[$loctag[4]+28][$lang]."&nbsp;".$hero[$army[$l]->leader]->mage; }
								$hea=$hero[$army[$l]->leader]->health*1;
								if (($hea<100) && ($hea>0)) { $text.="<br><i>".$loc[$loctag[4]+29][$lang]."&nbsp;".$hea; }
								if ($hero[$army[$l]->leader]->challenge>50) { $text.="<br><i>".$loc[$loctag[4]+31][$lang]."&nbsp;".$hero[$army[$l]->leader]->challenge; }
							} else {
								$text.="<b>?</b>";
							}
							
							for ($t=1; $t<=7; $t++) {
								if ($army[$l]->unitsnb[$t]!=0) { $text.="<br>".$loc[$loctag[7]+$t][$lang]."=".$army[$l]->unitsnb[$t]; } 
							}
							$needfood=0;
							for ($t=1; $t<=2; $t++) {
								$needfood+=$army[$l]->unitsnb[$t]*2;
							}
							for ($t=3; $t<=6; $t++) {
								$needfood+=$army[$l]->unitsnb[$t];
							}
							
							$text.="<br><i>".$loc[$loctag[4]+5][$lang]."=";
							if ($army[$l]->str_final!=0) {
								$text.=(int)($army[$l]->str_final)."</i>";
							} else {
								$text.="?</i>";
							}
							$text.="<br><i>".$loc[$loctag[4]+22][$lang]."=";
							if ($army[$l]->con_final!=0) {
								$text.=(int)($army[$l]->con_final)."</i>";
							} else {
								$text.="?</i>";
							}
							if (($army[$l]->food!="") && ($army[$l]->food<=$needfood)) {
								$text.="<br><i>".$loc[$loctag[4]+23][$lang]."</i>";
							}
							if ($army[$l]->intel>1) {
								$text.="<br><font size=-2 color=".$GlobalColors[$army[$l]->intel].">";
								$text.=$loc[$loctag[9]+41][$lang]." ".$loc[$loctag[9]+41+$army[$l]->intel][$lang];
							}
							if ($army[$l]->turninfo<=$turntodisplay-2) {
								$text.="<br><font size=-2 color=".$GlobalColors[3].">";
								$text.=$loc[$loctag[9]+46][$lang]." ".($turntodisplay-$army[$l]->turninfo)." ".$loc[$loctag[9]+47][$lang];
							}
							echo "<div style='z-index:16; position: absolute; ";
							if ($armyinhex[$k][$j][0]>1) {
								echo "top: ".($armytop[$pln]-$dec_top[$pln]+$nbici[$pln]*($imitemsize-3))."px; right: ".$armyright[$pln];
							} else {
								echo "top: ".$armytop[$pln]."px; right: ";
								switch ($pln) {
									case 1 : echo $armyright[$pln]-$nbici[$pln]*($imitemsize-3);
									break;
									case 2 : echo $armyright[$pln]+$nbici[$pln]*($imitemsize-3);
									break;
									case 3 : echo $dec_right_neutre-$nbici[$pln]*($imitemsize-3);
									break;
								}
							}
							echo "px;'>";

							$data[$l]=$army[$l]->people."-";
							for ($t=1; $t<=7; $t++) {
								$data[$l].=$army[$l]->unitsnb[$t]."-";
							}
							$data[$l].=$army[$l]->leadercommand."-";
							$data[$l].=$army[$l]->climate."-";
							$data[$l].=$army[$l]->terrain."-";
							$data[$l].=$army[$l]->morale."-";
							for ($t=1; $t<=6; $t++) {
								$data[$l].=$army[$l]->units_training[$t]."-";
							}
							for ($t=1; $t<=6; $t++) {
								$data[$l].=$army[$l]->units_weapons[$t]."-";
							}
							for ($t=1; $t<=6; $t++) {
								$data[$l].=$army[$l]->units_armors[$t]."-";
							}
							echo "<a onclick=\"javascript:openWindow('inc/showarmy.inc.php?data=".$data[$l]."','600','800')\" style='color:black;cursor:pointer'>";
							$pf=$p;
							if ($p==26) { $pf="06"; }
							if ($p==27) { $pf="16"; }
							if ($p==28) { $pf="24"; }
							echo "<img src='gfx/s/army_".$pf.".gif'";
							if (!$getaccesslimited[$game_checked]) {
								echo " onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'";
							}
							echo " border=0></a></div>";
							$nbici[$pln]++;
					}
				}

				if (strlen($heroinhex_num[$k][$j])>0) {
					$pieces=explode(";",$heroinhex_num[$k][$j]);
					for ($ip=0; $ip<=count($pieces)-1; $ip++) {
						$l=$pieces[$ip]*1;

						$jo=$hero[$l]->people;
						if ($jo<10) { $p="0".$jo; } else { $p=$jo; }
						if ($jo<=10) { $pln=1; } else if ($jo<=20) { $pln=2; } else if ($jo<=25) { $pln=3; }
						$text="<b>".$hero[$l]->name."</b>";
						if ($hero[$l]->command>30) { $text.="<br>".$loc[$loctag[4]+25][$lang]."&nbsp;".$hero[$l]->command; }
						if ($hero[$l]->agent>30) { $text.="<br>".$loc[$loctag[4]+26][$lang]."&nbsp;".$hero[$l]->agent; }
						if ($hero[$l]->emissary>30) { $text.="<br>".$loc[$loctag[4]+27][$lang]."&nbsp;".$hero[$l]->emissary; }
						if ($hero[$l]->mage>30) { $text.="<br>".$loc[$loctag[4]+28][$lang]."&nbsp;".$hero[$l]->mage; }
						if (($hero[$l]->health<100) && ($hero[$l]->health>0)) { $text.="<br><i>".$loc[$loctag[4]+29][$lang]."&nbsp;".$hero[$l]->health; }
						if ($hero[$l]->stealth>0) { $text.="<br><i>".$loc[$loctag[4]+30][$lang]."&nbsp;".$hero[$l]->stealth; }
						if ($hero[$l]->challenge>50) { $text.="<br><i>".$loc[$loctag[4]+31][$lang]."&nbsp;".$hero[$l]->challenge; }
						if ($hero[$l]->turninfo<=$turntodisplay-2) {
							$text.="<br><font size=-2 color=".$GlobalColors[3].">";
							$text.=$loc[$loctag[9]+46][$lang]." ".($turntodisplay-$hero[$l]->turninfo)." ".$loc[$loctag[9]+47][$lang];
						}
						if ($hero[$l]->health>0) {
							$pf=$p;
							if ($p==26) { $pf="06"; }
							if ($p==27) { $pf="16"; }
							if ($p==28) { $pf="24"; }
							echo "<div style='z-index:17; position: absolute; top: ".$herotop."px; right: ".($heroright+$ip*$imherosize)."px;'><img src='gfx/s/hero_".$pf.".gif'";
							if (!$getaccesslimited[$game_checked]) {
								echo " onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'";
							}
							echo "></div>";
						}
					}
				}

				if (strlen($artefactinhex_num[$k][$j])>0) {
					$pieces=explode(";",$artefactinhex_num[$k][$j]);
					for ($ip=0; $ip<=count($pieces)-1; $ip++) {
						$l=$pieces[$ip]*1;

						$pos=strpos($artefactname[$artefact[$l]->num][$lang], "[");
						if ($pos!=0) {	$text="<b>".substr($artefactname[$artefact[$l]->num][$lang], 0, $pos)."</b>";; }
						else { $text="<b>".$artefactname[$artefact[$l]->num][$lang]."</b>";; }
						echo "<div style='z-index:17; position: absolute; top: ".($artefacttop+2)."px; right: ".($artefactright+$ip*$imartefactsize)."px;'><img src='gfx/s/artefact.gif'";
						if (!$getaccesslimited[$game_checked]) {
							echo " onMouseOver=\"pL('".$text."')\" onMouseOut='hL()'";
						}
						echo "></div>";
					}
				}

				if (strlen($markinhex_num[$k][$j])>0) {
					$pieces=explode(";",$markinhex_num[$k][$j]);
					for ($ip=0; $ip<=count($pieces)-1; $ip++) {
						$l=$pieces[$ip]*1;

						if ($mark[$l]->num<=6) { $marknum=1; $marknum2=1; $markorient=$mark[$l]->num; } else { $marknum=$mark[$l]->num-6+1; $marknum2=2; $markorient=$mark[$l]->num-6; }
						if ($mark[$l]->num==13) { $marknum=8; $showtop=(int)($mapcell/2)-9+1; $showright=$showtop;  }
						switch ($markorient) {
							case "1" : $showtop=(int)($mapcell/2)-9+1; $showright=0-9; break;
							case "2" : $showtop=$mapcell-9+1; $showright=(int)($mapcell/4)-5; break;
							case "3" : $showtop=$mapcell-9+1; $showright=$mapcell-(int)($mapcell/4)-5; break;
							case "4" : $showtop=(int)($mapcell/2)-9+1; $showright=$mapcell+9; break;
							case "5" : $showtop=0-9+1; $showright=$mapcell-(int)($mapcell/4)-5; break;
							case "6" : $showtop=0-9+1; $showright=(int)($mapcell/4)-5; break;
						}
						echo "<div style='z-index:9; position: absolute; top: ".$showtop."px; right: ".$showright."px;'><img src='gfx/s/mark_$marknum.gif'";
						echo "></div>";
					}
				}
			}
			}
			echo "</div>";
			echo "</td>\n";
		}
		echo "</tr>\n";
	}
	echo "</table\n";
/*
	$fnsave="fileriver.csv";
	$fnsave = $basedir.$metoobasedir.'data/'.$fnsave;
	$fp = fopen ($fnsave, "w");
	fwrite($fp, $savefileriver);
	fclose($fp);
	
	$fnsave="fileroad.csv";
	$fnsave = $basedir.$metoobasedir.'data/'.$fnsave;
	$fp = fopen ($fnsave, "w");
	fwrite($fp, $savefileroad);
	fclose($fp);
*/ # to build river / road images	
?>
<br><br><br><br>
</body>
</html>