
		$(document).ready(function(){ //Start script when ready
			if (document.getElementById("map_canvas")) {//Checks to see that the page element exists and to prevent conflict with other maps
/*				var markers = new Array();
                markers[0] = new Array(new GMarker(new GLatLng( 16.278818, -61.800848)),"Deshaies", "<strong>Hotel Colibr&igrave;</strong><img src='images/hoteldeguadalupe/piscina-t-sucrier.png' width='100' height='50'/><br/>Some information<br />Can go here<br />01234 567 890<br /><a href='http://www.affitto-caraibi.it/new/hotelgp.php#Hotel_Colibri'>Hotel Colibr&igrave;</a>");
*/				
				var markers = new Array();
                markers[0] = new Array(new GMarker(new GLatLng( 16.278818, -61.800848)),"Deshaies", "<strong>Hotel Colibr&igrave;</strong><img src='images/hoteldeguadalupe/piscina-t-sucrier.png' width='100' height='50'/><br /><a href='hotelgp.php#Hotel_Colibri'>Hotel Colibr&igrave;</a>");
                markers[1] = new Array(new GMarker(new GLatLng( 16.305478, -61.791683)), "Deshaies", "<strong>Hotel Raggio Verde</strong><img src='images/hoteldeguadalupe/vista-su-pisina.png' width='100' height='50'/><br /><a href='hotelgp.php#Hotel_RaggioVerde'>Hotel Raggio Verde</a>");
                markers[2] = new Array(new GMarker(new GLatLng( 16.246171, -61.295887)), "St. Francois", "<strong>Hotel Royal</strong><img src='images/hoteldeguadalupe/hotel-amaudo.png' width='100' height='50'/><br /><a href='hotelgp.php#Hotel_Royal'>Hotel Royal</a>");
				
                markers[3] = new Array(new GMarker(new GLatLng( 15.890150, -61.224194)), "Capesterre (Marie galante)", "<strong>Hotel Mare Blu</strong><img src='images/hotel/mareblu4.jpg' width='100' height='50'/><br /><a href='hotel.php#Hotel_MareBlu'>Hotel Mare Blu</a>");
                markers[4] = new Array(new GMarker(new GLatLng( 15.870349, -61.274328)), "Pointe de Basse (Marie Galante)", "<strong>Hotel Due Palme</strong><img src='images/hotel/jacuzzi-gran-palm.png' width='100' height='50'/><br /><a href='hotel.php#Hotel_DuePalme'>Hotel Due Palme</a>");
                markers[5] = new Array(new GMarker(new GLatLng( 15.997659, -61.290103)), "Pointe Menard (Marie Galante)", "<strong>Hotel Carole</strong><img src='images/hotel/carole2.jpg' width='100' height='50'/><br /><a href='hotel.php#Hotel_Carole'>Hotel Carole</a>");

				var map = new google.maps.Map2($("#map_canvas").get(0));
				map.setCenter(new GLatLng(markers[0][0]), 9);//Set location to first array item
//				map.disableDoubleClickZoom();//Disable zooming
//				var extLargeMapControl = new ExtLargeMapControl();
//        		map.addControl(extLargeMapControl);


				//This section works fine but does not animate on load
				/*
				$(markers).each(function(i,marker){
				   map.addOverlay(marker[0]);
					$("<li />")
						.html(markers[i][1])//Use list item label from array
						.click(function(){
							displayPoint(marker[0], i);
							setActive(this);//Show active state
							if ($('#map_message').is(':hidden')) {//Allow toggling of active state
								setActive();
							}
						})
						.appendTo("#map_list");
					
				    GEvent.addListener(marker[0], "click", function(){
						displayPoint(marker[0], i);
					    setActive(i);//Show active location
						if ($('#map_message').is(':hidden')) {//Allow toggling of active state
							setActive();
						}
					});
				});
				*/
				
				$.each(markers,function(i,marker){
					var delayTime = ((i * 3500) / (0.5 * markers.length));//Delay time decreases as number of markers increases
				
					setTimeout(function(){ 
						map.addOverlay(marker[0]);
						$("<li />")
							.html(markers[i][1])//Use list item label from array
							.click(function(){
								displayPoint(marker[0], i);
								setActive(this);//Show active state
							})
							.appendTo("#map_list");
					
						GEvent.addListener(marker[0], "click", function(){
							displayPoint(marker[0], i);
							setActive(i);//Show active location
						});
						
						displayPoint(marker[0], i);
						setActive(i);//Show active location
						if (i == (markers.length - 1)) {//If last item in array
							setTimeout(function(){//Remove active class and fade marker after delay
								$("#map_message").fadeOut();
								//setActive();
							}, 3500);
						}
					}, delayTime); 
				});
				
				$("#map_list").css("opacity","0.2").animate({opacity: 1}, 1100);//Fade in menu
				$("#map_message").appendTo(map.getPane(G_MAP_FLOAT_SHADOW_PANE));
								
				function displayPoint(marker, index){
					if ($('#map_message').is(':hidden')) {//Allow toggling of markers
						$('#map_message').fadeIn();
					}
					else{//Remove all .active classes and hide markers
						$('#map_message').hide();
						$(".active").removeClass();
					}
					//$("#map_message").hide();//Default behaviour, doesn't allow toggling
					
					var moveEnd = GEvent.addListener(map, "moveend", function(){
						var markerOffset = map.fromLatLngToDivPixel(marker.getLatLng());
						$("#map_message")
							.html(markers[index][2])//Use information from array
							.fadeIn()
							.css({ top:markerOffset.y, left:markerOffset.x });
					GEvent.removeListener(moveEnd);
					});
					map.panTo(marker.getLatLng());
				}	
				
				function setActive(el){
					$(".active").removeClass();//Remove all .active classes
					$("#map_list").find('li').eq(el).addClass('active');//Find list element equal to index number and set active
					$(el).addClass('active');//Set active if list element clicked directly
				}
			}//End if map_canvas exists
		}); //End onReady


