    //<![CDATA[
function search() {
	map.clearOverlays();
	document.theForm.slideshow.checked = false;
	var filter = document.theForm.filter.value;
	var proceed = filter != '';
	if (!proceed) {
		proceed = confirm ("Searching for all users can be time- and CPU-consuming.\n\nIf you proceed, understand that it may take some time for anything to appear on the map.\n\nThis message is only displayed when you include no filter.");
	}
	if (proceed) {
		if (firstSearch) {
			alert("The map will now load location data for the matching users.\nDepending on the number of users found, this might take a moment.\nPlease be patient.\n\nThis message will not be shown again.");
			firstSearch = 0;
		}
	cursor_wait();
	setTimeout("refreshMap();",500);
	}
}
        
function showTGservers() {
	map.addOverlay(serversMarker);
	serversMarker.openInfoWindowHtml("<div align='left'><b>DALLAS, TX:</b><br>Tactical Gamer servers</div>");
}

function hideTGservers() {
	serversMarker.openInfoWindowHtml("<div align='left'>Server location hidden.<br><br>This window will disappear<br>when you click another location.</div>");
	map.removeOverlay(serversMarker)
}
    
function refreshMap() {
	permanentStatus();
	if (markerLength > 0) {
		var filter = document.theForm.filter.value;
		//Fix found at http://groups.google.com/group/Google-Maps-API/browse_thread/thread/efe6fa8a28307cbd/42ff2c27f3541f20?q=IE+cache+XML&rnum=2#42ff2c27f3541f20
		filterUpper = filter.toUpperCase();
		var start = 0;
		var end = markers.length;
		if (document.theForm.slideshow.checked) {
			start = Math.floor(Math.random()*end)
			end = start + 1;
		}
		var lastAdded;
		var lastCaptionText;
		var matched = 0;
		for (var i = start; i < end; i++) {
			var captionText = new String(markers[i].getAttribute("caption"));
			if (captionText.toUpperCase().indexOf(filterUpper)>=0 || document.theForm.slideshow.checked) {
				markerArray[i] = createMarker(new GPoint(parseFloat(markers[i].getAttribute("lng")),parseFloat(markers[i].getAttribute("lat"))), captionText, i);
				map.addOverlay(markerArray[i]);
				lastAdded = markerArray[i];
				lastCaptionText = captionText;
				matched++;
			}
		}
		if (document.theForm.slideshow.checked || matched == 1) {
			lastAdded.openInfoWindowHtml("<div align='left'>"+lastCaptionText+"</div>");
		}
		if (!document.theForm.slideshow.checked) {
			filterFocus();
		}
	}
	else {
		setTimeout("refreshMap();", 100);
	}
	cursor_clear();
}

function nextSlide() {
	setTimeout("nextSlide();", getCheckedValue(document.theForm.speed));
        if (document.theForm.slideshow.checked) {
		refreshMap();
	}
}

function createMarker(point, caption, index) {
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml("<div align='left'>"+caption+"</div>");document.theForm.slideshow.checked=false;});
	return marker;
}

function resetMapPosition() {
	map.centerAndZoom(new GPoint(-98.96484375, 40.17887331434696), 13);
}

function mapInit() {
	////var captionToUse = '';
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.addControl(new GScaleControl());
	resetMapPosition();
}

function iconInit() {
	icon.image = "tgmarker.png";
	icon.iconSize = new GSize(25, 31);
	icon.iconAnchor = new GPoint(15, 20);
	icon.infoWindowAnchor = new GPoint(15, 15);
}

function serverIconInit() {
	servericon.image = "tower02.png";
	servericon.iconSize = new GSize(21, 31);
	servericon.iconAnchor = new GPoint(15, 20);
	servericon.infoWindowAnchor = new GPoint(15, 15);
}

var request = GXmlHttp.create();var xmlDoc;var markers;
request.open("GET", xmlFileName + "?" + Math.random(), true);
request.onreadystatechange = function() {
	if (request.readyState == 4) {
		xmlDoc = request.responseXML;
		markers = xmlDoc.documentElement.getElementsByTagName("marker");
		markerLength = markers.length;
	}
}
request.send(null);

if (queryString("debug") != '') {window.onerror = handleError;}
document.onkeypress = kH;if (document.layers) document.captureEvents(Event.KEYPRESS);
var map = new GMap(document.getElementById("map"));mapInit();
var icon = new GIcon();iconInit();
var servericon = new GIcon();serverIconInit();
var markerArray = new Array();var markerLength = 0;
GEvent.addListener(map, "click", function(overlay, point) {document.theForm.slideshow.checked=false;});
serverspoint = new GPoint(-96.767552, 32.78871);
serversMarker = new GMarker(serverspoint, servericon);
GEvent.addListener(serversMarker, "click", function() {serversMarker.openInfoWindowHtml("<div align='left'><b>DALLAS, TX:</b><br>Tactical Gamer servers</div>")});

window.onload = pageInit;

var firstSearch;
function pageInit() {
	permanentStatus();
	document.theForm.slideshow.checked = document.theForm.filter.value == ''
	filterFocus();
	if (document.theForm.filter.value != '') {firstSearch=0;search();}
	firstSearch=1;
	nextSlide();
}
    //]]>

