	
	function createIcon(imageUrl, shadowUrl, width, height, shadowWidth, shadowHeight)
	{
		var icon = new google.maps.Icon();
		
		icon.image = imageUrl;
		icon.shadow = shadowUrl;
		icon.iconSize = new google.maps.Size(width, height);
		icon.shadowSize = new google.maps.Size(shadowWidth, shadowHeight);
		icon.iconAnchor = new google.maps.Point(Math.floor(width/2), height);
		icon.infoWindowAnchor = new google.maps.Point(0, 5);
		
		return icon;
	}
	
	// function to create google map marker with text
	function createMarker(point, text, icon)
	{
		var marker
		
		if(icon) { marker = new google.maps.Marker(point, icon); }
		else { marker = new google.maps.Marker(point); }
		
		if(text)
		{
			text = text.replace(/&lt;/g, '<');
			text = text.replace(/&gt;/g, '>');
			google.maps.Event.addListener(marker, "click", function() {marker.openInfoWindowHtml(text);});
		}
		
		return marker;
	}

	function drawMap(htmlElementId, type, xPos, yPos, zoomLevel, points, controls)
	{
		var map = new google.maps.Map2(document.getElementById(htmlElementId));
		map.setCenter(new google.maps.LatLng(xPos, yPos), zoomLevel);
		map.setMapType(type); // G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP - must go after map.setCenter()
		
		// add controls
		for(i=0; i<controls.length; i++)
		{
			switch(controls[i])
			{
				case 'OverviewMapControl': map.addControl(new google.maps.OverviewMapControl()); break;
				case 'LargeMapControl': map.addControl(new google.maps.LargeMapControl()); break;
				case 'MapTypeControl': map.addControl(new google.maps.MapTypeControl()); break;
				case 'ScaleControl': map.addControl(new google.maps.ScaleControl()); break;
			}
		}
		
		var thisPoint, mapPoint, myIcon, marker, markerOptions;
		
		for(i=0; i<points.length; i++)
		{
			thisPoint = points[i];
			mapPoint = new google.maps.LatLng(thisPoint[0], thisPoint[1]);
			
			if(thisPoint[3])
			{
				myIcon = createIcon(thisPoint[3], thisPoint[4], thisPoint[5], thisPoint[6], thisPoint[7], thisPoint[8]);
			}
			else
			{
				myIcon = G_DEFAULT_ICON;
			}

			var markerOptions = { icon:myIcon };
			marker = createMarker(mapPoint, thisPoint[2], markerOptions);
			map.addOverlay(marker);
		}
	}