// JavaScript Document
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var mapCenter = new google.maps.LatLng(31.035063, -81.415482);
var map;
var starMarker = new google.maps.MarkerImage('/themes/oaks/modules/map/images/star.png', new google.maps.Size(52, 39), new google.maps.Point(0,0),new google.maps.Point(26, 39));
var mapOptions = {
scrollwheel: false,
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: mapCenter,
panControl: false,
zoomControl: true,
zoomControlOptions: {
style: google.maps.ZoomControlStyle.SMALL,
position: google.maps.ControlPosition.RIGHT_BOTTOM
}
,mapTypeControlOptions: {
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
position: google.maps.ControlPosition.LEFT_BOTTOM
}
,streetViewControl: true
//,streetViewControlOptions: { position: google.maps.ControlPosition.BOTTOM_RIGHT }
};
var locationInfoBox = "
Ocean Oaks
Beach Village, 11 Main Street Suite 205
Jekyll Island, GA 31527
";
var infowindow = new google.maps.InfoWindow({
content: locationInfoBox
});
function initialize() {
//directionsDisplay = new google.maps.DirectionsRenderer();
map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
//directionsDisplay.setMap(map);
//directionsDisplay.setPanel(document.getElementById('directions-container'));
//var control = document.getElementById('directions_control');
//control.style.display = 'block';
//map.controls[google.maps.ControlPosition.TOP].push(control);
var marker = new google.maps.Marker({
position: mapCenter,
map: map,
icon: starMarker,
title: 'Ocean Oaks'
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
function calcRoute() {
var start = document.getElementById('start').value;
var end = document.getElementById('end').value;
var request = {
origin: start,
destination: end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
// refresh the map if we're on the directions tab
$('#directions_tab').click(function() {
setTimeout(function() {
google.maps.event.trigger(map, 'resize');
map.setZoom(map.getZoom());
map.setCenter(mapCenter);
}, 300);
return false;
});