
/**
* Centers the map
*/
function center_map(map, lat, lng, zoom) {
	
	var center_pos = new GLatLng(lat, lng);
	map.setCenter(center_pos, zoom);
	
}



/**
* Creates a map marker
*/
function create_marker(map, lat, lng, html, icon) {
	
	// Set the marker icon
	var marker_icon = new GIcon(G_DEFAULT_ICON);
	
	if (icon['icon'] && icon['icon_shadow']) {
		
		marker_icon.iconSize = new GSize(icon['width'], icon['height']);
		marker_icon.shadowSize = new GSize(icon['width'], icon['height']);
		marker_icon.iconAnchor = new GPoint(icon['center_x'], icon['center_y']);
		
		marker_icon.image = icon['icon'];
		marker_icon.shadow = icon['icon_shadow'];
		
	}
	
	marker_options = { icon:marker_icon };
	
	// Set the marker
	var point = new GLatLng(lat, lng);
	var marker = new GMarker(point, marker_options);
	map.addOverlay(marker);
	
	// The info window version with the "to here" form open
	html += '<p><b>Directions</b></p>'+
		'<form action="http://maps.google.com/maps" method="get" target="_blank">'+
		'<div style="float: left; width: 90px;">From Here:</div> <input type="text" size=15 maxlength=40 name="daddr" id="daddr" value="" /><br>' +
		'<div style="float: left; width: 90px;">To Here:</div> <input type="text" size="15" maxlength="40" name="saddr" id="saddr" value="" /><br>' +
		'<p><input type="submit" value="Get Directions"><p>' +
		'</form>';
	
	// Info Window
	marker.openInfoWindowHtml(html);
	
	// Listener for info window
	GEvent.addListener(marker, "click", function() {
		
		marker.openInfoWindowHtml(html);
		
	});
	
	return marker;
	
}
