function GMapsInitialize() {
	
  if (GBrowserIsCompatible()) {
  	GMimgPath = '/media/site/images/front-end/attendees/googlemap/';
  
    var map = new GMap2(document.getElementById("map-canvas"));
    map.setCenter(new GLatLng(54.807503, -4.493175), 5);
    
     //prevent dragging
    map.disableDragging();
    //disable zooming
    map.disableDoubleClickZoom();
    
    //set background colour
    map.backgroundColor = 'White';
    
    //create custom map
    var copyright = new GCopyright(1,
	   new GLatLngBounds(new GLatLng(-90, -180),
						 new GLatLng(90, 180)),
	   0,
	   "copyright 2008");
    
    var copyCol = new GCopyrightCollection('The Do Lectures');
    copyCol.addCopyright(copyright);
    
    var tileLayers = [new GTileLayer(copyCol, 1, 5)];
    tileLayers[0].getTileUrl = getTiles;
    
    var customMap = new GMapType(tileLayers, new GMercatorProjection(6), "OurMap", {errorMessage:"No data available"});
    
    map.addMapType(customMap);
    map.setMapType(customMap);
    
    //create custom icon
    var basePin = new GIcon();
    basePin.iconSize = new GSize(18, 20);
    basePin.iconAnchor = new GPoint(8, 20);
    basePin.infoWindowAnchor = new GPoint(8, 2);
    
    var blackPin = new GIcon(basePin, GMimgPath+'pin-black.gif');
    var markerOptions = {icon: blackPin};
    
    //add a pointer for The Do Lectures
    var lecturesPin = new GIcon();
    lecturesPin.iconSize = new GSize(101, 62);
    lecturesPin.iconAnchor = new GPoint(101, 0);
    
    var dolecturesPin = new GIcon(lecturesPin, GMimgPath+'pin-thedolectures.gif');
    var dolecturesOptions = {icon: dolecturesPin, id: 'home'};
    var thedolectures = new GMarker(new GLatLng(52.08288179572668, -4.658374786376953), dolecturesOptions);
    map.addOverlay(thedolectures);
    GEvent.addListener(thedolectures, 'click', function(){
        window.location = '/about-do/';
    });
    
    
    if(typeof attendeesJSON != 'undefined'){
    	    	
    	markers = new Array();
    		
    	for(key in attendeesJSON){
    		var coOrds = attendeesJSON[key].split(',');
    		var lat = parseFloat(coOrds[0]);
    		var long = parseFloat(coOrds[1]);
    		
    		markers[key] = new GMarker(new GLatLng(lat, long), markerOptions);
    		markers[key].name = key;
    		
    		map.addOverlay(markers[key]);
    		
    		GEvent.addListener(markers[key], 'click', function(){
        		window.location = this.name;
        	});
        	
        	if(typeof currentAttendee != 'undefined') {
        		if(currentAttendee == key)
        			markers[key].setImage(GMimgPath+'pin-orange.gif');
        	}
    	}
    	
    	function unsetAllMarkers(){
      		for(key in markers){	
				markers[key].setImage(GMimgPath+'pin-black.gif');
			}
    	}
    	
    }
    
    
  }
}



function getTiles(a, b){
  //if not a valid tile, return the 1x1px white gif.
  if((a.x>=14 && a.x<=16) && (a.y>=9 && a.y<=10)){
    return GMimgPath+"tile_"+a.x+"_"+a.y+".gif";
  } else {
    return GMimgPath+"blank.gif";
  }
}