var map;

var image = new google.maps.MarkerImage('http://labs.google.com/ridefinder/images/mm_20_yellow.png',
	      // This marker is 20 pixels wide by 32 pixels tall.
	      new google.maps.Size(12, 20),
	      // The origin for this image is 0,0.
	      new google.maps.Point(0,0),
	      // The anchor for this image is the base of the flagpole at 0,32.
	      new google.maps.Point(6, 20));


var geocoder = new google.maps.Geocoder();

function initMap(id, point) {
	var myOptions = {
		zoom :8,
		center :point,
		mapTypeId :google.maps.MapTypeId.HYBRID
	};
	map = new google.maps.Map(document.getElementById(id), myOptions);
	return map;
}

// Create a marker whose info window displays the given number.
function createCenterMarker(point, html) {
	var marker = new google.maps.Marker( {
		position :point,
		map :map
	});
	// Show this marker's info window when it is clicked.
	var infowindow = new google.maps.InfoWindow( {
		content :html
	});
	google.maps.event.addListener(marker, 'click', function() {
		infowindow.open(map, marker);
	});
	return marker;
}

function createInfoMarker(point, number) {
	var marker = new google.maps.Marker( {
		position :point,
		map :map,
		icon :image
	});
	return marker;
}

function createMarkerFromPoint(point, markup) {
	var marker = new google.maps.Marker( {
		position :point,
		map :map,
		icon :image
	});
	var infowindow = new google.maps.InfoWindow( {
		content :markup
	});
	google.maps.event.addListener(marker, 'click', function() {
		infowindow.open(map, marker);
	});
	return marker;
}

function createMarker(address, markup) {

    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var marker = new google.maps.Marker({
            map: map, 
            position: results[0].geometry.location
        });
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });
	
}

