    //<![CDATA[
    var map;
    var currentMarker;
    var html;
    var type;
    
    window.addEvent('domready', function() {
      if (GBrowserIsCompatible()) {
				// icon
				icon = new GIcon();
				icon.shadow = "http://www.sidgcongress.si/images/marker_shadow.png";
				icon.iconSize = new GSize(30, 43);
				icon.shadowSize = new GSize(50, 43);
				icon.iconAnchor = new GPoint(15, 41);
				icon.infoWindowAnchor = new GPoint(5, 1);

				// map
        map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(centerLat, centerLng), zoom);
				map.addControl(new GSmallMapControl());
				map.addControl(new GMapTypeControl());
				map.enableScrollWheelZoom();
				
				if (type == 'sat') map.setMapType(G_SATELLITE_MAP);
				else if (type == 'hyb') map.setMapType(G_HYBRID_MAP);
				else map.setMapType(G_NORMAL_MAP);

				// load markers
				if (!lang) lang = 'slo';
				
				var myReq = new Request({
					url: '/'+lang+'/getMarkers',
					method: 'get',
					onComplete: function(data) {
						markers = JSON.decode(data);
						
						for (var x in markers) {
					  	if (markers[x].id) {
					  		if (markers[x].type == "location") icon.image = "http://www.sidgcongress.si/images/marker_l.png";
					  		else if (markers[x].type == "hotel") icon.image = "http://www.sidgcongress.si/images/marker_h.png";
					  		else if (markers[x].type == "turizem") icon.image = "http://www.sidgcongress.si/images/marker_a.png";
					  		else if (markers[x].type == "transport") icon.image = "http://www.sidgcongress.si/images/marker_t.png";
					  		else if (markers[x].type == "filo") icon.image = "http://www.sidgcongress.si/images/marker_f.png";
					  		else icon.image = "http://www.sidgcongress.si/images/marker.png";
					  			
					    	var marker = new GMarker(new GLatLng(parseFloat(markers[x].lat), parseFloat(markers[x].lng)), {icon:icon, draggable:false, bouncy:true});
					    	marker.id = markers[x].id;
					    	marker.title = markers[x].title;
					    	marker.text = markers[x].text;
					    	html = marker.text;
								
								GEvent.addListener(marker, "click", function() {
								  if (typeof MyOverlay !== 'undefined') {
								    if (currentMarker) {
								      closeOverlay();
								    }
								    if (!this.overlay) {
								      // just recording this for use in the closeOverlay function
								      this.overlay = new MyOverlay(this, this.title, this.text);
								    }
								    currentMarker = this;
								    map.panTo(new GLatLng(this.getPoint().lat(), this.getPoint().lng()));
								    map.addOverlay(this.overlay);
								    // this.hide();
								  } else {
								    marker.openInfoWindowHtml(html);
								  }
								});

					    	map.addOverlay(marker);
					    }
					  }
					}
				}).send();
      }
    });
    
    function printMap() {
    	type = map.getCurrentMapType().getName(true);
    	center = map.getCenter();
    	zoom = map.getZoom();
    	
    	if (lang == "slo") url = 'http://www.sidgcongress.si/slo/zemljevid/print/' + type.toLowerCase() + ':' + center.lat() + ':' + center.lng() + ':' + zoom;
    	else url = 'http://www.sidgcongress.si/eng/map/print/' + type.toLowerCase() + ':' + center.lat() + ':' + center.lng() + ':' + zoom;
    	window.open(url, null, "height=700,width=900,status=no,toolbar=no,menubar=no,location=no,screenX=50,left=50,screenY=50,top=50");
    	// alert(url);
    }
    
		var MyOverlay = function(marker, title, html) {
		  this.marker = marker;
		  this.html = html;
		  this.title = title;
		}
		MyOverlay.prototype = new GOverlay();
		MyOverlay.prototype.initialize = function(map) {
		  var div = document.createElement("div");
		  div.className = 'mapInfoBox';
		  div.innerHTML = '<div class="title">'+this.title+'</div><div class="text">'+this.html+'</div>';
		
		  // offsets based on popup div dimensions
		  offsetX = 110;
		  offsetY = 170;
		
		  div.style.top = (map.fromLatLngToDivPixel(this.marker.getPoint()).y - offsetY) + 'px';
		  div.style.left = (map.fromLatLngToDivPixel(this.marker.getPoint()).x - offsetX) + 'px';
		
		  div.onclick = closeOverlay;
		
		  this._map = map;
		  this._div = div;
		
		  map.getPane(G_MAP_FLOAT_PANE).appendChild(div);  
		}
		MyOverlay.prototype.remove = function(){
		  this._div.parentNode.removeChild(this._div);
		}
		MyOverlay.prototype.redraw = function() {
		  //haven't had need for this yet
		}
		
		function closeOverlay() {
		  if (currentMarker) {
		    map.removeOverlay(currentMarker.overlay);
		    currentMarker.show();
		  }
		}
    //]]>