var Cinemon_Map = new Array(); var Cinemon_MapControl = new Array(); var Cinemon_Point = new Array(); var Cinemon_MapElement = new Array(); var Cinemon_MapWidth = new Array(); var Cinemon_MapHeight = new Array(); var Cinemon_MarkerHTML = new Array(); function Cinemon_SetupMap(map_id, address, width, height,marker_html) { Cinemon_MapElement[map_id] = document.getElementById(map_id); Cinemon_MapWidth[map_id] = width; Cinemon_MapHeight[map_id] = height; Cinemon_MarkerHTML[map_id] = marker_html; Cinemon_Map[map_id] = new GMap2(Cinemon_MapElement[map_id], { size: new GSize(Cinemon_MapWidth[map_id], Cinemon_MapHeight[map_id]) }); Cinemon_MapControl[map_id] = new GSmallMapControl(); Cinemon_Map[map_id].setMapType(G_NORMAL_MAP); Cinemon_Map[map_id].addControl(Cinemon_MapControl[map_id]); Cinemon_Map[map_id].enableContinuousZoom(); Cinemon_GoToAddress(map_id, address); } function Cinemon_GoToAddress(map_id, address) { var geoCoder = new GClientGeocoder(); var tabAccuracy = new Array(2,4,6,10,12,13,13,13,13); geoCoder.getLocations(address, function(response) { if(response.Status.code == 200){ place = response.Placemark[0]; accuracy = place.AddressDetails.Accuracy; Cinemon_Point[map_id] = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); Cinemon_Map[map_id].setCenter(Cinemon_Point[map_id], tabAccuracy[accuracy]); Cinemon_CreateMarker(Cinemon_Point[map_id],false,map_id); } else { alert("Sorry that location could not be found. Please try again."); } }); } function Cinemon_CreateMarker(p, m,map_id) { var marker = new GMarker(p, m); Cinemon_Map[map_id].addOverlay(marker); Cinemon_Map[map_id].openInfoWindowHtml(p, Cinemon_MarkerHTML[map_id]); infoWindow = Cinemon_Map[map_id].getInfoWindow(); infoWindow.show(); return marker; } function Cinemon_GetDirections(map_id) { var from = document.getElementById('Cinemon_DirectionsFrom'); var to = document.getElementById('Cinemon_DirectionsTo'); var walking = document.getElementById('Cinemon_DirectionTypeWalking'); var type = G_TRAVEL_MODE_DRIVING; var ref = this; if(walking.checked) { type = G_TRAVEL_MODE_WALKING; } directionsPanel = document.getElementById('Cinemon_TheatreDirections'); /* Erase previous directions */ directionsPanel.innerHTML = ''; Cinemon_Map[map_id].clearOverlays(); directions = new GDirections(Cinemon_Map[map_id], directionsPanel); directions.load("from: "+from.value+" to:"+to.value, {travelMode:type}); GEvent.addListener(directions, "error", function() { ref.directionsPanel.innerHTML = '

Directions could not be loaded. Please ensure you typed the address correctly and try again.

'; }) }