GoogleProvider = function(elementId, control,zoomMap,center){
	console.log("************************************ GoogleProvider baue Map auf ********************************************");
	var cLog = true;
	// Hier werden einige Parameter der Suche zwischengespeichert, um sie im zweiten Teil der Suche (Callback) zur Verfügung zu haben
	this.searchName = "";
	this.callbackSearch = "";
	this.domElement = "";
	this.onlyCount = false; // only count or create places ?
	this.countResults = 0; // the number of results after search
	// GoogleProvider-Objekte wie Map etc.
	try {	
			if(getDiv(elementId)){
				this.domElement = document.getElementById(elementId);
				if (! this.domElement) { 		var error_info = "DIV for map don't exist (elementId='" + elementId + "')"; 	}
				
				if(global.GOOGLE_MAP_V3){this.geocoder = new google.maps.Geocoder();}
				else {	this.geocoder = new GClientGeocoder();}
					
				this.localSearch = new GlocalSearch();
				if(global.GOOGLE_MAP_V3){
					  if(cLog){console.log("googleProvider.js-> GoogleProvider schalte die Map als V3");}
						var myOptions = {mapTypeId: google.maps.MapTypeId.ROADMAP,center: center,zoom: zoomMap}
						googleMap = new google.maps.Map(this.domElement,myOptions);
				} else {
						if(cLog){console.log("googleProvider.js-> GoogleProvider schalte die Map als V2");}
						var googleMap = new GMap2(this.domElement);
						if (control){
							//googleMap.addControl(new GSmallZoomControl3D());
							googleMap.addControl(new GLargeMapControl3D());
							googleMap.addControl(new GMapTypeControl());
							googleMap.addControl(new GOverviewMapControl());	
						}
				
				}
				
				this.map = googleMap;
				GEvent.addListener(this.map , "zoomend", eventZoomMap); // daniel 2010.08.15 zoomMap in ext
			} else {
				console.log('GoogleProvider... div: ' + elementId + ' dos not exist');
			}
	}	catch (e) {	alert("GoogleProvider constructor:\nerror while loading Google map: " + e.message + "\n" + error_info);		return null;	}
	console.log("GoogleProvider ende");
	console.groupEnd();
}
GoogleProvider.prototype.lookup = function(geoExp, name, callback) {
	console.log("GOOGLE: suche in '" + geoExp + "' nach '" + name + "' ...", 3, "googleProvider");
	this.searchName = name;
	this.callbackSearch = callback;
	// Trick, um diese Image-Instanz an die Callback zu übergeben
	var t = this;
	this.getPoint(geoExp, function(response) { t.callbackGetPoint(response); });
}


GoogleProvider.prototype.getPoint = function(geoExp, callback){
  console.log("------------------------- GoogleProvider.prototype.getPoint fuer: " + geoExp + "--------------------------------------");
	if(global.GOOGLE_MAP_V3){		 
			 if (this.geocoder){		this.geocoder.geocode({'address': geoExp,'partialmatch': true}, callback); }
	} else {
			if (this.geocoder) {   this.geocoder.getLatLng(geoExp, callback); }
			else { }
		//Map.zoomlevelMerker = Map.realMap.getZoom(); // merke mir diesen zoomlevel um in der ma
	}
}


GoogleProvider.prototype.search = function(point, name, callback){
	console.group("GoogleProvider.search(point, name, callback)");
	console.info("Startet die lokale Suche nach '" + name + "' für Punkt ", point);
	// Mittlerweile kann man statt Point auch direkt eine Beschreibung verwenden, z.B. localSearch.setCenterPoint("New York, NY");
	// siehe http://code.google.com/intl/de-DE/apis/ajaxsearch/documentation/
	this.localSearch.setCenterPoint(point);
	this.localSearch.setResultSetSize(GSearch.LARGE_RESULTSET);
	this.localSearch.setSearchCompleteCallback(null, callback);
	this.localSearch.execute(name); // Suche starten
	console.groupEnd()
}

GoogleProvider.prototype.callbackGetPoint = function(point){
  this.map.setCenter(point, 13);
	if (this.searchName != "") 	{		var t = this;
		this.search(point, this.searchName, function(response) { t.callbackSearch(response); });
	}	
}
