var map = null;
var geocoder = null;
var address = null;
var marker_content = null;

function googleAddress(response) {
    map.clearOverlays();
    if (!response || response.Status.code != 200) {
        alert("Adresse konnte nicht gefunden werden.");
    } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]);
        marker = new GMarker(point, markerOptions);
        map.addOverlay(marker);
	    //marker.openInfoWindowHtml(marker_content);
        map.setCenter(point, 15);
        GEvent.addListener(marker, "click", function() {
	       marker.openInfoWindowHtml(marker_content);
        });
    }
}

function googleInit(element,address,content) {
    marker_content= content;
    
    map = new GMap2(document.getElementById(element));
    map.addControl(new GSmallZoomControl());
    map.setCenter(new GLatLng(51.902099, 11.081936), 14);
    geocoder = new GClientGeocoder();
    tmp = geocoder.getLocations(address,googleAddress);
    
    tomIcon = new GIcon(G_DEFAULT_ICON);
    tomIcon.shadow = null;
    tomIcon.iconSize = new GSize(32, 32);
    tomIcon.image = "_local/img/gm_symbol.png";
    tomIcon.iconAnchor= new GPoint(24, 32);
    markerOptions = { icon:tomIcon };
}

