function CShowMapNames(vObjectVar, vMapObject)
{
	// AJAX-Objekt erstellen
	this.AJAXObject=new CAJAX(vObjectVar+".AJAXObject");

	// Die Variable dieser Klasse sicher, für z.B. AJAX Aufrufe
	this.ObjectVar=vObjectVar;

	// Map-Objekt zuweisen/sichern
	this.MapObject=vMapObject;

	// Partner-Id setzen
	//this.pid=0;

	// Sprache setzen
	//this.lang="de";

	// Names-Informationen
	this.land="";
	this.region="";
	this.unterregion="";
	this.nameInfoObject={}; // googleAddress, landText, regionText, unterregionText, latLngRect={minLat, minLng, maxLat, maxLng}
	this.markers=new Array();

	// Namen klickbar
	this.namesClickable=true;

	// Pfad zu ShowScriptNames.php
	this.PathToRootDir="../";

	// Handler-Objekt bei Callback
	this._callbackHandler={commands: null, timeoutHandle: null};

	// Einzulesende Namen auf Lat/Lng der Map eingrenzen
	this.onlyShowMapNames=false;

	// Namen rastern
	this.rasterizeNames=false;

	// Anzahl Objekte (ferienhaeuser) im Namen anzeigen
	this.anzahl=false;

	// Anzahl-Marker anstatt Namen-Marker verwenden
	this.useCountMarker=false;

	// Events
	this.eventBeforeShowFunction="";
	this.eventAfterShowFunction="";

	// Methode zum Anzeigen der Namen bereitstellen
	this._showNames=CShowMapNames_showNames;

	this.showCountryNames=CShowMapNames_showCountryNames;
	this.showRegionNames=CShowMapNames_showRegionNames;
	this.showSubregionNames=CShowMapNames_showSubregionNames;
	this.regionNameClick=CShopMapNames_regionNameClicked;
	this.setNameByPosition=CShowMapNames_setNameByPosition;
	this.setNameByPoint=CShowMapNames_setNameByPoint;
	this.hideMarkers=CShowMapNames_hideMarkers;
	this.showMarkers=CShowMapNames_showMarkers;	

	// Methode "_callback_Call" bereitstellen
	this._callback_Call=CShowMapNames_callback_Call;
	this._callbackHandler_Call=CShowMapNames_callbackHandler_Call;
}

// Methode zum Anzeigen aller Ländernamen
function CShowMapNames_showCountryNames()
{
	this.land=this.region="";

	this._showNames();
}

// Methode zum Anzeigen aller Regionnamen
function CShowMapNames_showRegionNames(vLand)
{
	this.land=vLand;
	this.region="";

	this._showNames();
}

// MEthode zum Anzeigen der Unterregionnamen
function CShowMapNames_showSubregionNames(vLand, vRegion)
{
	this.land=vLand;
	this.region=vRegion;

	this._showNames();
}

// Methode wenn Region geklickt wird
function CShopMapNames_regionNameClicked(vLand, vRegion, vUnterregion)
{
	this.land=vLand;
	this.region=vRegion;
	this.unterregion=vUnterregion;

	// Event: After Show
	if (this.eventBeforeShowFunction!="")
	{eval(this.eventBeforeShowFunction+"();");
	}
	if (this.eventAfterShowFunction!="")
	{eval(this.eventAfterShowFunction+"();");
	}
}

// Methode  zum Anzeigen der Namen
function CShowMapNames_showNames(vLand, vRegion)
{
	var currentBoundsParameterString="";
	
	//this.markers=new Array();

	// Event: Before Show
	if (this.eventBeforeShowFunction!="")
	{eval(this.eventBeforeShowFunction+"();");
	}

	// Nur Namen anzeigen, die innerhalb der Lat/Lng-Mapmaße liegen
	if (this.onlyShowMapNames)
	{
		var tmpGeoMapBoundsRect=this.MapObject.getBounds();
		var tmpGeoMapSizes=this.MapObject.getSize();

		currentBoundsParameterString="";
		currentBoundsParameterString+="&geoRect[top]="+tmpGeoMapBoundsRect.getNorthEast().lat();
		currentBoundsParameterString+="&geoRect[left]="+tmpGeoMapBoundsRect.getSouthWest().lng();
		currentBoundsParameterString+="&geoRect[bottom]="+tmpGeoMapBoundsRect.getSouthWest().lat();
		currentBoundsParameterString+="&geoRect[right]="+tmpGeoMapBoundsRect.getNorthEast().lng();
		
		currentBoundsParameterString+="&zoomLevel="+this.MapObject.getZoom();

		currentBoundsParameterString+="&divSizes[width]="+this.MapObject.getSize().width;
		currentBoundsParameterString+="&divSizes[height]="+this.MapObject.getSize().height;
	}

	this.AJAXObject.URL=this.PathToRootDir+"global/shownames_CShowMapNames.php";
	this.AJAXObject.SendRequestData="land="+escape(this.land)+"&region="+escape(this.region)+"&objectVar="+this.ObjectVar+currentBoundsParameterString+"&rasterizeNames="+(this.rasterizeNames?"true":"")+"&anzahl="+(this.anzahl==true?"true":"false")+(typeof lang!="undefined"?"&lang="+lang:"");
	this.AJAXObject.CallbackFunction=this.ObjectVar+"._callback_Call";
	this.AJAXObject.Call();

	//prompt("", this.AJAXObject.SendRequestData);
}


