// JavaScript Document
				
		var geocoder = new GClientGeocoder();
		function displayPoint(map, markers, 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('<div class="xbtn"></div>' + markers[index][0])//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
		}
		
		function configureOverlays($this, map, markers, mark, i, delayTime)
		{
			//setTimeout(function(){ 
				map.addOverlay(mark);
		/*==========================================================
						configureOverlays-List Setup
		==========================================================*/
		
				//Declared variables of the array. Label:property name, Statelabel:State
				var label = markers[i][1];
				var stateLabel = markers[i][3];
				
				//var orderingByState = typeof(markers[i][2]);
					
					//if(orderingByState == "object")
					//{
						// Populate state using variable
						
						// hide blank entrie function
						if(stateLabel == ""){
							$("<li />")
							.html(stateLabel)//Use list item label from array
							.css({'display' : 'none'})
							.appendTo("#map_list");
						}
						else
						{
							$("<li />")
								.html(stateLabel)//Use list item label from array
								.css({ 'color' : '#3b73a9', 'background' : '#f5f5f5', 'font-weight' : 'bold', 'cursor' : 'default', 'display' : 'block', 'width' : '510px'})
								.appendTo("#map_list");	
						}
						
						// Populate property using variables
						$("<li />")
							.html(label)//Use list item label from array
							.css({ 'width' : '162px', 'padding-bottom' : '10px' , 'padding-top' : '10px'})
							.click(function(){
								displayPoint(map, markers, mark, i);
								setActive(this);//Show active state
								
							})
						.appendTo("#map_list");
					//}
					//else
					//{
						//alert('The city of ');
											 
					//}
				
						
											 
					
					
		/* ======================================================== 
					//configureOverlays-Overlay Events
		   ========================================================	*/		
			
				GEvent.addListener(mark, "click", function(){
					displayPoint(map, markers, mark, i);
					setActive(i);//Show active location
				});
				
				displayPoint(map, markers, mark, 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(3500);
						//setActive();
					//}, 3500);
				}
			//}, delayTime); 		
		}
		$(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
				
				//Default map center location
				var defaultLat = 39.57182223734374;
				var defaultLon = -100.01953125;
				
				var markers = new Array();

markers[0] = ["<strong>Heavenly Inn</strong><br/>930 Park Avenue South Lake Tahoe, CA 96150 <br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/HeavenlyInn.aspx\">View Property</a>", "Heavenly Inn", (new GMarker(new GLatLng(38.9563,-119.947364))),"California"];
markers[1] = ["<strong>Secrets Inn</strong><br/>924 Park Avenue South Lake Tahoe, CA 96150 <br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/SecretsInn.aspx\">View Property</a>", "Secrets Inn", (new GMarker(new GLatLng(38.956462,-119.947734))),""];
markers[2] = ["<strong>Tuscany Manor</strong><br/>350 W Chino Canyon Road, Palm Springs, California, United States, 92262 <br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/TuscanyManor.aspx\">View Property</a>", "Tuscany Manor", (new GMarker(new GLatLng(33.84626,-116.550272))),""];
markers[3] = ["<strong>Eagles's Nest</strong><br/>472 Needle Peak Rd., Stateline, Nevada, 89449<br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/EaglesNest.aspx\">View Property</a>", "Eagles's Nest", (new GMarker(new GLatLng(38.9596422,-119.8900412))),"Nevada"];
markers[4] = ["<strong>Tahoe Summit Village</strong><br/>750 Wells Fargo Lane, Stateline, Nevada, United States, 89449 <br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/TahoeSummitVillage.aspx\">View Property</a>", "Tahoe Summit Village", (new GMarker(new GLatLng(38.9624079,-119.9399029))),""];
markers[5] = ["<strong>Tahoe Village</strong><br/>472 Needle Peak Rd., Stateline, Nevada, United States, 89449 <br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/TahoeVillage.aspx\">View Property</a>", "Tahoe Village", (new GMarker(new GLatLng(38.9596418,-119.8900465))),""];
markers[6] = ["<strong>Residence Inn</strong><br/>5875 Dean Martin Dr., Las Vegas, NV 89118 <br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/ResidenceInn.aspx\">View Property</a>", "Residence Inn", (new GMarker(new GLatLng(36.083005,-115.182641))),""];

//markers[7] = ["<strong>Plaza Resort Club</strong><br/>121 West Street, Reno, Nevada, United States, 89501 <br/><a href=\"/Properties/PropertiesbyRegion/WesternUS/PlazaResortClub.aspx\">View Property</a>", "Plaza Resort Club", (new GMarker(new GLatLng(39.5254421,-119.8156311))),""];

markers[7] = [];

markers[8] = ["<strong>900 Ocean Avenue</strong><br/>900 Ocean Avenue, Ocean City, New Jersey, United States, 08226 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/900OceanAvenue.aspx\">View Property</a>", "900 Ocean Avenue", (new GMarker(new GLatLng(39.2770748,-74.5739474))),"New Jersey"];
markers[9] = ["<strong>Flagship</strong><br/>831 Atlantic Avenue, Ocean City, New Jersey, United States, 08203 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/Flagship.aspx\">View Property</a>", "Flagship", (new GMarker(new GLatLng(39.276769,-74.5725724))),""];
markers[10] = ["<strong>Oceanside</strong><br/>875 Plymouth Place, Ocean City, New Jersey, United States, 08262 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/Oceanside.aspx\">View Property</a>", "Oceanside", (new GMarker(new GLatLng(39.2766263,-74.5688116))),""];
markers[11] = ["<strong>Santa Barbara North</strong><br/>1008 Wesley Avenue, Ocean City, New Jersey, United States, 08226 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/SantaBarbaraNorth.aspx\">View Property</a>", "Santa Barbara North", (new GMarker(new GLatLng(39.2763052,-74.5766508))),""];
markers[12] = ["<strong>Santa Barbara South</strong><br/>1008 Wesley Avenue, Ocean City, New Jersey, United States, 08226 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/SantaBarbaraSouth.aspx\">View Property</a>", "Santa Barbara South", (new GMarker(new GLatLng(39.2763052,-74.5766508))),""];
markers[13] = ["<strong>Seascape Condominiums</strong><br/>701 ATLANTIC AVENUE, OCEAN CITY, New Jersey, United States, 08226 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/SeascapeCondominiums.aspx\">View Property</a>", "Seascape Condominiums", (new GMarker(new GLatLng(39.2785872,-74.5702754))),""];
markers[14] = ["<strong>Bayberrry Condominiums</strong><br/>164 40th St South, Brigantine, New Jersey, United States, 08203-3359 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/BayberrryCondominiums.aspx\">View Property</a>", "Bayberrry Condominiums", (new GMarker(new GLatLng(39.392825,-74.393016))),""];
markers[15] = ["<strong>Brigantine Beach Club</strong><br/>4500 W Brigantine Ave , Brigantine Beach , New Jersey, United States, 08203 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/BrigantineBeachClub.aspx\">View Property</a>", "Brigantine Beach Club", (new GMarker(new GLatLng(39.392994,-74.397359))),""];
markers[16] = ["<strong>Brigantine Island Beach Resort</strong><br/>4500 W. Brigantine Ave, Brigantine Beach, New Jersey, United States, 08203 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/BrigantineIslandBeachResort.aspx\">View Property</a>", "Brigantine Island Beach Resort", (new GMarker(new GLatLng(39.392994,-74.397359))),""];
markers[17] = ["<strong>Carousel</strong><br/>413 East Brigantine Avenue, Brigantine Beach, New Jersey, United States, 08203 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/Carousel.aspx\">View Property</a>", "Carousel", (new GMarker(new GLatLng(39.392994,-74.397359))),""];
markers[18] = ["<strong>Cedar Sands</strong><br/>330 42nd St. South, Brigantine Beach, New Jersey, United States, 08203 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/CedarSands.aspx\">View Property</a>", "Cedar Sands", (new GMarker(new GLatLng(39.3882113,-74.3997976))),""];
markers[19] = ["<strong>The Islander</strong><br/>322 43rd Street South, Brigantine Beach, New Jersey, United States, 08203 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/TheIslander.aspx\">View Property</a>", "The Islander", (new GMarker(new GLatLng(39.3882113,-74.3997976))),""];
markers[20] = ["<strong>Surrey Beach House</strong><br/>109 S Surrey Ave, Ventnor City, New Jersey, United States, 08406 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/SurreyBeachHouse.aspx\">View Property</a>", "Surrey Beach House", (new GMarker(new GLatLng(39.340855,-74.471014))),""];
markers[21] = ["<strong>Esplanade Suites</strong><br/>230 East Taylor Avenue, Wildwood, New Jersey, United States, 08260 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/EsplanadeSuites.aspx\">View Property</a>", "Esplanade Suites", (new GMarker(new GLatLng(38.982466,-74.821871))),""];

//markers[22] = ["<strong>Key Colony</strong><br/>3201 Atlantic and Pine Avenue, Wildwood, New Jersey, United States, 08260 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/KeyColony.aspx\">View Property</a>", "Key Colony", (new GMarker(new GLatLng(38.989631,-74.810353))),""];

markers[22] = [];

markers[23] = ["<strong>Key Largo</strong><br/>320 E. Wildwood Avenue, Wildwood, New Jersey, United States, 08260 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/KeyLargo.aspx\">View Property</a>", "Key Largo", (new GMarker(new GLatLng(38.988621,-74.8102879))),""];
markers[24] = ["<strong>Leaming Avenue</strong><br/>144 Leaming Avenue, Wildwood, New Jersey, United States, 08260 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/LeamingAvenue.aspx\">View Property</a>", "Leaming Avenue", (new GMarker(new GLatLng(38.9842385,-74.8274197))),""];
markers[25] = ["<strong>Mali Kai</strong><br/>417 East 19th Ave., Wildwood, New Jersey, United States, 08260 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/MaliKai.aspx\">View Property</a>", "Mali Kai", (new GMarker(new GLatLng(38.99432,-74.799851))),""];

markers[26] = ["<strong>8401 Atlantic Avenue</strong><br/>8401 Atlantic Avenue Wildwood, NJ 08260<br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/8401atlanticavenue.aspx\">View Property</a>", "8401 Atlantic Avenue", (new GMarker(new GLatLng(38.9638448,-74.8426759))),""];

markers[27] = [/*"<strong>Wildwood by the Sea</strong><br/>308 E. Wildwood Avenue, Wildwood, New Jersey, United States, 08260 <br/><a href=\"/Properties/PropertiesbyRegion/NortheastUS/WildwoodbytheSea.aspx\">View Property</a>", "Wildwood by the Sea", (new GMarker(new GLatLng(38.988563,-74.810553))),""*/];

markers[28] = ["<strong>Woodfield Manor</strong><br/>Bush Rd., Swiftwater, Pennsylvania, United States, 18326 <br/><a href=\"/Properties/PropertiesbyRegion/MidAtlanticUS/WoodfieldManor.aspx\">View Property</a>", "Woodfield Manor", (new GMarker(new GLatLng(41.1039775,-75.2820275))),"Pennsylvania"];
markers[29] = ["<strong>Snow Ridge Village</strong><br/>5905 Highway 17 South, Jack Frost Mountain, Blakeslee, Pennsylvania, United States, 18610 <br/><a href=\"/Properties/PropertiesbyRegion/MidAtlanticUS/SnowRidgeVillage.aspx\">View Property</a>", "Snow Ridge Village", (new GMarker(new GLatLng(41.102221,-75.6091696))),""];

markers[30] = [/*"<strong>Shawnee Village</strong><br/>55 Mountainview Circle, Shawnee on Delaware, Pennsylvania, United States, 18301 <br/><a href=\"/Properties/PropertiesbyRegion/MidAtlanticUS/ShawneeVillage.aspx\">View Property</a>", "Shawnee Village", (new GMarker(new GLatLng(41.0443005,-75.1127457))),""*/];


				var map = new google.maps.Map2($("#map_canvas").get(0));//Initialise google maps
				//map.setCenter(new GLatLng(defaultLat, defaultLon), 3);//Set location to the default and zoom level to x
				//map.disableDoubleClickZoom();//Disable zooming
				
				//=============================
					//Zoom Functionality
				//=============================
				var customUI = map.getDefaultUI();
        		customUI.maptypes.hybrid = false; // Remove MapType.G_HYBRID_MAP
        		map.setUI(customUI);
				map.setMapType(G_PHYSICAL_MAP);
				
				

				//=============================
				      //Functions Called
				//=============================
				$.each(markers,function(i,marker){
					var delayTime = ((i * 0) / (0.5 * markers.length));//Delay time decreases as number of markers increases
					var mark;
					
					var location = typeof(marker[2]);
					
					if(location == "object") //Only for Get Lat String (not in use anymore)
					{
						var mark = marker[2];
						configureOverlays(this, map, markers, mark, i, delayTime);
					}
					else
					{
						
						//geocoder.getLatLng(
						//	 marker[0]
						//	,function(point) {
						//		mark = new GMarker(point);
						//		configureOverlays(this, map, markers, mark, i, delayTime);
						//	}
						//);							 
					}
					
					
				});
				
				map.setCenter(new GLatLng(defaultLat, defaultLon), 3);//Resets location of the default and zoom level to x again
				$("#map_list").css("opacity","0.2").animate({opacity: 1}, 1100);//Fade in menu
				$("#map_message").appendTo(map.getPane(G_MAP_FLOAT_SHADOW_PANE));
			}//End if map_canvas exists
			
			
			/* 
			================================
			  X hide #map_message config 
			================================
			*/	
			$("#map_message").click(function () { 
				$("#map_message").hide(); 
			});	
			
			
		}); //End onReady
		
		
