   
    //<![CDATA[
    var map = null;
    var geocoder = null;
		var start = false;
		var baseIcon = null;
		var gmarkers = [];
    var gicons = [];
      
    function load(id) {
      
	     
	      if (GBrowserIsCompatible()) {
	       
	       	if (!id) {
	       	dataurl = "inc/data.xml.php";
	       	} else {
	       		dataurl = "inc/data.xml.php?id=" + id;
	       	}
	       	
	        map = new GMap2(document.getElementById("map"));

					map.addControl(new GSmallMapControl());
					map.addControl(new GMapTypeControl());
					
					
					map.setCenter(new GLatLng(53.5758, 10.0402), 13);
					
			    geocoder = new GClientGeocoder();
			    
					baseIcon = new GIcon();
					baseIcon.shadow = "http://www.ourlittleworld.de/img/shadow.png";
					//baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
					baseIcon.iconSize = new GSize(17, 19);
					baseIcon.shadowSize = new GSize(31, 28);
					baseIcon.iconAnchor = new GPoint(13, 19);
					baseIcon.infoWindowAnchor = new GPoint(17, 19);
					baseIcon.infoShadowAnchor = new GPoint(17, 10);

		i=1;
		while (i <= 7) {
      gicons[""+i+""] = new GIcon(G_DEFAULT_ICON,"http://www.ourlittleworld.de/img/"+i+".png");
      gicons[""+i+""].iconSize = new GSize(17, 19);
      gicons[""+i+""].shadowSize = new GSize(31, 28);
      gicons[""+i+""].iconAnchor = new GPoint(13, 19);
      gicons[""+i+""].infoWindowAnchor = new GPoint(17, 19);
      gicons[""+i+""].infoShadowAnchor = new GPoint(17, 10);
      i++;
	}
			    
				  GDownloadUrl(dataurl, function(data, responseCode) {
					var xml = GXml.parse(data);
					var markers = xml.documentElement.getElementsByTagName("marker");
				  
				  
				  
					for (var i = 0; i < markers.length; i++) {
					    
					    var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")));
					    map.addOverlay(createMarker(point, markers[i].getAttribute("info"), markers[i].getAttribute("f"), baseIcon ));
					    
					   	//map.addOverlay(new GMarker(point));
					}
						if (id) {
							map.setCenter(point, 13);
						}
					});
	      
	      }
	     
	   }

function setTheLastEntitiy() {
				  GDownloadUrl("inc/data.xml.php?last=1", function(data, responseCode) {
					var xml = GXml.parse(data);
					var markers = xml.documentElement.getElementsByTagName("marker");

					for (var i = 0; i < markers.length; i++) {
					    
					    var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")));
					    map.addOverlay(createMarker(point, markers[i].getAttribute("info"), markers[i].getAttribute("f"), baseIcon ));
					    
					   	//map.addOverlay(new GMarker(point));
					}
						map.setCenter(point, 16);
					});
}

  // Creates a marker at the given point clickable
    function createMarker(point, info, farbe, baseIcon) {
      //var icon = new GIcon(baseIcon);
 		
 			var marker = new GMarker(point,gicons[farbe]);
        // === Store the category and name info as a marker properties ===
        marker.mycategory = farbe;                                 
        marker.myname = info;
 		
  		//icon.image = "http://www.ourlittleworld.de/img/" + farbe + ".png";

      //var marker = new GMarker(point, icon);
      
      GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml("<iframe src=\"detail.php?id=" + info + "\"" + " width=300 height=200 frameborder=0 STYLE=\"z-index:1\"></iframe>" );
      });
      gmarkers.push(marker);
      return marker;
    }

   // == shows all markers of a particular category, and ensures the checkbox is checked ==
      function changeCategory(category) {
        
        for (var i=0; i<gmarkers.length; i++) {
          if (gmarkers[i].mycategory == category) {

            if (gmarkers[i].isHidden() == true) {
            	gmarkers[i].show();
            } else {
            	gmarkers[i].hide();
            }
          }
        }
        map.closeInfoWindow();
      }


  function showAddress(address, name) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              //alert(address + " not found");
            } else {
             //setCenter(point, 13);
              //var marker = new GMarker(point);
              map.addOverlay(createMarker(point, address, name, bild));
              
            }
          }
        );
      }
    }


  function showTempAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
             setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(createMarker(point));
              
            }
          }
        );
      }
    }

  function setNewPlace(address) {
      var ok=false;
      if (geocoder) {
        geocoder.getLatLng(
          address + ", Germany",
          function(point) {
            if (!point) {
              alert(address + " wurde nicht gefunden. Bitte überprüfen Sie die Schreibweise.");
              ok = false;
            } else {
              ok = true;
              map.setCenter(point, 13);
            }
          }
        );
      }
    return ok;
    }
   
  

    //]]>

