// Globale Variablen
var map;
var geocoder;
var markers = new Array();

function initialize() {
  if (GBrowserIsCompatible()) {
    
    try {
      map = new GMap2(document.getElementById("map")); // Karte anzeigen
    } catch(e) {}
    
    if(map){
      
      geocoder = new GClientGeocoder(); // Adressen in Koordinaten wandeln
      
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());

      orte_hinzufuegen();
      standardansicht();
      
    }
  }
}

function pin_setzen(id, address, info){
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        alert(address + " not found");
      } else {
        markers[id] = new GMarker(point);
        GEvent.addListener(markers[id], "click", function(){markers[id].openInfoWindowHtml(info)});
        map.addOverlay(markers[id]);
      }
    }
  );
}

function pin_anzeigen(id, address, zoom, info){
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        alert(address + " not found");
      } else {
        map.setCenter(point, zoom);
        markers[id].openInfoWindowHtml(info);
      }
    }
  );
}

function ansicht_einstellen(address, zoom){
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        alert(address + " not found");
      } else {
        map.setCenter(point, zoom);
      }
    }
  );
}