var map = null;
var JSON_POINTERS = eval('({"pointers":[]})');
var ARRAY_MARKERS = [];
function startMapUI(){
	//load the map
	var myOptions = {
		zoom:2,
		center: new google.maps.LatLng(0,0),
		mapTypeId: google.maps.MapTypeId.SATELLITE,
		navigationControlOptions: {
			style: google.maps.NavigationControlStyle.ZOOM_PAN,
			position: google.maps.ControlPosition.TOP_RIGHT
		},
		mapTypeControl: true,
		mapTypeControlOptions: {
			style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
		}
	}
	map = new google.maps.Map(document.getElementById("google_earth_plugin"), myOptions);
	//loadMotherKmlLayer();
	setTimeout('showMapMessage()', 2000);
}
function clearMapPointers(){
	if (ARRAY_MARKERS) {
		for (i in ARRAY_MARKERS) {
			ARRAY_MARKERS[i].setMap(null);
		}
		ARRAY_MARKERS.length=0;
	}
}
function loadKML2Map(url, doFly, balloon){
	if (!balloon) balloon=false;
	kml = new google.maps.KmlLayer(url, {
		"map":map,
		"preserveViewport":!doFly,
		"suppressInfoWindows":!balloon
	});
	ARRAY_MARKERS.push(kml);
	if (url.indexOf("/site_")>0){
		setTimeout('map.setZoom(15);', 1000);
	}
}
function unloadKML2Map(url){
	if (ARRAY_MARKERS) {
		for (i in ARRAY_MARKERS) {
			if (ARRAY_MARKERS[i].getUrl()==url){
				ARRAY_MARKERS[i].setMap(null);
				ARRAY_MARKERS.splice(i, 1);
			}
		}
	}
}
function loadMotherKmlLayer(){
	mother = new google.maps.KmlLayer("http://ghn.globalheritagefund.org/kml/all.kml", {
		"map":map,
		"preserveViewport":true,
		"suppressInfoWindows":true
	});
}

