
function initialize() {
	if (GBrowserIsCompatible()) {
		// instantiate map
		var map = new GMap2(document.getElementById("google_map"),{mapTypes:[G_PHYSICAL_MAP]});
		//map.setCenter(new GLatLng(55.676294, 12.568116), 10);
		var ui = map.getDefaultUI();
		ui.controls.smallzoomcontrol3d = true;
		ui.controls.menumaptypecontrol = false;
		ui.zoom.scrollwheel = false;
		map.setUI(ui);

		// create custom marker icon
		var tinyIcon = new GIcon();
		tinyIcon.image = "http://trygdenaf.dk/assets/images/core/gx_bluedot.png";
		tinyIcon.iconSize = new GSize(11, 11);
		tinyIcon.iconAnchor = new GPoint(5, 5);
		mo = { icon:tinyIcon };
		//http://maps.google.com/maps/ms?ie=UTF8&hl=en&oe=UTF8&msa=0&msid=110611677178327967008.000472b2eb598a3dd10f0&output=kml
		// load POIs
		var standalone = $("#google_map").parent().hasClass("main-content");
		var gx = new GGeoXml("http://maps.google.com/maps/ms?ie=UTF8&msa=0&output=kml&msid=100065997015728348417.0004892a3988fd38d6a7f",function()
		{
			var bounds = this.getDefaultBounds();
			var zoomCorrection = 0; //standalone? 1:0;
			map.setCenter(bounds.getCenter(), map.getBoundsZoomLevel(bounds)-zoomCorrection);
						
			var pois = this.ad;
			if (!standalone)  {
				for(i=0;i<pois.length;i++) {
					var poi = pois[i];
					var c = poi.C; var n = poi.name;
					var marker = new GMarker(c, mo);
					marker.locName = poi.name;
					marker.link = $("#locationName").html();
					
					GEvent.addDomListener(marker, 'mouseover', function() {$("#locationName").html(this.locName);});
					
					GEvent.addDomListener(marker, 'mouseout', function() {$("#locationName").html(this.link);});
					map.addOverlay(marker);
				}
			} else {
				$("#google_list").empty();
				var poi_names = new Array();
				for(i in pois) poi_names[poi_names.length] = pois[i].name;
				poi_names.sort();
				$("#google_list").append("<li>"+poi_names.join("</li><li>")+"</li>");
				map.addOverlay(this);
			}		
		});
	}
}

$(window).load( function () {initialize()} );
$(window).unload( function () {GUnload()} );

