	var Dummy;
	var Geocoder = new GClientGeocoder();
	var MaxMapItems = 20;
	var MaxMapLocationItems = 20;
	var StartMapItems = 0;
	var MapInfoText = "<img id=\"MapInfoTextLoading\" src=\"./img/spinner.gif\" style=\"vertical-align: middle; display: none;\"> Mitglieder %s von %s%s%s%s";
	var MapInfoText2 = "<img id=\"MapInfoTextLoading\" src=\"./img/spinner.gif\" style=\"vertical-align: middle; display: none;\"> Locations %s von %s%s%s%s";
	var iconIch = new GIcon(); 
    iconIch.image = './img/googleMarkerIch.png';
    iconIch.shadow = null;
    iconIch.iconSize = new GSize(16, 16);
    iconIch.shadowSize = new GSize(24, 16);
    iconIch.iconAnchor = new GPoint(2, 12);
    iconIch.infoWindowAnchor = new GPoint(5, 1);
    
    var iconFreund = new GIcon(); 
    iconFreund.image = './img/googleMarkerFreund.png';
    iconFreund.shadow = null;
    iconFreund.iconSize = new GSize(16, 16);
    iconFreund.shadowSize = new GSize(24, 16);
    iconFreund.iconAnchor = new GPoint(2, 12);
    iconFreund.infoWindowAnchor = new GPoint(5, 1);
    
    var iconLocation = new GIcon(); 
    iconLocation.image = './img/googleMarkerLocation.png';
    iconLocation.shadow = null;
    iconLocation.iconSize = new GSize(16, 16);
    iconLocation.shadowSize = new GSize(24, 16);
    iconLocation.iconAnchor = new GPoint(2, 12);
    iconLocation.infoWindowAnchor = new GPoint(5, 1);
    
    var iconFocus = new GIcon(); 
    iconFocus.image = './img/googleMarkerFocus.png';
    iconFocus.shadow = null;
    iconFocus.iconSize = new GSize(24, 24);
    iconFocus.shadowSize = new GSize(24, 16);
    iconFocus.iconAnchor = new GPoint(2, 12);
    iconFocus.infoWindowAnchor = new GPoint(5, 1);
    
    var iconNutzer = new GIcon(); 
    iconNutzer.image = './img/googleMarkerKeinFreund.png';
    iconNutzer.shadow = null;
    iconNutzer.iconSize = new GSize(16, 16);
    iconNutzer.shadowSize = new GSize(24, 16);
    iconNutzer.iconAnchor = new GPoint(2, 12);
    iconNutzer.infoWindowAnchor = new GPoint(5, 1);
    
    var iconARAL = new GIcon(); 
    iconARAL.image = './img/POI/aral.png';
    iconARAL.shadow = null;
    iconARAL.iconSize = new GSize(24, 24);
    iconARAL.shadowSize = new GSize(30, 24);
    iconARAL.iconAnchor = new GPoint(6, 20);
    iconARAL.infoWindowAnchor = new GPoint(5, 1);
	
	function addAddressToMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Die angegebene Adresse kann leider nicht ermittelt werden");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        marker = new GMarker(point, iconIch);
        map.addOverlay(marker);
        markerInfoText = '<div class="small">';
        if (place.AddressDetails.Country.AdministrativeArea != null) {
	        markerInfoText +='<div><b>Adresskodierung erfolgreich</b></div>';
	        if (place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare != null) {
		        if (place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName!='')
		        	markerInfoText += place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.Thoroughfare.ThoroughfareName + '<br>';
	        }
            if (place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode) {
	            if (place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber!='')
		        	markerInfoText += place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.PostalCode.PostalCodeNumber + ' ';
        	}
        	if (place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName!='')
		        	markerInfoText += place.AddressDetails.Country.AdministrativeArea.SubAdministrativeArea.Locality.LocalityName + '<br>';
        }
        if (place.AddressDetails.Country.CountryNameCode!='')
        	markerInfoText += place.AddressDetails.Country.CountryNameCode;
        markerInfoText += '</div>';
        marker.openInfoWindowHtml(markerInfoText);
        GEvent.addListener(marker, "click", function() {
		    marker.openInfoWindowHtml(markerInfoText);
		  });
        
      }
    }
    function addAddressToMap2(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Die angegebene Adresse kann leider nicht ermittelt werden");
      } else {
        place = response.Placemark[0];
        map.setCenter(new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]), 11,G_NORMAL_MAP);
        point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
        
        function createMarker(point,html) {
		var marker = new GMarker(point);
		GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(html);
		});
		return marker;
		}
        //marker = new GMarker(point, iconIch);
        var anz_map_value = document.getElementById("anz_map_value").value;
        var marker = createMarker(point,anz_map_value);
        map.addOverlay(marker);
      }
    }
    
    function addMarkerToLocationMap(response) {
      setMarkerToEditLocationMap(response)
    }
    
    function setMarkerToEditLocationMap(response) {   
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Die angegebene Adresse kann leider nicht ermittelt werden");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        var marker = createMarker(place.Point.coordinates[1], place.Point.coordinates[0], '', 4);
        document.getElementById("f_lat").value = place.Point.coordinates[1].toFixed(6);		
		document.getElementById("f_lng").value = place.Point.coordinates[0].toFixed(6);		
		map.addOverlay(marker);
		map.setCenter(point);  
		checkSubmitButton();   
      }
    }
	
	
	function showLocation() {
      var address = "";
      address += document.getElementById('f_land').value + ',';
      address += document.getElementById('f_ort').value + ',';
      address += document.getElementById('f_strasse').value + ',';
      Geocoder.getLocations(address, addAddressToMap);
    }
    function showLocation2(val) {
      Geocoder.getLocations(val, addAddressToMap2);
    }
    
    /*
    function showNewLocationMarker() {
      var address = "";
      address += document.getElementById('f_land').value + ',';
      address += document.getElementById('f_ort').value + ',';
      address += document.getElementById('f_strasse').value + ',';
      Geocoder.getLocations(address, addMarkerToLocationMap);
    }
    
    function showNewLocationMarker2(id) {
      var error = false;
      
      var lat = parseFloat(document.getElementById("f_lat").value);
      var lng = parseFloat(document.getElementById("f_lng").value);
      if (lat < -90 || lat > 90 || lng < -180 || lat > 180 || isNaN(lat) || isNaN(lng) )
		error = true;
      if (!error) {
      	map.clearOverlays();
        point = new GLatLng(lat,
                            lng);
        //create an HTML DOM form element
		var inputForm = document.createElement("form");
		inputForm.setAttribute("action","");
		inputForm.setAttribute("accept-charset","UTF-8");
		inputForm.onsubmit = function() {storeMarker(); return false;};
		
		inputForm.innerHTML = '<fieldset style="width: 200px;">'
			+ '<legend>Neue Location</legend>'
			+ '<label for="f_name">Name (max. 100 Zeichen)</label>'
			+ '<input type="text" id="f_name" style="width: 100%;"/>'
			+ '<label for="f_beschreibung">Beschreibung</label>'
			+ '<textarea rows="3" id="f_beschreibung" style="width: 100%;"></textarea>'
			+ '<label for="f_freigabe">Freigabe</label><br/>'
			+ '<select id="f_freigabe">'
			+ ' <option value="a">Alle</option>'
			+ ' <option value="f" selected>Freunde</option>'
			+ ' <option value="p">Privat</option>'
			+ '</select><br/><br/>'
			+ '<input type="submit" value="Location speichern"/>'
			+ '<input type="hidden" id="longitude" value="' + lng + '"/>'
			+ '<input type="hidden" id="latitude" value="' + lat + '"/>'
			+ '</fieldset>';

		map.openInfoWindow(point, inputForm); 
      } else {
      	alert("Die angegebene Koordinaten sind ungueltig!");
      }
    }*/
    
    function showEditLocationMarker(id) {
      var address = "";
      address += document.forms['edit'].f_land.value + ',';
      address += document.forms['edit'].f_ort.value + ',';
      address += document.forms['edit'].f_strasse.value + ',';
      Geocoder.getLocations(address, setMarkerToEditLocationMap);
    }
    
    function showEditLocationMarker2(id) {
      var error = false;
      
      var lat = parseFloat(document.getElementById("f_lat").value);
      var lng = parseFloat(document.getElementById("f_lng").value);
      if (lat < -90 || lat > 90 || lng < -180 || lat > 180 || isNaN(lat) || isNaN(lng) )
		error = true;
      if (!error) {
      	map.clearOverlays();
      	var marker = createMarker(lat, lng, '', 4);
		point = new GLatLng(lat,lng);
		map.addOverlay(marker);
		map.setCenter(point);     
      } else {
      	alert("Die angegebene Koordinaten sind ungueltig!");
      }
    }
    
    function goToAdressOnMap(response) {
      map.clearOverlays();
      if (!response || response.Status.code != 200) {
        alert("Die angegebene Adresse kann leider nicht ermittelt werden");
      } else {
        place = response.Placemark[0];
        point = new GLatLng(place.Point.coordinates[1],
                            place.Point.coordinates[0]);
        map.setCenter(point); 
        
      }
    }
    
    function goToLocation(form) {
      Geocoder.getLocations(form.f_ort.value, goToAdressOnMap);
    }
    
    function createMarker(lng, lat, html, typ) {
	  if (typ==0)
		  var marker = new GMarker(new GLatLng(lng, lat)); /*, iconIch*/
	  else if (typ==1)
	  	  var marker = new GMarker(new GLatLng(lng, lat));
	  else if (typ==2)
	  	  var marker = new GMarker(new GLatLng(lng, lat));
	  else if (typ==3)
	  	  var marker = new GMarker(new GLatLng(lng, lat), iconARAL);
	  else if (typ==4)
	  	  var marker = new GMarker(new GLatLng(lng, lat), iconLocation);
	  if (typ!=4 && html!='') {
		  GEvent.addListener(marker, 'click', function() {
		    marker.openInfoWindowHtml(html);
		  });
	  } else if (typ==4){
	  	  	var content = html.split("##########");
	  	  	var url = "./ajax/getlocationsRSSwebsites.php?id="+content[3];
			var html1 = '<div><b>'+content[0]+'</b></div>';
			
			html1 += '<div style="margin-bottom: 5px;">'+content[1]+'</div>';
			html1 += '<div>'+content[2]+'</div>';
			var tabs_array = [ new GInfoWindowTab("Info", html1),
				new GInfoWindowTab("Webseiten", '<div id="tab_content_'+content[3]+'" style="height: 100px;"><div style="height: 30px; width: 30px;"></div></div>') ];

			
	  	  GEvent.addListener(marker, 'click', function() {
		    marker.openInfoWindowTabsHtml(tabs_array, {maxWidth: 270});
		    $('tab_content_'+content[3]).empty().addClass('ajax-loading');	
		    new Ajax(url, {
				method: 'get',
				update: $('tab_content_'+content[3])
			}).request().chain(function(){bindBubbles();});
			$('tab_content_'+content[3]).empty().removeClass('ajax-loading');
		  });
	  }
	  return marker;
	}
	
	function updatePOIMarkers(show) {
		var bounds = map.getBounds();
		
		myHashPOIMarkers.each(
			function(value, key){ 
				if(!bounds.contains(value.getPoint())) {
		            map.removeOverlay(value);
		            myHashPOIMarkers.remove(key);
		        }
			}
		); 
		if (map.getZoom()>8 && show==true) {
			
			var southWest = bounds.getSouthWest();
			var northEast = bounds.getNorthEast();
			var getVars = 'ne=' + northEast.toUrlValue()
						+ '&sw=' + southWest.toUrlValue();
			var request = GXmlHttp.create();
			request.open("GET", "./ajax/getpoibybounds.php?"+getVars, true);
			request.onreadystatechange = function() {
			  	if (request.readyState == 4) {
			    	var xmlDoc = request.responseXML;
			   		var points = xmlDoc.documentElement.getElementsByTagName("poi");
			    	for (var i = 0; i < points.length; i++) {
			            if (!myHashPOIMarkers.hasKey(points[i].getAttribute("id").toString())) {
				            var marker = createMarker(parseFloat(points[i].getAttribute("lat")), parseFloat(points[i].getAttribute("lng")), points[i].firstChild.nodeValue, 3);
				            myHashPOIMarkers.set(points[i].getAttribute("id"),marker);				            
							map.addOverlay(marker);
						}
					}
				}
			}
			request.send(null);
		} else {
			myHashPOIMarkers.each(
			function(value, key){ 
	            map.removeOverlay(value);
	            myHashPOIMarkers.remove(key);
				}
			); 
		}
	}
	
	function zind()
	{
	        return 1000000;
	
	} 
	
	
	function UpdateUsersMarkers(which)
	{
		var bounds = map.getBounds();
		
		myHashUserMarkers.each(
			function(value, key){ 
				if(!bounds.contains(value.getPoint())) {
		            map.removeOverlay(value);
		            myHashUserMarkers.remove(key);
		            myHashUserMarkersFocus.remove(key);
		        }
			}
		); 
		
		if (map.getZoom()>4) {
			
			var southWest = bounds.getSouthWest();
			var northEast = bounds.getNorthEast();
			var getVars = 'ne=' + northEast.toUrlValue()
						+ '&sw=' + southWest.toUrlValue();
			
			if (which=='all') {
				var request = GXmlHttp.create();
				request.open("GET", "./ajax/getusersbybounds.php?"+getVars, true);
				
			}
			
			request.onreadystatechange = function() {
			  	if (request.readyState == 4) {
			    	var xmlDoc = request.responseXML;	   		
			   		var UsersXml = xmlDoc.documentElement.getElementsByTagName("user");
	    	
			    	for (var i = 0; i < UsersXml.length; i++) {
			            UserId = UsersXml[i].childNodes[0].firstChild.data;
			            UserPrename = UsersXml[i].childNodes[4].firstChild.data;
			            UserSurname = UsersXml[i].childNodes[3].firstChild.data;
			            UserFoto = UsersXml[i].childNodes[7].firstChild.data;
			            UserLat = UsersXml[i].childNodes[1].firstChild.data;
			            UserLng = UsersXml[i].childNodes[2].firstChild.data;
			            if (!myHashUserMarkers.hasKey(UserId)) {
							myHashUserMarkersFocus[UserId] = new GMarker(new GLatLng(UserLat, UserLng), {zIndexProcess:zind, icon:iconFocus, draggable: false, bouncy: false, clickable: false});
							myHashUserMarkers[UserId] = new GMarker(new GLatLng(UserLat, UserLng), {icon:iconNutzer, draggable: false, bouncy: false, clickable: true, title: UserPrename + " " + UserSurname});
							myHashUserMarkers[UserId].URL = './person/' + UserId;
							GEvent.addDomListener(myHashUserMarkers[UserId], "click", function() { window.location = this.URL; });
							map.addOverlay(myHashUserMarkers[UserId]);
						}
					}
				}
			}

			request.send(null);
	
		} else {
			myHashUserMarkers.each(
			function(value, key){ 
	            map.removeOverlay(value);
	            myHashUserMarkers.remove(key);
	            myHashUserMarkersFocus.remove(key);
				}
			); 
		}
	}
	
	function UpdateUsersList(which, start) 
	{
		if (map.getZoom()<5)
			return;
		
		var bounds = map.getBounds();
		var start = (start == null) ? 0 : start;
		if (start>=0)
		{
			StartMapItems = start;
		}
		
		var request2 = GXmlHttp.create();
		if (which=='all') 
		{
			var southWest = bounds.getSouthWest();
			var northEast = bounds.getNorthEast();
			var getVars2 = 'ne=' + northEast.toUrlValue()
						+ '&sw=' + southWest.toUrlValue()
						+ '&start=' + StartMapItems
						+ '&max=' + MaxMapItems;
			
			$('MapInfoTextLoading').setStyle('display','inline');
			request2.open("GET", "./ajax/getusersbybounds.php?"+getVars2, true);
		}
		
		request2.onreadystatechange = function() {
		  	if (request2.readyState == 4) {
		    	NumChilds = document.getElementById("mapitems").childNodes.length;
		    	for(i = 0; i < NumChilds; i++)
					document.getElementById("mapitems").removeChild(document.getElementById("mapitems").firstChild);
		    	var xmlDoc = request2.responseXML;
		    	if (xmlDoc!=null) {
			    	var MetaXml = xmlDoc.documentElement.getElementsByTagName("meta");
				   	Gesamt = parseInt(MetaXml[0].childNodes[0].firstChild.data);			   			
			   		Von = parseInt(MetaXml[0].childNodes[1].firstChild.data) + 1;
			   		Bis = parseInt(MetaXml[0].childNodes[2].firstChild.data);
			   		
			   			
			   		var UsersXml = xmlDoc.documentElement.getElementsByTagName("user");
			    	for (var i = 0; i < UsersXml.length; i++) {
			            UserId = UsersXml[i].childNodes[0].firstChild.data;
			            UserPrename = UsersXml[i].childNodes[4].firstChild.data;
			            UserSurname = UsersXml[i].childNodes[3].firstChild.data;
			            UserFoto = UsersXml[i].childNodes[7].firstChild.data;
			            UserLat = UsersXml[i].childNodes[1].firstChild.data;
			            UserLng = UsersXml[i].childNodes[2].firstChild.data;
						var UserBox = new Element('div', {
						    'styles': {
						        'width': '165px',
						        'height': '20px',
						        'border': '2px solid #fff',
						        'position': 'absolute',
						        'overflow': 'hidden',
						        'left': '0px',
						        'top': parseInt(i * 20) + 'px'
						    },
						    'events': {
						        'mouseover': function(){
						            map.removeOverlay(myHashUserMarkers[this.Index]);map.addOverlay(myHashUserMarkersFocus[this.Index]);
						        },
						        'mouseout': function(){
						            map.removeOverlay(myHashUserMarkersFocus[this.Index]);map.addOverlay(myHashUserMarkers[this.Index]);
						        }
						    }
						  });
						UserBox.Index = UserId;
						$(UserBox).setHTML('<div style="line-height: 18px; cursor: pointer;"><img src="/pics/icon/' + UserFoto + '" border="0" style="margin-right: 4px; vertical-align: middle; width: 16px; height: 16px; margin-top: 1px;"><a href="./person/' + UserId + '">' + UserPrename + ' ' + UserSurname + '</a></div>');
						
						$(UserBox).injectInside('mapitems');
					}
					
					NextLink = '';
			   		PrevLink = '';
			   		if (StartMapItems<=Gesamt-MaxMapItems)
			   		{
			   			NextLink = '<a href="javascript:UpdateUsersList(\'all\','+(StartMapItems+MaxMapItems) + ')">WEITER</a>';
			   		}
			   		
			   		if (StartMapItems > 0)
			   		{
			   			PrevLink = '<a href="javascript:UpdateUsersList(\'all\','+(StartMapItems-MaxMapItems) + ')">ZURÜCK</a>';
			   		}
			   		
			   		
			   		InfoText = MapInfoText.replace('%s', Von + ' - ' + Bis);
			   		InfoText = InfoText.replace('%s', Gesamt);
			   		if (NextLink!=''  || PrevLink!='') 
			   		{
			   			InfoText = InfoText.replace('%s', ', ');
			   		} 
			   		else 
			   		{
			   			InfoText = InfoText.replace('%s', '');
			   		}
			   		InfoText = InfoText.replace('%s', PrevLink + ((NextLink!='' && PrevLink!='')?' | ':''));
			   		InfoText = InfoText.replace('%s', NextLink);
			   		$('mapinfotext').setHTML(InfoText);
				}
				$('MapInfoTextLoading').setStyle('display','none');   	
			}
		}
		
		request2.send(null);
	}
	
	function UpdateLocationsMarkers(which)
	{
		var bounds = map.getBounds();
		
		myHashLocationsMarkers.each(
			function(value, key){ 
				if(!bounds.contains(value.getPoint())) {
		            map.removeOverlay(value);
		            myHashLocationsMarkers.remove(key);
		            myHashLocationsMarkersFocus.remove(key);
		        }
			}
		); 
		

		var request = GXmlHttp.create();
		var southWest = bounds.getSouthWest();
		var northEast = bounds.getNorthEast();
		var getVars = 'ne=' + northEast.toUrlValue()
					+ '&sw=' + southWest.toUrlValue();
		/*GLog.writeUrl('./ajax/getlocationsbybounds.php?'+getVars);*/
		if (which=='all') {
			request.open("GET", "./ajax/getlocationsbybounds.php?"+getVars, true);
		} else if (which=='my') {
			request.open("GET", "./ajax/getmylocationsbybounds.php?"+getVars, true);
		}
		
		request.onreadystatechange = function() {
		  	if (request.readyState == 4) {
		    	var xmlDoc = request.responseXML;	
		    	if (xmlDoc!=null) {
			   		var LocationsXml = xmlDoc.documentElement.getElementsByTagName("location");
	    	
			    	for (var i = 0; i < LocationsXml.length; i++) {
			            LocationId = LocationsXml[i].childNodes[0].firstChild.data;
			            LocationLat = LocationsXml[i].childNodes[1].firstChild.data;
			           	LocationLng = LocationsXml[i].childNodes[2].firstChild.data;
			            LocationName = LocationsXml[i].childNodes[3].firstChild.data;
			            
			            if (!myHashLocationsMarkers.hasKey(LocationId)) {
							myHashLocationsMarkersFocus[LocationId] = new GMarker(new GLatLng(LocationLat, LocationLng), {zIndexProcess:zind, icon:iconFocus, draggable: false, bouncy: false, clickable: false, title: LocationName});
							myHashLocationsMarkers[LocationId] = new GMarker(new GLatLng(LocationLat, LocationLng), {icon:iconNutzer, draggable: false, bouncy: false, clickable: true, title: LocationName});
							myHashLocationsMarkers[LocationId].URL = './location/show/' + LocationId;
							GEvent.addDomListener(myHashLocationsMarkers[LocationId], "click", function() { window.location = this.URL; });
							map.addOverlay(myHashLocationsMarkers[LocationId]);
						}
					}
				}
			}
		}

		request.send(null);
	
		/*} else {
			myHashLocationsMarkers.each(
			function(value, key){ 
	            map.removeOverlay(value);
	            myHashLocationsMarkers.remove(key);
	            myHashLocationsMarkersFocus.remove(key);
				}
			); 
		}*/
	}
	
	function UpdateLocationsList(which, start) 
	{
		var bounds = map.getBounds();
		var start = (start == null) ? 0 : start;
		if (start>=0)
		{
			StartMapItems = start;
		}
		
		var request2 = GXmlHttp.create();
		var southWest = bounds.getSouthWest();
		var northEast = bounds.getNorthEast();
		var getVars2 = 'ne=' + northEast.toUrlValue()
					+ '&sw=' + southWest.toUrlValue()
					+ '&start=' + StartMapItems
					+ '&max=' + MaxMapLocationItems;
		$('MapInfoTextLoading').setStyle('display','inline');
		if (which=='all') 
		{
			request2.open("GET", "./ajax/getlocationsbybounds.php?"+getVars2, true);
		} else if (which=='my') 
		{
			request2.open("GET", "./ajax/getmylocationsbybounds.php?"+getVars2, true);
		}
		
		request2.onreadystatechange = function() {
		  	if (request2.readyState == 4) {
		    	NumChilds = document.getElementById("mapitems").childNodes.length;
		    	for(i = 0; i < NumChilds; i++)
					document.getElementById("mapitems").removeChild(document.getElementById("mapitems").firstChild);
		    	var xmlDoc = request2.responseXML;
		    	if (xmlDoc!=null) {
			    	var MetaXml = xmlDoc.documentElement.getElementsByTagName("meta");
				   	Gesamt = parseInt(MetaXml[0].childNodes[0].firstChild.data);			   			
			   		Von = parseInt(MetaXml[0].childNodes[1].firstChild.data) + 1;
			   		Bis = parseInt(MetaXml[0].childNodes[2].firstChild.data);
			   		
			   			
			   		var LocationsXml = xmlDoc.documentElement.getElementsByTagName("location");
			    	for (var i = 0; i < LocationsXml.length; i++) {
			            LocationId = LocationsXml[i].childNodes[0].firstChild.data;
			            LocationLat = LocationsXml[i].childNodes[1].firstChild.data;
			           	LocationLng = LocationsXml[i].childNodes[2].firstChild.data;
			            LocationName = LocationsXml[i].childNodes[3].firstChild.data;
						var LocationBox = new Element('div', {
						    'styles': {
						        'width': '165px',
						        'height': '18px',
						        'border': '1px solid #fff',
						        'position': 'absolute',
						        'overflow': 'hidden',
						        'left': '0px',
						        'top': parseInt(i * 18) + 'px'
						    },
						    'events': {
						        'mouseover': function(){
						            map.removeOverlay(myHashLocationsMarkers[this.Index]);map.addOverlay(myHashLocationsMarkersFocus[this.Index]);
						        },
						        'mouseout': function(){
						            map.removeOverlay(myHashLocationsMarkersFocus[this.Index]);map.addOverlay(myHashLocationsMarkers[this.Index]);
						        }
						    }
						  });
						LocationBox.Index = LocationId;
						
						edit = '';
						if (which=='my') {
							edit = ' <a href="./location/edit/' + LocationId + '" title="Location bearbeiten"><img src="./img/icon_edit.gif" border="0" alt="Location bearbeiten" style="vertical-align: middle;"></a>';
						}
						
						$(LocationBox).setHTML('<div style="line-height: 20px; cursor: pointer;"><a href="javascript:void(0)" onClick="map.setCenter(new GLatLng(' + LocationLat + ', ' + LocationLng + '), 16);" title="Auf der Karte zeigen"><img src="./img/icon_zoom.gif" border="0" alt="Auf der Karte zeigen" style="vertical-align: middle;"></a>' + edit + ' <a href="./location/show/' + LocationId + '" title="' + LocationName + '" style="margin-left: 3px;">' + LocationName + '</a></div>');
						
						$(LocationBox).injectInside('mapitems');
					}
					
					NextLink = '';
			   		PrevLink = '';
			   		if (StartMapItems<=Gesamt-MaxMapItems)
			   		{
			   			NextLink = '<a href="javascript:UpdateLocationsList(\'all\','+(StartMapItems+MaxMapItems) + ')">WEITER</a>';
			   		}
			   		
			   		if (StartMapItems > 0)
			   		{
			   			PrevLink = '<a href="javascript:UpdateLocationsList(\'all\','+(StartMapItems-MaxMapItems) + ')">ZURÜCK</a>';
			   		}
			   		
			   		
			   		InfoText = MapInfoText2.replace('%s', Von + ' - ' + Bis);
			   		InfoText = InfoText.replace('%s', Gesamt);
			   		if (NextLink!=''  || PrevLink!='') 
			   		{
			   			InfoText = InfoText.replace('%s', ', ');
			   		} 
			   		else 
			   		{
			   			InfoText = InfoText.replace('%s', '');
			   		}
			   		InfoText = InfoText.replace('%s', PrevLink + ((NextLink!='' && PrevLink!='')?' | ':''));
			   		InfoText = InfoText.replace('%s', NextLink);
			   		$('mapinfotext').setHTML(InfoText);
			   	}
				$('MapInfoTextLoading').setStyle('display','none');   	
			}
		}
		
		request2.send(null);
	}
	
	function updateUsersOnMap(which,itemsbrowse) {
		var bounds = map.getBounds();
		
		if (!itemsbrowse)
		{
			UpdateUsersMarkers(which);
		}
		UpdateUsersList(which);

	}
	
	function updateLocationsOnMap(which,itemsbrowse) {
		var bounds = map.getBounds();
		
		if (!itemsbrowse)
		{
			UpdateLocationsMarkers(which);
		}
		UpdateLocationsList(which);

	}
	
	
	function storeMarker() {
		var lng = document.getElementById("longitude").value;
		var lat = document.getElementById("latitude").value;
		
		var getVars = "name=" + document.getElementById("f_name").value
			+ "&beschreibung=" + document.getElementById("f_beschreibung").value
			+ "&freigabe=" + document.getElementById("f_freigabe").value
			+ "&tags=" + document.getElementById("f_tags").value
			+ "&lng=" + lng
			+ "&lat=" + lat;
			
		new Ajax("./ajax/storelocation.php", {
			method: 'post',
			postBody: getVars, 
			evalScripts: true
		}).request();
		return false;
	}
	
	function storeEditMarker(id) {
		var error = false;
		var lng = document.getElementById("f_lng").value;
		var lat = document.getElementById("f_lat").value;
		
		var getVars = "name=" + document.getElementById("f_name_" + id).value
			+ "&beschreibung=" + document.getElementById("f_beschreibung_" + id).value
			+ "&freigabe=" + document.getElementById("f_freigabe_" + id).value
			+ "&tags=" + document.getElementById("f_tags_" + id).value
			+ "&lng=" + lng
			+ "&lat=" + lat
			+ "&id=" + id;	

		new Ajax("./ajax/storeeditlocation.php", {
			method: 'post',
			postBody: getVars, 
			onComplete: function() {
				$('loc_' + id).innerHTML = '<div style="float: left; width: 80%"><b>'+htmlspecialchars(document.getElementById("f_name_" + id).value)+'</b></div>'
												+'<div style="float: right; width: 17%; text-align: right;">'
												+'<div id="spinner_'+id+'" style="line-height: 13px; float: left;"></div>'
												+'<div class="EditBackLeft" style="float: right;">'
												+'<div class="EditBackRight white">'
												+'		<a href="javascript: getLocationEditPanel('+id+')">bearbeiten</a>'
												+'</div>'
												+'</div>'
												+'<div class="clear"></div>'
												+'</div>'
												+'<div class="clear"></div>'
												+'<div>'+htmlspecialchars(document.getElementById("f_beschreibung_" + id).value)+'</div>';
				var fx = new Fx.Style($('loc_' + id), 'background-color', {
						duration: 1000,
						transition: Fx.Transitions.Quad.easeOut
					}).start('#666', '#fff');
			}
		}).request();
		return false;
	}
    
    
