// smcWebMap
// Variante: Google 1

// Schnittstelle smcWebMap (siehe smcJavaScriptWebMap.js):
// oWebMapControl...Steuerobjekt für smcWebMap
// oWebMapAdress...Adresselement

var oGoogleMap = null;
var oGoogleGeocoder = null;

// === Schnittstellen-Funktionen

function WebMapShowAdress(oWebMapControl,oWebMapAdress)
// Funktion zum Anzeigen einer Adresse in der Google-Map
{
	if (GoogleLoadMap(oWebMapControl))
	{
		oGoogleGeocoder.getLatLng(oWebMapAdress.AdressSPLC,
            function(GetLocation)
			{
                oGoogleMap.setCenter(GetLocation, 15);
                var oMarker = new GMarker(GetLocation);
                GEvent.addListener(oMarker, "mouseover",
					function()
					{
						oMarker.openInfoWindowHtml("Adresse: "+ oWebMapAdress.AdressSPLC + "<br><br>" + title );
     				}
				);
                oGoogleMap.addOverlay(oMarker);
             }
		);
		return true;
	}
	smcWebDebug('ERROR WebMapShowAdress');
	return false;
}

function WebMapUnload()
// Entladen der Google-Funktion
{
	GUnload();
}

// === Google-spezifische Funktionen

function GoogleLoadMap(oWebMapControl)
// Funktion zum Initialisieren der Google-Map
{
	if (GBrowserIsCompatible())
	{
		if (document.getElementById(oWebMapControl.Element))
		{
			oGoogleMap = new GMap2(document.getElementById(oWebMapControl.Element));
			oGoogleMap.addControl(new GSmallMapControl());
			oGoogleMap.addControl(new GMapTypeControl());

			oGoogleGeocoder = new GClientGeocoder();
			if (oGoogleGeocoder) return true;
		}
		else
		{
			smcWebDebug('ERROR GoogleLoadMap - Element not found:' + oWebMapControl.Element);
		}
	}
	return false;
}
