//<![CDATA[

/*
 * Amsterdam: (52.373811, 4.890951)
 */

var POINTER = 'http://localhost/1024pzn/images/icons/mapPointer.gif';
var MAX_ZOOM = 14;

/* global variables */
var map;

/**
 * Loads a map in a div with id 'map'
 */
function load(initLocation, divName, control) 
{
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById(divName));
		if(control)
			map.addControl(new GSmallMapControl());
		map.setCenter(initLocation, 10);
	}
	else {
		alert("Helaas is de Google Maps API niet compatible met jouw browser");
	}
}

/**
 * Puts a marker on the specific point.
 */
function addMarker(point, html, iconImage, w, h)
{
	var marker = makeMarker(point, iconImage, w, h);
	
	GEvent.addListener(marker, "click", 
        function()
        {
            marker.openInfoWindowHtml(html);
        }
	);
	
	map.addOverlay(marker);
}

/**
 * Makes a marker at the specified point.
 */
function makeMarker(point, iconImage, w, h)
{        
	var icon = new GIcon();
	
	if(iconImage)
		icon.image = iconImage;
	else
		icon.image = POINTER_ICON;
		
		
	icon.iconSize = new GSize(w, h);
	icon.iconAnchor = new GPoint(1, 1);
	icon.infoWindowAnchor = new GPoint(parseInt(0.75 * w), 1);
	
    return new GMarker(point, icon);
}
	
//]]>
