			function makeMapArray()
			{
				var gridSizeX = xmlVal( data, "gridSizeX" );
				gridX = (gridSizeX * 2) + 1;
				var gridSizeY = xmlVal( data, "gridSizeY" );
				gridY = (gridSizeY * 2) + 1;

				mapData = new Array();

				mapData['gridSizeX'] = gridSizeX;
				mapData['gridSizeY'] = gridSizeY;
				mapData['gridId'] = xmlVal( data, "gridId" );
				mapData['gridName'] = xmlVal( data, "gridName" );
				mapData['env_id'] = xmlVal( data, "gridEnv" );

				var mapsize = gridX * gridY
				mapData['tiles'] = new Array( mapsize );
				var t = 0;
				for( var ty = gridSizeY; ty >= -gridSizeY; ty-- )
				{
					for( var tx = -gridSizeX; tx <= gridSizeX; tx++ )
					{
						mapData['tiles'][t] = new Array();
						mapData['tiles'][t]['x'] = tx;
						mapData['tiles'][t]['y'] = ty;
						mapData['tiles'][t]['sqno'] = t + 1;
						mapData['tiles'][t]['div2'] = null;
						mapData['tiles'][t]['timestamp'] = null;
						mapData['tiles'][t]['tileId'] = null;
						mapData['tiles'][t]['tile_type'] = null;
						mapData['tiles'][t]['terrain'] = null;
						mapData['tiles'][t]['child'] = null;
						mapData['tiles'][t]['structure'] = null;
						mapData['tiles'][t]['structure_id'] = null;
						mapData['tiles'][t]['structure_type'] = null;
						mapData['tiles'][t]['structure_name'] = null;
						mapData['tiles'][t]['border'] = null;
						mapData['tiles'][t]['surface_resource'] = new Array();
							mapData['tiles'][t]['surface_resource']['quantity'] = null;
							mapData['tiles'][t]['surface_resource']['res_type'] = null;
						mapData['tiles'][t]['owner'] = null;
						mapData['tiles'][t]['dirty'] = null;
						mapData['tiles'][t]['set'] = null;
						mapData['tiles'][t]['onclicks'] = new Array();

						t++;
					}
				}
			}
			
			function makeMapDiv()
			{
				var div = document.createElement( "div" );
				div.id = "mapDiv";
				div.style.position = "absolute";

				var table = document.createElement( "table" );
				table.setAttribute( "border", 0);
				table.setAttribute( "cellPadding", 0);
				table.setAttribute( "cellSpacing", 1);
				table.setAttribute( "bgColor", "black" );
				table.setAttribute( "vAlign", "top" );

				var tbody = document.createElement( "tbody" );
				var y = null;
				var z = 0;
				for( var t = 0, tile; tile = mapData['tiles'][t]; t++ )
				{
					if( tile['y'] != y )
					{
						if( z != 0 )
							tbody.appendChild( row );

						var row = document.createElement( "tr" );
					}
					var cell = document.createElement( "td" );
					cell.id = "tile_"+tile['sqno'];

					//temp values
					cell.className = "map_cell_div standard_text";
					//cell.style.backgroundImage = "url('./img/exterior/terrain/17.gif')";

					var div1 = document.createElement( "div" );
					div1.className = "map_cell_div";
					div1.id = "tile_"+tile['sqno']+"-div1";

					var div2 = document.createElement( "div" );
					div2.className = "map_cell_div";
					div2.id = "tile_"+tile['sqno']+"-div2";

					var div3 = document.createElement( "div" );
					div3.className = "map_cell_div";
					div3.id = "tile_"+tile['sqno']+"-div3";

					div2.appendChild( div3 );
					div1.appendChild( div2 );

					cell.appendChild( div1 );

					row.appendChild( cell );
					z = 1;
					y = tile['y'];
				}
				tbody.appendChild( row );

				table.appendChild( tbody );
				div.appendChild( table );

				return div;
			}
			function updateMapArray( mode )
			{
				var tiles = xmlList( grid, "grid_tile" );

				for( var i = 0, tile; tile = tiles[i]; i++ )
				{
					var sqno = xmlVal( tile, "tileNo" );
					var timestamp = xmlVal( tile, "timestamp" );
					var force_refresh = xmlVal( tile, "force_refresh" );

					var t_pos = parseInt(sqno) - 1;
					var owner = null;
					if( toggleOwner )
						owner = xmlVal( tile, "owner" );

					if( force_refresh || !mapData['tiles'][t_pos]['set'] || timestamp > mapData['tiles'][t_pos]['timestamp'] || ( owner ) || mode == "scan" ) 
					{
						mapData['tiles'][t_pos]['timestamp'] = timestamp;

						mapData['tiles'][t_pos]['tileId'] = xmlVal( tile, "tileId" );
						mapData['tiles'][t_pos]['tile_type'] = xmlVal( tile, "tile_type" );
						mapData['tiles'][t_pos]['terrain'] = xmlVal( tile, "tile_terrain" );
						mapData['tiles'][t_pos]['child'] = xmlVal( tile, "child" );
						mapData['tiles'][t_pos]['structure'] = xmlVal( tile, "structure" );
						mapData['tiles'][t_pos]['structure_id'] = xmlVal( tile, "structure_id" );
						mapData['tiles'][t_pos]['structure_name'] = xmlVal( tile, "structure_name" );
						mapData['tiles'][t_pos]['structure_type'] = xmlVal( tile, "structure_type" );
						mapData['tiles'][t_pos]['border'] = xmlVal( tile, "border" );

						var sur_res = xmlVal( tile, "surface_resource" );
					
						mapData['tiles'][t_pos]['surface_resource']['quantity'] = xmlVal( sur_res, "quantity" );
						mapData['tiles'][t_pos]['surface_resource']['res_type'] = xmlVal( sur_res, "res_type" );

						mapData['tiles'][t_pos]['scan_value'] = xmlVal( tile, "scan_value" );
						mapData['tiles'][t_pos]['scan_type'] = xmlVal( tile, "scan_type" );

						mapData['tiles'][t_pos]['owner'] = owner;
						mapData['tiles'][t_pos]['dirty'] = true;
						mapData['tiles'][t_pos]['set'] = true;
					}
				}

				x1 = xmlVal( tiles[0], "tileX" );
				y1 = xmlVal( tiles[0], "tileY" );

				var len = tiles.length - 1;

				x2 = xmlVal( tiles[len], "tileX" );
				y2 = xmlVal( tiles[len], "tileY" );
			}
			function updateMapDiv( mode )
			{
				for( var t = 0; t < mapData['tiles'].length; t++ )
				{
					var fDivText = null;
					if( mapData['tiles'][t]['dirty'] )
					{
						mapData['tiles'][t]['onclicks'] = new Array();
						mapData['tiles'][t]['dirty'] = false;

						var cell = document.getElementById( "tile_"+mapData['tiles'][t]['sqno'] );

						if( mapData['tiles'][t]['terrain'] )
							cell.style.backgroundImage = "url('./img/"+envs[mapData['env_id']]+"/terrain/"+mapData['tiles'][t]['terrain']+".gif' )";
						else
							cell.style.backgroundImage = "url('./img/"+envs[mapData['env_id']]+"/terrain/0.gif' )";

						var div2 = document.getElementById( "tile_"+mapData['tiles'][t]['sqno']+"-div2" );

					//div1


					//div2
						if( mapData['tiles'][t]['tile_type'] > 0 )
						{
							div2.style.backgroundImage = "url('./img/"+envs[mapData['env_id']]+"/"+mapData['tiles'][t]['tile_type']+".gif' )";
							mapData['tiles'][t]['div2'] = true;
						}
						else if( mapData['tiles'][t]['structure'] > 0 )
						{
							div2.style.backgroundImage = "url('./img/"+mapData['tiles'][t]['structure_type']+""+mapData['tiles'][t]['structure']+".gif' )";

							if( mapData['tiles'][t]['onclicks'].length == 0 )
								click_tiles.push( t );
							mapData['tiles'][t]['onclicks'].push( new Array( "defaultAJAX( 'profileData', new Array( '"+mapData['tiles'][t]['structure_id']+"'), new Array( 's' ), 'Profile: structure' );", mapData['tiles'][t]['structure_type']+mapData['tiles'][t]['structure']+".gif", "Tower" ) );
							fDivText = mapData['tiles'][t]['structure_name'];
							mapData['tiles'][t]['div2'] = true;
						}
						else if( mapData['tiles'][t]['surface_resource']['quantity'] > 0 )
						{
							div2.style.backgroundImage = "url('./img/sur"+mapData['tiles'][t]['surface_resource']['res_type']+".gif' )";
							fDivText = mapData['tiles'][t]['surface_resource']['res_type']+": "+mapData['tiles'][t]['surface_resource']['quantity'];
							mapData['tiles'][t]['div2'] = true;
						}
						else if( mapData['tiles'][t]['child'] > 0 )
						{
							div2.style.backgroundImage = "url('./img/grid_entrance.gif' )";
							mapData['tiles'][t]['div2'] = true;
						}
						else if( mapData['tiles'][t]['border'] > 0 )
						{
							div2.style.backgroundImage = "url('./img/border"+mapData['tiles'][t]['border']+".gif' )";
							mapData['tiles'][t]['div2'] = true;
						}
						else
						{
							div2.style.backgroundImage = '';
							mapData['tiles'][t]['div2'] = false;
						}


						if( fDivText )
						{
							div2.onmouseover = new Function( "grabMouseCoords"+( agent != "firefox" ? '()' : '' )+"; return displayFloatDiv( '"+fDivText+"' );");
							div2.onmouseout = new Function( "return killFloatDiv();" );

							if( div2.captureEvents )
								div2.captureEvents( Event.mousemove );
	
						}
					}

					if( toggleOwner )
					{
						var div1 = document.getElementById( "tile_"+mapData['tiles'][t]['sqno']+"-div1" );
						if( div1 )
						{
							if( mapData['tiles'][t]['owner'] )
							{
								if( mapData['tiles'][t]['owner'] == -1 )
									div1.style.backgroundImage = "url('./img/contest.gif')";
								else
									div1.style.backgroundImage = "url('./img/owner"+mapData['tiles'][t]['owner']+".gif')";

								mapData['tiles'][t]['div1'] = true;
							}
							else
							{
								div1.style.backgroundImage = '';
								mapData['tiles'][t]['div1'] = false;
							}
						}
					}

					else
					{
						if( mapData['tiles'][t]['div1'] )
						{
							var div1 = document.getElementById( "tile_"+mapData['tiles'][t]['sqno']+"-div1" );
							if( div1 )
							{
								div1.style.backgroundImage = '';
								div1.style.backgroundColor = '';
								mapData['tiles'][t]['div1'] = null;
								div1.style.filter = "alpha(opacity=100)";
								div1.style.opacity = "1";
							}
						}
					}
					if( mode == "scan" )
					{
						var div3 = document.getElementById( "tile_"+mapData['tiles'][t]['sqno']+"-div3" );
						if( div3 )
						{
							if( mapData['tiles'][t]['scan_value'] > 0 )
							{
								div3.style.backgroundImage = "url('./img/res"+mapData['tiles'][t]['scan_type']+".gif')";
								div3.style.filter = "alpha(opacity="+(mapData['tiles'][t]['scan_value'] * 100 )+")";
								div3.style.opacity = mapData['tiles'][t]['scan_value'];
								mapData['tiles'][t]['div3'] = true;
							}
							else if( mapData['tiles'][t]['scan_value'] == -1 )
							{
								div3.style.backgroundColor = 'black';
								div3.style.filter = "alpha(opacity=50)";
								div3.style.opacity = "0.5";
								mapData['tiles'][t]['div3'] = true;
							}
							else
							{
								div3.style.backgroundImage = '';
								div3.style.backgroundColor = '';
								div3.style.filter = "alpha(opacity=100)";
								div3.style.opacity = "1";
								mapData['tiles'][t]['div3'] = false;
							}
						}
					}
					else
					{
						if( mapData['tiles'][t]['div3'] )
						{
							var div3 = document.getElementById( "tile_"+mapData['tiles'][t]['sqno']+"-div3" );
							if( div3 )
							{
								div3.style.backgroundImage = '';
								div3.style.backgroundColor = '';
								mapData['tiles'][t]['div3'] = null;
								div3.style.filter = "alpha(opacity=100)";
								div3.style.opacity = "1";
							}
						}
					}
				}

				killFloatDiv();


			}
			function updatePlayerData()
			{
				if( playerArray == null )
					playerArray = new Array();

				playerArray['tileId'] = xmlVal( playerData, "pTileId" );
				playerArray['tileX'] = xmlVal( playerData, "pTileX" );
				playerArray['tileY'] = xmlVal( playerData, "pTileY" );
				playerArray['tileNo'] = xmlVal( playerData, "pTileNo" );
				playerArray['name'] = xmlVal( playerData, "name" );

				var t_index = playerArray['tileNo'] - 1;
				if( t_index >= 0 )
					mapData['tiles'][t_index]['dirty'] = true;

				playerArray['tileCharge'] = xmlVal( playerData, "pTileCharge" );
				playerArray['turns'] = xmlVal( playerData, "turns" );

			}
			function updateMapPlayer()
			{
				var id = playerArray['tileNo'] - 1;

				var div3 = document.getElementById( "tile_"+mapData['tiles'][id]['sqno']+"-div3" );
				if( div3 )
				{
					div3.style.backgroundImage = "url('./img/player.gif' )";
					div3.style.filter = "alpha(opacity=100)";
					div3.style.opacity = "1";
					mapData['tiles'][id]['dirty'] = true;
					mapData['tiles'][id]['div3'] = true;
				}
			}
			function yAxis( var1, var2 )
			{
				var div = document.getElementById("yAxisDiv");

				if( !div )
				{
					var div = document.createElement( "div" );
					div.id = "yAxisDiv";
					var ret_div = true;
				}

				clearElement( div );
				var table = document.createElement( "table" );
				table.setAttribute( "border", 0);

				//table.style.width = 20;
				table.setAttribute( "cellPadding", 0);
				table.setAttribute( "cellSpacing", 1);
				table.setAttribute( "bgColor", "black" );

				var tbody = document.createElement( "tbody" );

				if( !var1 && !var2 )
				{
					var1 = 11;
					var2 = 1;
				}
				var y = var1;
				while( y != parseInt(var2) - 1 )
				{
					var row = document.createElement( "tr" );
					//row.style.width = 20;

					var cell = document.createElement( "td" );

					cell.style.width = 20;
					cell.style.height = 20;
					cell.setAttribute( "bgColor", "white");
					cell.setAttribute( "align", "center");
					cell.setAttribute( "vAlign", "middle");
					cell.style.fontSize = "9px";
					var div2 = document.createElement("div");
					div2.appendChild( document.createTextNode( y ) );
					div2.className = "map_cell_div";
					cell.appendChild( div2 ) ;
					row.appendChild( cell );

					tbody.appendChild( row );
					y--;
				}

				table.appendChild( tbody );
				div.appendChild( table );

				if( ret_div )
					return div;
			}
			function xAxis( var1, var2 )
			{
				var div = document.getElementById("xAxisDiv");

				if( !div )
				{
					var div = document.createElement( "div" );
					div.id = "xAxisDiv";
					var ret_div = true;
				}

				clearElement( div );

				var table = document.createElement( "table" );
				table.setAttribute( "border", 0);
				table.setAttribute( "cellPadding", 0);
				table.setAttribute( "cellSpacing", 1);
				table.setAttribute( "bgColor", "black" );

				var tbody = document.createElement( "tbody" );

				var row = document.createElement( "tr" );

				if( !var1 && !var2 )
				{
					var1 = 1;
					var2 = 11;
				}
				var x = var1;
				while( x != parseInt(var2) + 1 )
				{
					var cell = document.createElement( "td" );

					cell.style.width = 20;
					cell.style.height = 20;
					cell.setAttribute( "bgColor", "white");
					cell.setAttribute( "align", "center");
					cell.setAttribute( "vAlign", "middle");
					cell.style.fontSize = "9px";
					var div2 = document.createElement("div");
					div2.appendChild( document.createTextNode( x ) );
					div2.className = "map_cell_div";
					cell.appendChild( div2 ) ;
					row.appendChild( cell );
					x++;
				}
				tbody.appendChild( row );

				table.appendChild( tbody );
				div.appendChild( table );

				if( ret_div )
					return div;
			}
			function updateView( cellsize, display, display_y )
			{
				var tile = xmlVal( data, "grid_tile" );
				var tileX = xmlVal( tile, "tileX" );
				var tileY = xmlVal( tile, "tileY" );

				var offX = tileX - ( -mapData['gridSizeX'] );
				var offY = mapData['gridSizeY'] - tileY;

				mapDiv.style.left = -( (cellsize + 1) * offX);
				mapDiv.style.top = -( (cellsize + 1) * offY);

				var playerDiv = document.getElementById("tile_"+playerArray['tileNo'] );

				var hX = playerDiv.offsetLeft - ( (cellsize + 1) * offX) - 64;
				var hY = playerDiv.offsetTop - ( (cellsize + 1) * offY) - 64;

				var masterDiv = document.getElementById("hMoveGrid");
				masterDiv.style.left = hX;
				masterDiv.style.top = hY;
			}

			function updateOtherPlayers()
			{
				var player_list = xmlList( data, "list_player" );

				for( var p = 0, o_player; o_player = player_list[p]; p++ )
				{
					var sqno = xmlVal( o_player, "player_sqno");
					var t_index = sqno - 1;

					if( ! mapData['tiles'][t_index]['div3'] )
					{
						var div	= document.getElementById( "tile_"+sqno+"-div3");
						var fDivText = xmlVal( o_player, "player_name" );

						div.style.backgroundImage = "url('./img/player"+xmlVal( o_player, "player_relation" )+".gif')";

						if( mapData['tiles'][t_index]['onclicks'].length == 0 )
							click_tiles.push( t_index );
						mapData['tiles'][t_index]['onclicks'].push( new Array( "defaultAJAX( 'profileData', new Array( '"+xmlVal( o_player, "player_id" )+"' ), new Array( 'p' ), 'Profile: Player' );", "player"+xmlVal( o_player, "player_relation")+".gif", fDivText ) );

						div.onmouseover = new Function( "grabMouseCoords"+( agent != "firefox" ? '()' : '' )+"; return displayFloatDiv( '"+fDivText+"' );");
						div.onmouseout = new Function( "return killFloatDiv();" );

						if( xmlVal( o_player, "player_active" ) == 2 )
						{
							div.style.filter = "alpha(opacity=80)";
							div.style.opacity = ".8";
						}
						else if( xmlVal( o_player, "player_active" ) == 3 )
						{
							div.style.filter = "alpha(opacity=50)";
							div.style.opacity = ".5";
						}
						else
						{
							div.style.filter = "alpha(opacity=100)";
							div.style.opacity = "1";
						}
						mapData['tiles'][t_index]['dirty'] = true;
					}
				}
			}
			function updateMapClicks()
			{
				for( var t = 0, tile; tile = click_tiles[t]; t++ )
				{
					var div = document.getElementById( "tile_"+mapData['tiles'][tile]['sqno']+"-div3");
					if( mapData['tiles'][tile]['onclicks'].length > 1 )
					{
						div.onclick = new Function( "return clickList( "+tile+" );" );
					}
					else
						div.onclick = new Function( "return "+mapData['tiles'][tile]['onclicks'][0][0] );

					div.className = "map_cell_div link";
				}
			}
			function clickList( tile )
			{
				var div = document.getElementById( "tile_"+mapData['tiles'][tile]['sqno']+"-div3");
				div.onmouseout = null;
				var div = document.getElementById( "tile_"+mapData['tiles'][tile]['sqno']+"-div2");
				div.onmouseout = null;
				var array = mapData['tiles'][tile]['onclicks'];
				var table = document.createElement( "table" );
				table.cellPadding = 0;
				table.cellSpacing = 0;
				var tbody = document.createElement( "tbody" );

				for( var r = 0, row; row = array[r]; r++ )
				{
					if( r == 0 )
					{
						var cell = oneCellRow( makeImg( "./img/x_close.gif", 9, 9, null, null, "killFloatDiv();", "link" ), null, 2, null );
						cell.style.textAlign = "right";
						tbody.appendChild( cell );
					}
					tbody.appendChild( twoCellRow( oneCell( makeImg( "./img/"+row[1] ) ), oneCell( row[2], row[0], null, "standard_text link" ), null, null, true ) );
				}
	
				table.appendChild( tbody );
				table.onmouseover = new Function( "grabMouseCoords"+( agent != "firefox" ? '()' : '' )+"; return setKillFloatDiv( this, "+tile+" );" );		

				displayFloatDiv( table );
			}
			function setKillFloatDiv( element, tile )
			{
				if( floatFocus )
				{
					//element.onmouseout = new Function( "return killFloatDiv();" );

					var div = document.getElementById( "tile_"+mapData['tiles'][tile]['sqno']+"-div3");
					div.onmouseout = new Function( "return killFloatDiv();" );
					var div = document.getElementById( "tile_"+mapData['tiles'][tile]['sqno']+"-div2");
					div.onmouseout = new Function( "return killFloatDiv();" );
				}

				floatFocus = true;

			}
			function makeHMoveGrid()
			{
				var div = document.createElement("div");
				div.style.position = "absolute";
				div.id = "hMoveGrid";

				if( div.captureEvents )
					div.captureEvents( Event.mousemove );

				var table = document.createElement("table");
				var tbody = document.createElement("tbody");
				table.cellSpacing = 1;
				table.cellPadding = 0;
				table.border = 0;
				for( var y = maxDist; y >= -maxDist; y-- )
				{
					var row = document.createElement("tr");

					for( var x = -maxDist; x <= maxDist; x++ )
					{
						var cell = document.createElement("td");
						var cell_div = document.createElement("div");
						var dir = null;
						if( y > 0 )
						{
							var dist = Math.abs( x );

							if( x < 0 && Math.abs(x) == Math.abs(y) )
								dir = 'NW';
							else if( x == 0 )
							{
								dir = 'N';
								var dist = Math.abs( y );
							}
							else if( x > 0 && Math.abs(x) == Math.abs(y) )
								dir = 'NE';
						}
						else if( y < 0 )
						{
							var dist = Math.abs( x );

							if( x < 0 && Math.abs(x) == Math.abs(y) )
								dir = 'SW';
							else if( x == 0 )
							{
								dir = 'S';
								var dist = Math.abs( y );
							}
							else if( x > 0 && Math.abs(x) == Math.abs(y) )
								dir = 'SE';
						}
						else if( y == 0 )
						{
							var dist = Math.abs( x );

							if( x < 0 )
								dir = 'W';
							if( x > 0 )
								dir = 'E';
						}
						if( dir )
						{
							cell_div.id = "h"+dir+dist;
						}
						else if( x == 0 && y == 0 )
						{
							cell_div.onmouseover = new Function( "return hTestOn( this, 'A', null );" );
							cell_div.onmouseout = new Function( "return hTestOff( this, 'A', null );" );
						}
						else
						{
							cell_div.style.visibility = "hidden";
							cell.style.visibility = "hidden";
						}
						cell_div.style.width = 20;
						cell_div.style.height = 20;
						cell_div.style.backgroundRepeat = "no-repeat";
						cell_div.style.backgroundPosition = "center center";
						cell.appendChild( cell_div );

						row.appendChild( cell );
					}
					
					tbody.appendChild( row );
				}
				table.appendChild( tbody );
				div.appendChild( table );

				if( !hMoveVis )
					div.style.visibility = "hidden";
				return div;
			}
			function updateHMove()
			{
				if( hMoveVis )
				{
					dirs_ar = new Array("N", "W", "E", "S", "NW", "NE", "SW", "SE");

					for( var d = 0, dir; dir = dirs_ar[d]; d++ )
					{
						var dist = actions[dir];

						for( var di = 1; di <= 3; di++ )
						{
							var div = document.getElementById("h"+dir+di);
							if( div )
							{
								if( dist == 'C' && di == 1 )
								{
									div.onmouseover = new Function( "return hTestOn( this, '"+dir+"', '1' );" );
									div.onmouseout = new Function( "return hTestOff( this, '"+dir+"', '1' );" );
									div.className = "link";
								}
								else if( parseInt(dist) > 0 && di <= parseInt(dist) )
								{
									div.onmouseover = new Function( "return hTestOn( this, '"+dir+"', "+di+" );" );
									div.onmouseout = new Function( "return hTestOff( this, '"+dir+"', "+di+" );" );
									div.className = "link";
								}
								else
								{
									div.onmouseover = null;
									div.onmouseout = null;
									div.className = null;
									hTestOff( div, dir, di );
								}
							}	
						}
					}
				}
			}
			function hMoveToggle()
			{
				var buttonDiv = document.getElementById("hMoveToggleImg");
				var div = document.getElementById("hMoveGrid");
				if( hMoveVis )
				{
					hMoveVis = false;
					var img = "./img/hMove0.gif";
					var vis = "hidden";
				}
				else
				{
					hMoveVis = true;
					var img = "./img/hMove1.gif";
					var vis = "visible";
				}

				buttonDiv.style.backgroundImage = "url('"+img+"')";
				div.style.visibility = vis;
				updateHMove();
			}
			function tileOwnerToggle()
			{
				var buttonDiv = document.getElementById("tileOwnerToggleImg");

				if( toggleOwner )
				{
					toggleOwner = null;
					var img = "./img/tileOwner0.gif";
				}
				else
				{
					toggleOwner = true;
					var img = "./img/tileOwner1.gif";
				}
				buttonDiv.style.backgroundImage = "url('"+img+"')";
				refreshData();

			}
			function updateMap()
			{
				views['view1'] = 'game_main';
				var cellsize = 20;

				middle_pane.vAlign = "middle";

				var grid_body = document.getElementById("grid_body");
				grid_body.onmouseover = grabMouseCoords;
				if( grid_body.captureEvents )
					grid_body.captureEvents( Event.mouseover );

				var hDiv = document.getElementById("hMoveGrid");

				disCountX = ( parseInt( xmlVal( data, "displaySizeX" ) ) * 2 ) + 1;				
				disCountY = ( parseInt( xmlVal( data, "displaySizeY" ) ) * 2 ) + 1;

				var clipSizeX = (cellsize * disCountX ) + disCountX + 1;
				var clipSizeY = (cellsize * disCountY ) + disCountY + 1;

				var offsetX = 1;
				var offsetY = 1;
				click_tiles = new Array();

				var status = xmlVal( data, "status_text" );

				if( status )
				{
					if( status.substring( 0, 16 ) == "You have entered" )
					{
						mapData = null;
						var div = document.getElementById("containerDiv");
						if( div )
							clearElement( div );

						var cell = document.getElementById("mapCell");
						if( cell )
							clearElement( cell );

						displayFloatDiv( "Loading new map...", true );
					}
				}
				if( ! mapData )
				{
					clearGrid = true;
					makeMapArray();
					mapDiv = makeMapDiv();

					//clearElement( grid_body );

					var div = document.createElement( "div" );
					div.style.position = "absolute";
					div.id = "mapHolderDiv";

					div.style.width = clipSizeX;
					div.style.height = clipSizeY;

					div.style.maxWidth = clipSizeX;
					div.style.maxHeight = clipSizeY;

					div.style.clip = "rect(0, "+clipSizeX+", "+clipSizeY+", 0)";

					//mapDiv.style.overflow = "hidden";

					div.appendChild( mapDiv );
					div.appendChild( makeHMoveGrid() );

					navRecord = false;
					defaultAJAX( 'getChatter', new Array(), new Array( 'g' ), null, new Array( new Array( 'chatter_box', 'global' ) ) );
					navRecord = true;
				}
				else
					var div = document.getElementById("mapHolderDiv");

				if( clearGrid )
				{
					clearElement( grid_body );
					clearGrid = false;

					var cell = document.createElement( "td" );

					cell.style.width = 20;
					cell.style.height = 20;
					cell.setAttribute( "bgColor", "white");
					cell.style.fontSize = "9px";
					cell.appendChild( document.createTextNode( " " ) );	
					cell.setAttribute( "cellpadding", 0);
					cell.setAttribute( "cellspacing", 0);	
					cell.style.borderColor = "black";
					cell.style.borderWidth = "1px";
					cell.id = "navBack";

					var cell1 = oneCell( yAxis( disCount, 1 ) );
					cell1.id = "yAxisCell";
					cell1.setAttribute( "bgColor", "white");
					//cell1.setAttribute( "vAlign", "top");
					cell1.setAttribute( "align", "center");
					cell1.setAttribute( "cellpadding", 0);
					cell1.setAttribute( "cellspacing", 0);
					cell1.style.width = 20;

					var cell2 = oneCell( div );

					cell2.id = "mapCell";
					cell2.setAttribute( "bgColor", "white");
					cell2.setAttribute( "vAlign", "top");
					cell2.setAttribute( "cellpadding", 0);
					cell2.setAttribute( "cellspacing", 0);

					var map_body = document.createElement( "tbody" );
					map_body.appendChild( twoCellRow( cell1, cell2, null, "table_style", true ) );
					map_body.appendChild( twoCellRow( cell, xAxis( 1, disCount ) ) );
					var map_table = document.createElement( "table" );
					map_table.appendChild( map_body );

					//make side panel...
					var sidebar_table = document.createElement( "table" );
					sidebar_table.appendChild( makeMapSidebar() );

					grid_body.appendChild( twoCellRow( map_table, sidebar_table, 'solid', 'solid_100' ) );
				}
			}
			function hTestOn( element, dir, dist )
			{
				if( dir == 'A' )
					var dirs = new Array( 'N', 'S', 'W', 'E', 'NW', 'NE', 'SW', 'SE' );
				else
					var dirs = new Array( dir );

				for( var d = 0, di; di = dirs[d]; d++ )
				{
					if( actions[di] == 'C' )
					{
						var temp_element = document.getElementById( "h"+di+"1" );
						if( temp_element )
						{
							temp_element.style.backgroundImage = "url('./img/chop.gif')";
								if( dist == 1 )
								{
									temp_element.style.filter = "alpha(opacity=90)";
									temp_element.style.opacity = ".9";
								}
								else
								{
									temp_element.style.filter = "alpha(opacity=50)";
									temp_element.style.opacity = ".5";
								}
							temp_element.onclick = new Function( "return defaultAJAX( 'actionChop', null, new Array( '"+di+"' ), null );");
						}
					}
					else if( actions[di] > 0 )
					{
						for( var i = 1; i <= actions[di]; i++ )
						{
							var temp_element = document.getElementById( "h"+di+i );
							if( temp_element )
							{
								temp_element.onclick = new Function( "return defaultAJAX( 'actionMove', new Array( '"+i+"' ), new Array('"+di+"'), null );");
								temp_element.style.backgroundImage = "url('./img/move_"+di+"1.gif')";
								if( i <= dist )
								{
									temp_element.style.filter = "alpha(opacity=90)";
									temp_element.style.opacity = ".9";
								}
								else
								{
									temp_element.style.filter = "alpha(opacity=50)";
									temp_element.style.opacity = ".5";
								}
							}
						}
					}
				}
			}
			function hTestOff( element, dir, dist )
			{
				if( dir == 'A' )
					var dirs = new Array( 'N', 'S', 'W', 'E', 'NW', 'NE', 'SW', 'SE' );
				else
					var dirs = new Array( dir );

				for( var d = 0, di; di = dirs[d]; d++ )
				{
					for( var i = 1; i <= maxDist; i++ )
					{
						var temp_element = document.getElementById( "h"+di+i );
						if( temp_element )
						{
							temp_element.onclick = null;
							temp_element.style.backgroundImage = ''
							temp_element.style.backgroundColor = '';
							temp_element.style.filter = null;
							//temp_element.style.opacity = null;
						}
					}
				}
			}
