This is the js code I use on one of my sites. I'm sure you can put the right stuff in yours.
var _map;
var _marker;
var _mapObject = document.getElementById("googlemap");
var _customIcon;
var gMarkers = [];
function addItem(pLat, pLong, pTitle) {
if (_mapObject == null)
return;
if (_map == null) {
_map = new GMap2(_mapObject);
_map.setCenter(new GLatLng(51.175011,6.020207), 8);
_map.addControl(new GLargeMapControl());
_map.addControl(new GMapTypeControl());
_map.addMapType(G_PHYSICAL_MAP);
_map.setMapType(G_PHYSICAL_MAP);
_map.checkResize();
}
if (_customIcon == null) {
_customIcon = new GIcon(G_DEFAULT_ICON);
_customIcon.image = "/images/flag_icon.png";
_customIcon.iconSize = new GSize(16, 16);
_customIcon.iconAnchor = new GPoint(3, 15);
_customIcon.shadow = null;
_customIcon.shadowSize = null;
}
point = new GLatLng(pLat, pLong);
markerOptions = { icon: _customIcon, title: pTitle };
_marker = new GMarker(point, markerOptions);
_map.addOverlay(_marker);
gMarkers.push(_marker);
} pritaeas
Posting Expert
Moderator
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875