// Creates a marker whose info window displays the letter corresponding
// to the given index.
function createMarker(point, index, text, baseIcon) {
  	var icon = new GIcon(baseIcon);
  	icon.image = "http://www.google.com/mapfiles/marker.png";
  	var marker = new GMarker(point, icon);
  	GEvent.addListener(marker, "mouseover", function() {
		marker.openInfoWindowHtml(text);
	});
	return marker;
}

function initialize() {
    if (GBrowserIsCompatible()){
	    
        var baseIcon = new GIcon();
        baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);
        baseIcon.infoShadowAnchor = new GPoint(18, 25);  
	      
        var map = new GMap2(document.getElementById("google_map"));
        var myGeographicCoordinates = new GLatLng(51.4535,-2.5932);
        map.setCenter(myGeographicCoordinates,13);
        map.setMapType(G_NORMAL_MAP);
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        

        for (e in getArrayGIcons()){
			map.addOverlay(createMarker(
			    getArrayGIcons()[e][0]
			   ,parseInt(e)
			   ,getArrayGIcons()[e][1]
			   ,baseIcon)
			);
		}
    }

    function getArrayGIcons(){
	    var GIcons = new Array();
	     GIcons[0] = new Array();
         GIcons[0][0] = new GLatLng(51.4535,-2.5932);
         GIcons[0][1] = '<div class="google_location_icon"><h2>siftgroups</h2><p>Bridge House<br />48-52 Baldwin Street<br />Bristol<br />BS1 1QB</p><p>+44 (0)117 9159600</p></div>';
		return GIcons;
	}
}
