function showmap(map, act_id, jsonUrl) {
        var marker_cache = new Array();
        var tab_cache = new Array();
        var mgr = new GMarkerManager(map);
        GDownloadUrl( jsonUrl,function(data, responseCode) {  parseJson(data);});
        
        // == shows all markers of a particular category, and ensures the checkbox is checked ==
        function show(category) {
          for (i in marker_cache) {
            if (marker_cache[i].category == category) {
              marker_cache[i].show();
            }
          }
          // == check the checkbox ==
          document.getElementById("box"+category).checked = true;
        }

        // == hides all markers of a particular category, and ensures the checkbox is cleared ==
        function hide(category) {
          for (i in marker_cache) {
            if (marker_cache[i].category == category) {
                marker_cache[i].hide();
            }
          }
          // == clear the checkbox ==
          document.getElementById("box"+category).checked = false;
          // == close the info window, in case its open on a marker that we just hid
          map.closeInfoWindow();
        }

        // == a checkbox has been clicked ==
       this.boxclick =  function (box,category) {
          if (box.checked) {
            show(category);
          } else {
            hide(category);
          }
        }
        
        this.showoption = function (selectbox){
            for (i in marker_cache) {
              if (selectbox.value == "" || jQuery.inArray(selectbox.value, marker_cache[i].location_attributes) != -1){
                  marker_cache[i].show();
              }else{
                  marker_cache[i].hide(); 
              }
            }      
        }
        
        function formatTabOne (input) {
            var html  = "<div class=\"bubble\" width=\"300px\">";
            if(input.image != null) {
                html  += "<img style=\"float:right;\ width:70px;\"  src='" + input.image + "'>";
            }
            html  += "<h2>" + input.name + "</h2>";
            if(input.description != null){
            	html  += "<p>" + input.description + "</p>";
			}
            if(input.detail != null){
                html  += "<a href=\"" + input.detail + "\">Details</a>";        
            }
            html  += "</div>";
            return html;
        }

        function formatTabTwo (input) {
            var html = "<div class=\"bubble\">";
            html += "<p>"
            if(input.street != null){
                html += input.street + "<br />";
            }
            if(input.zip != null) {
                html +=  input.zip + " ";
            }
            if(input.city != null) {
                html += "  " + input.city + "<br />";
            }
            if(input.phone != null) {
                html += "<br />Telefon: " + input.phone + "<br />";
            }
            if(input.fax != null) {
                html += "Fax: " + input.fax + "<br />";
            }
            if(input.email != null) {
                html += input.email + "<br />";
            }
            if(input.homepage != null) {
                html += "<br /><a href='" + input.homepage + "'>Homepage</a><br />";
            }
            html += "</p></div>";
            return html;
        }

        function createMarker(input) {
            if (input.icon){
                var icon = new GIcon();
                icon.image =  input.icon;
                if(input.iconshwodow){
                    icon.shadow = input.iconshadow;                    
                };
                icon.iconSize = new GSize(30,  30);
                icon.iconAnchor = new GPoint(15, 15);
                icon.infoWindowAnchor = new GPoint(15, 15);
            
                var marker = new GMarker(new GLatLng(input.latitude, input.longitude), {icon: icon});
            }else
            {
                var marker = new GMarker(new GLatLng(input.latitude, input.longitude));
            };
            marker.category = input.category
            marker.location_attributes = input.attributes
            // var marker = new GMarker(new GLatLng(input.latitude, input.longitude));
            var tabs_array   = [ new GInfoWindowTab("Info", formatTabOne(input) ),
                                 new GInfoWindowTab("Adresse", formatTabTwo(input) ) ];
            var opts = new Object();
            opts.maxWidth = 240;
            
            tab_cache[input.id] = tabs_array;
            
            GEvent.addListener(marker, "click", function() {
                marker.openInfoWindowTabsHtml(tabs_array,opts);
            });
            return marker;
        }
        
        function parseJson (doc) {
            var jsonData = eval("(" + doc + ")");
            var batch = [];
            var firstrun = false;
            if (marker_cache.length == 0) firstrun = true; 
            
            for (var i = 0; i < jsonData.markers.length; i++) {
                if(marker_cache[jsonData.markers[i].id] == null){
                    marker = createMarker(jsonData.markers[i]);
                    marker_cache[jsonData.markers[i].id] = marker;
                    batch.push(marker);
                }
            }
            mgr.addMarkers(batch, 8);
            mgr.refresh();
            /* show info of act place on init*/
            if(typeof(act_id) != "undefined" && firstrun && act_id != "") {
                var opts = new Object();
                opts.maxWidth = 240;
                marker_cache[act_id].openInfoWindowTabsHtml(tab_cache[act_id],opts);
            }


        }
};

