var map;
var geocoder;
var gmarker;
var markers = new Array();

function initialize() {
	var latlng = new google.maps.LatLng(0, 0);
	var myOptions = {
		zoom: 7,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
	map = new google.maps.Map(document.getElementById("map"), myOptions);

	geocoder = new google.maps.Geocoder();
}

function showAddress(address, key, id, count) {
	if (geocoder) {
		geocoder.geocode( {'address': address}, function(results, status) {
			if (status == google.maps.GeocoderStatus.OK) {
				map.setCenter(results[0].geometry.location);
				map.setZoom(16);

				var marker = new google.maps.Marker({
					map: map,
					position: results[0].geometry.location
				});

				markers[key] = marker;
			}
		});
	}
}

function clearMarkers()
{
	$.each(markers, function(key, value) {
		value.setMap(null);
	});
}
