Danny159 14 Junior Poster in Training

Hey Guys,

I have the following script... I also have a drop down list of all Towns and Cities in the UK...

When a user changes the location I need the google map marker to love to that city... but allow the user to move the marker and show the Long and Lat... (as it does now except doesn't move the marker to the correct city...)

Can anyone help me, I hope you understand...

<script type="text/javascript">
if (GBrowserIsCompatible()) 
{
	var map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());        
	map.addControl(new GMapTypeControl());
	
	if ("52.6710996412" == "" || "-0.734281569922" == "")
	{
		var geocoder = new GClientGeocoder();

		geocoder.getLatLng('"Town", "United Kingdom"',	
			function(point) {
				if (!point) {
					alert(address + " not found");
				} 
				else {	
					
					map.setCenter(point, 12);
					var marker = new GMarker(point, {draggable: true});
					map.addOverlay(marker);
					
					
					GEvent.addListener(marker, "dragend", function() {
						var point = marker.getPoint();
						map.panTo(point);
						document.getElementById("latitude").value = point.lat();
						document.getElementById("longitude").value = point.lng();
					});
			}
			});
	}

	else
	{
	var centrePoint = new GLatLng('52.6710955412', '-0.734399169922');
	map.setCenter(centrePoint, 6);
		
	var marker = new GMarker(centrePoint, {draggable: true});
	map.addOverlay(marker);
		
	GEvent.addListener(marker, "dragend", function() {
		var point = marker.getPoint();
		map.panTo(point);
		document.getElementById("latitude").value = point.lat();
		document.getElementById("longitude").value = point.lng();
        });
		
	document.getElementById("latitude").value = '52.67104655412';
	document.getElementById("longitude").value = '-0.734281539';
	
	}		
}
</script>