var map;
var dontshowmap = 0;
var baseIcon_h = new GIcon(G_DEFAULT_ICON); 
var baseIcon_b = new GIcon(G_DEFAULT_ICON); 
var baseIcon = new GIcon(G_DEFAULT_ICON); 
baseIcon_h.shadow = null;
baseIcon_h.iconSize = new GSize(31, 37); 
baseIcon_h.iconAnchor = new GPoint(6, 32); 
baseIcon_h.infoWindowAnchor = new GPoint(9, 2); 
baseIcon_b.shadow = null;
baseIcon_b.iconSize = new GSize(24, 31); 
baseIcon_b.iconAnchor = new GPoint(6, 26); 
baseIcon_b.infoWindowAnchor = new GPoint(9, 2); 
baseIcon.shadow = null;
baseIcon.iconSize = new GSize(18, 23); 
baseIcon.iconAnchor = new GPoint(5, 18); 
baseIcon.infoWindowAnchor = new GPoint(9, 2); 
function initialize() { 
	if (GBrowserIsCompatible()) { 
		if (dontshowmap == 1) return;
		map = new GMap2(document.getElementById("map_canvas")); 
		map.addControl(new GSmallMapControl()); 
		map.addControl(new GMapTypeControl()); 

		var north = 0;
		var south = 90;
		var west = 90;
		var east = 0;
		for (var i=0; i<icons.length; i++) {
			if (icons[i][7] == 0) continue;
			if (icons[i][7] > east) east = icons[i][7];
			if (icons[i][7] < west) west = icons[i][7];
			if (icons[i][6] > north) north = icons[i][6];
			if (icons[i][6] < south) south = icons[i][6];
		}
		nw = new GLatLng(north, west);
		se = new GLatLng(south, east);
		bounds = new GLatLngBounds(nw, se);
		z = map.getBoundsZoomLevel(bounds);

		if (z == 21) z = 18;

		map.setCenter(new GLatLng(north/2+south/2, east/2+west/2), z);
 
		loadicons();
	} 
} 
function loadicons() {
	var north = 0;
	var south = 90;
	var west = 90;
	var east = 0;
	for (var i=0; i<icons.length; i++) {
		if (icons[i][7] == 0) continue;
		var letter = String.fromCharCode(65 + i); 
		ic = baseIcon;
		icn = "";
		if (icons[i][0] == 1) {
			ic = baseIcon_h;
			icn = "highranking";
		} else if (icons[i][1] == 1) {
			ic = baseIcon_b;
			icn = "betalend";
		}

		var letteredIcon = new GIcon(ic); 
		letteredIcon.image = "/img/icon_" + icn + (i+1) + ".png"; 
 
		var point = new GLatLng(icons[i][6], icons[i][7]);
		markerOptions = { icon:letteredIcon }; 
		var marker = new GMarker(point, markerOptions); 
		marker.id = i;
 
		GEvent.addListener(marker, "mouseover", function() { 
			var ic = icons[this.id];
			var html = "";
			html += "<B>" + ic[8] + "</B><BR>";
			html += ic[3] + "<BR>";
			html += ic[4] + " " + ic[5] + "<BR>";
			html += "Tel.: " + ic[9] + "<BR>";

			this.openInfoWindowHtml(html); 
		}); 
		GEvent.addListener(marker, "mouseout", function() { 
			this.closeInfoWindow(); 
		}); 
		map.addOverlay(marker);
	}
}

