// JavaScript Document

function setupMap(mapCenterLocation, markerLocation, markerTitle, markerInfoContentsURL,zoomLevel){
		
	// Setup the map								
	var myOptions = {
		zoom: zoomLevel,
		center: mapCenterLocation,
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};
				
	// Render map
	var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	
	// Baloon Window				
	var infowindow = new google.maps.InfoWindow({ 
		content: '<iframe src ="' +  markerInfoContentsURL + '" width="220" height="120" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto"></iframe>',
		size: new google.maps.Size(220,120)
	});

/*				
	// Define the custom marker.
	var markerImage = new google.maps.MarkerImage('/images/map-markers/marker.png',
		// Marker demensions (px)
		// google.maps.Size(width, height), 
		new google.maps.Size(122, 96),
		
		// Marker origin.  Will be 0,0 unless using a sprite.  0,0 is the top left corner.(px)
		// google.maps.Point(x,y),
		new google.maps.Point(0,0),
		
		// The anchor for this image, based on origin. 0,0 is the top left corner. If the icon was a "V" the anchor would be (width/2, height). (px)
		// google.maps.Point(x,y)
		new google.maps.Point(61, 96)
	);
					
	// Define the shadow.  Search for "Google Maps Shadow" for an online shadow generator.
	var shadow = new google.maps.MarkerImage('/images/map-markers/marker-shaddow.png',
		// Marker shadow demensions (px)
		// google.maps.Size(width, height), 		
		new google.maps.Size(171, 96),
		
		// Marker shadow origin.  Will be 0,0 unless using a sprite. 0,0 is the top left corner. (px)
		// google.maps.Point(x,y),
		new google.maps.Point(0,0),
		
		// The anchor for this image, based on origin. 0,0 is the top left corner. (px)
		// google.maps.Point(x,y)
		new google.maps.Point(61, 96)
	);

	// Shapes define the clickable region of the icon. The type defines an HTML <area> element 'poly' which
	// traces out a polygon as a series of X,Y points. The final coordinate closes the poly by connecting to
	// the first coordinate.
	var shape = {
		coord: [1,3,67,3,67,82,48,82,35,96,22,82,1,82],
		type: 'poly'
	};
	
	var marker = new google.maps.Marker({
		position: markerLocation,
		map: map,
		shadow: shadow,
		icon: markerImage,
		shape: shape,
		title: markerTitle
	});
*/

	var marker = new google.maps.Marker({
		position: markerLocation,
		map: map,		
		title: markerTitle
	});

	google.maps.event.addListener(marker, 'click', function() {infowindow.open(map,marker);});
				
	infowindow.open(map,marker);
}