// Methode für AJAX-Objekt-Callback
function CShowMapNames_callback_Call()
{
	if (this._callbackHandler.timeoutHandle!=null)
	{
		window.clearTimeout(this._callbackHandler.timeoutHandle);
		this._callbackHandler.timeoutHandle=null;
	}
	this._callbackHandler.commands=new Array();
	this._callbackHandler.commands=this.AJAXObject.Data.split("\n");

	if (this._callbackHandler.commands.length>0)
	{this._callbackHandler.timeoutHandle=window.setTimeout(this.ObjectVar+"._callbackHandler_Call()", 0);
	}	
}

function CShowMapNames_callbackHandler_Call()
{
	if (this._callbackHandler.commands.length>0)
	{
		var tmpCommandString=this._callbackHandler.commands[this._callbackHandler.commands.length-1];
		this._callbackHandler.commands.pop();

		//alert(this.ObjectVar+", "+this._callbackHandler.commands.length+", "+tmpCommandString);
		eval(tmpCommandString);

		this._callbackHandler.timeoutHandle=window.setTimeout(this.ObjectVar+"._callbackHandler_Call()", 0);
	}
	else
	{
		//alert("Fertig.");

		// Event: AfterShow
		if (this.eventAfterShowFunction!="")
		{eval(this.eventAfterShowFunction+"();");
		}
	}
}

function CShowMapNames_setNameByPosition(vPosition, vText, vLink)
{
	// Eigentlich sollte mittlierweile immer ein Lat/Lng-Punkt vorhanden
	this.setNameByPoint(vPosition, vText, vLink);
	return;


 if (vPosition.x=="" && vPosition.y=="") // Positionierung per vorhandener Daten
 {this.AJAXObject.URL=this.PathToRootDir+"global/search_europakarte_loadgeopos.php";

	this.AJAXObject.SendRequestData="land="+escape(vPosition.land)+"&region="+escape(vPosition.region)+"&unterregion="+escape(vPosition.unterregion)+"&ort="+escape(vPosition.ort);
	this.AJAXObject.CallbackFunction="";
  tmpGeoData=this.AJAXObject.Call();
  eval(tmpGeoData);

  if (typeof tmpGeoPoint!="undefined") // Alternativer GeoPoint gefunden, anhand geo_land/region/ort-Tabellen
  {this.setNameByPoint({x: tmpGeoPoint.x, y: tmpGeoPoint.y}, vText, vLink);
  }
  else
  {var geocoder=new GClientGeocoder();
	 tmpObjectVar=this.ObjectVar;

   geocoder.getLatLng(vPosition.googleAddress,
    function (point)
    {if (point!=null)
     {
			var tmpCall=tmpObjectVar+".setNameByPoint({x: \""+point.x+"\", y: \""+point.y+"\"}, \""+vText+"\", \""+vLink+"\");"
			//alert(tmpCall);
			eval(tmpCall);			
     }
    }
   );
  }
 }
 else
 {this.setNameByPoint(vPosition, vText, vLink);
 }
}

function CShowMapNames_setNameByPoint(vPoint, vText, vLink)
{
 var textIcon=new GIcon();

	if (this.useCountMarker && this.anzahl)
	{
		var tmp=vText.match(/^(.*) \((.*?)[^0-9,\.]/); // Nummer und Text ermitteln
		//vText=tmp[1];
		var number=tmp[2];
		var number2=number.replace(/,\./, "");

		textIcon.image=this.PathToRootDir+"global/search_europakarte_genBallPic.php?text="+number+(navigator.userAgent.indexOf("MSIE 6")!=-1?"&indexedPalette=true":"");
		var textIconSize="";

		if (number2.length<=2)
		{textIconSize=22;
		}
		if (number2.length==3)
		{textIconSize=32;
		}
		if (number2.length>=4)
		{textIconSize=42;
		}

		textIcon.iconSize=new GSize(textIconSize, textIconSize);	
		textIcon.iconAnchor=new GPoint(textIconSize/2, textIconSize/2);
	}
	else
	{
		textIcon.image=this.PathToRootDir+"global/search_europakarte_genTextPic.php?text="+vText;
		var textIconSize=(vText.length*6)+vText.length;
		textIcon.iconSize=new GSize(textIconSize, 11);	
		textIcon.iconAnchor=new GPoint(textIconSize/2, 5);
	}
 

 var tmpMarker=null;
 if (typeof zIndexOrder!="undefined")
	{
	 tmpMarker=new GMarker(new GPoint(vPoint.x, vPoint.y), {icon: textIcon, clickable: this.namesClickable, title: vText, zIndexProcess: zIndexOrder} );
	 tmpMarker.zIndex=1;
	}
	else
	{tmpMarker=new GMarker(new GPoint(vPoint.x, vPoint.y), {icon: textIcon, clickable: this.namesClickable, title: vText} );
	}

 if (vLink!="")
	{GEvent.addListener(tmpMarker, "click",
		function()
		{document.location.href=vLink;
		}
	 );
	}

 this.markers[this.markers.length]=tmpMarker;
 this.MapObject.addOverlay(this.markers[this.markers.length-1]);
}

function CShowMapNames_hideMarkers()
{
	for (var m=0; m<this.markers.length; m++)
	{this.markers[m].hide();
	} // End for
}

function CShowMapNames_showMarkers()
{
	for (var m=0; m<this.markers.length; m++)
	{this.markers[m].show();
	} // End for
}