var map = null;
var geocoder = null;

function loadEmpty() {
  if (GBrowserIsCompatible()) {
	
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.setCenter(new GLatLng(55.378051, -3.435973), 5);
	geocoder = new GClientGeocoder();
  }
}

function showAddress() {
  if (geocoder) {
	var address = document.getElementById('geoText').value;
	geocoder.getLatLng(
	  address,
	  function(point) {
		if (!point) {
		  alert(address + " not found");
		} else {
		  map.setCenter(point, 13);
		  var marker = new GMarker(point);
		  map.addOverlay(marker);
		  marker.openInfoWindowHtml(address);
		  
		  $('#locationId').val(point);
		  
		}
	  }
	);
  }
}

function createMarker(point,html) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {
	  marker.openInfoWindowHtml(html);
	});
	return marker;
 }