/* set up blue marker */
var blueIcon = new GIcon(G_DEFAULT_ICON, "../images/blue-dot.png");
blueIcon.iconSize = new GSize(34, 36);
markerOptions = { icon:blueIcon };

/* Create marker */
function addMarker(latitude, longitude, description) {
	var point = new GLatLng(latitude, longitude);
	var marker = new GMarker(point, markerOptions); 

	GEvent.addListener(marker, 'click', 
		function() { 
			marker.openInfoWindowHtml(description); 
		} 
	); 

	map.addOverlay(marker); 
} 

/* Setup map and create first marker for HQ */
function init() { 
	if (GBrowserIsCompatible()) {
		setTimeout(function() { 
		/*map = new GMap2(document.getElementById("mapdiv"), {mapTypes: [G_HYBRID_MAP]});*/
		
		map = new GMap2(document.getElementById("map"), {mapTypes: [G_HYBRID_MAP]}, {size: new GSize(1024, 500)});
				
		var center = new GLatLng(centerLatitude, centerLongitude); 
		map.setCenter(center, startZoom);
		map.setUIToDefault();
		
		var phx = new GLatLng(33.4488,-112.0742);
		var hq = new GMarker(phx);
		map.addOverlay(hq);

		GEvent.addListener(hq, "click", function() {
			html = "<img src='../images/flags/48x24/USA.gif' /><p class='popup'>Crete Colors International, LLC</p>"
			hq.openInfoWindowHtml(html, {maxWidth: 300});
		});
	
		for(id in markers) { 
			addMarker(markers[id].latitude, markers[id].longitude, markers[id].name); 
		}
		
		}, .3); 
	} 
} 

window.onload = init;
window.onunload = GUnload; 

