var iconRed = new GIcon(); 
iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconRed.iconSize = new GSize(12, 20);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);
	
var customIcons = [];
customIcons["house"] = iconRed;

var map;
var geocoder = new GClientGeocoder();
var estateMarker;

function showPoint() {
	var point = estateMarker.getLatLng();
	alert("coords: " + point.lat() + ", " + point.lng());
}
		
function showOnMap() {
  var address = document.getElementById("myCity").value.toString();
  geocoder.getLatLng(
    address,
    function(point) {
      if (!point) {
        alert(address + " not found");
      } else {
		        
		map.setCenter(point, 5);
							
		if(estateMarker != null) {
			estateMarker.setPoint(point);
		} else {
			estateMarker = new GMarker(point, {draggable: true});
			map.addOverlay(estateMarker);					
		}
      }
    }
  );
}

function createMarker(point) {
	var marker = new GMarker(point, {draggable: true});
	//var html = "<b>" + name + "</b> <br/>" + address;
	//GEvent.addListener(marker, 'click', function() {
	//marker.openInfoWindowHtml(html);
	//});
	return marker;
}

function saveMapStateAndPost() {
	document.getElementById("mapZoom").value = map.getZoom();
	document.getElementById("mapLat").value = map.getCenter().lat();
	document.getElementById("mapLng").value = map.getCenter().lng();
	document.getElementById("gmpLat").value = estateMarker.getLatLng().lat();
	document.getElementById("gmpLng").value = estateMarker.getLatLng().lng();
	frm.submit();
}

