function load_map(origin_lat,origin_long) {
	if (GBrowserIsCompatible()) {
		var tim
		var maxZoom
		var map = new GMap2(document.getElementById("map"));
		GEvent.addListener(map, "load", function() {
			tim=window.setTimeout('mapFinished()',3000);
		});

		GEvent.addListener(map, "moveend", function() {
			document.getElementById('newpos').value=map.getCenter()
		});

		map.setMapType(G_SATELLITE_MAP);
		map.setCenter(new GLatLng(origin_lat,origin_long), 19);
		
		// -------------------------- main init done ----------------------------------------
		
		TextualZoomControl=function() {}
		TextualZoomControl.prototype = new GControl();
		TextualZoomControl.prototype.initialize = function(map) {
		  var container = document.createElement("div");
		
		  var zoomInDiv = document.createElement("div");
		  this.setButtonStyle_(zoomInDiv);
		  container.appendChild(zoomInDiv);
		  zoomInDiv.appendChild(document.createTextNode("Zoom +"));
		  GEvent.addDomListener(zoomInDiv, "click", function() {
		  	var cz=map.getZoom();
		    if(map.getZoom()<maxZoom) { map.zoomIn(); }
		  });
		
		  var zoomOutDiv = document.createElement("div");
		  this.setButtonStyle_(zoomOutDiv);
		  container.appendChild(zoomOutDiv);
		  zoomOutDiv.appendChild(document.createTextNode("Zoom –"));
		  GEvent.addDomListener(zoomOutDiv, "click", function() {
		    map.zoomOut();
		  });
		
		  var resetDiv = document.createElement("div");
		  this.setButtonStyle_(resetDiv);
		  this.setButtonStyle2_(resetDiv);
		  container.appendChild(resetDiv);
		  resetDiv.appendChild(document.createTextNode("Reset"));
		  GEvent.addDomListener(resetDiv, "click", function() {
		    map.setCenter(new GLatLng(origin_lat,origin_long), maxZoom);
		  });
		
		  map.getContainer().appendChild(container);
		  return container;
		}

		TextualZoomControl.prototype.setButtonStyle_ = function(button) {
		  button.style.backgroundColor = "white";
		  button.style.fontWeight = "bold";
		  button.style.fontSize = "10px";
		  button.style.border = "1px solid black";
		  button.style.padding = "2px";
		  button.style.marginBottom = "3px";
		  button.style.textAlign = "center";
		  button.style.width = "65px";
		  button.style.cursor = "pointer";
		}
		TextualZoomControl.prototype.setButtonStyle2_ = function(button) {
		  button.style.backgroundColor = "#CCCCCC";
		  button.style.marginTop = "15px";
		}
		TextualZoomControl.prototype.getDefaultPosition = function() {
		  return new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(7, 7));
		}
	}
	
	G_SATELLITE_MAP.getErrorMessage = function() {
		if(tim){window.clearInterval(tim); tim=window.setTimeout('mapFinished()',3000);} else { tim=window.setTimeout('mapFinished()',3000); }
		var currentzoom=map.getZoom();
		if (currentzoom > 10) {
			map.setZoom(currentzoom-1);
		}
		return '';
	}
	
	mapFinished = function() {
		maxZoom=map.getZoom()
		map.addControl(new GMapTypeControl());
		map.addControl(new TextualZoomControl());
		var tinyIcon = new GIcon();
		tinyIcon.image = "/nav/house_icon.png";
		tinyIcon.iconSize = new GSize(32, 32);
		tinyIcon.iconAnchor = new GPoint(18, 18);
		markerOptions = { icon:tinyIcon };
		var point = new GLatLng(origin_lat,origin_long);
		map.addOverlay(new GMarker(point, markerOptions));
		
		/*
		map.addOverlay(new GScreenOverlay('/nav/crosshair_h.gif',  new GScreenPoint(0,199),   new GScreenPoint(0,0), new GScreenSize(246,3)))
		map.addOverlay(new GScreenOverlay('/nav/crosshair_h.gif',  new GScreenPoint(304,199), new GScreenPoint(0,0), new GScreenSize(246,3)))
		map.addOverlay(new GScreenOverlay('/nav/crosshair_v.gif',  new GScreenPoint(274,230), new GScreenPoint(0,0), new GScreenSize(3,172)))
		map.addOverlay(new GScreenOverlay('/nav/crosshair_v.gif',  new GScreenPoint(274,0),   new GScreenPoint(0,0), new GScreenSize(3,172)))
		map.addOverlay(new GScreenOverlay('/nav/crosshair_vm.gif', new GScreenPoint(245,194), new GScreenPoint(0,0), new GScreenSize(3,13)))
		map.addOverlay(new GScreenOverlay('/nav/crosshair_vm.gif', new GScreenPoint(301,194), new GScreenPoint(0,0), new GScreenSize(3,13)))
		map.addOverlay(new GScreenOverlay('/nav/crosshair_hm.gif', new GScreenPoint(269,228), new GScreenPoint(0,0), new GScreenSize(13,3)))
		map.addOverlay(new GScreenOverlay('/nav/crosshair_hm.gif', new GScreenPoint(269,172), new GScreenPoint(0,0), new GScreenSize(13,3)))
		*/
		
		document.getElementById('shutter').style.display='none'
		document.getElementById('waitlayer').style.display='none'
	}
}
