89 lines
2.7 KiB
JavaScript
Executable File
89 lines
2.7 KiB
JavaScript
Executable File
function toggleExif(id) {
|
|
/**/
|
|
//alert(id);
|
|
/**/
|
|
id2 = id.toString();
|
|
var exifDiv = document.getElementById(id2);
|
|
if (exifDiv.style.display == "block") {
|
|
exifDiv.style.display = "none";
|
|
}
|
|
else {
|
|
exifDiv.style.display = "block";
|
|
google.maps.event.trigger(map, 'resize');
|
|
/*
|
|
var zoom = map.getZoom();
|
|
map.setZoom( zoom );
|
|
alert(zoom);
|
|
*/
|
|
map.setZoom( map.getZoom() );
|
|
map.setCenter(marker.getPosition());
|
|
}
|
|
}
|
|
|
|
function initialize(lat, lng, mark, mapNum) {
|
|
|
|
var contentString = mark;
|
|
var latlng = new google.maps.LatLng(lat,lng);
|
|
/*alert(latlng);*/
|
|
var myOptions = {
|
|
/* http://code.google.com/intl/fr/apis/maps/documentation/javascript/reference.html#MapOptions */
|
|
zoom: 11,
|
|
center: latlng,
|
|
scrollwheel: true,
|
|
scaleControl: false,
|
|
disableDefaultUI: false,
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
|
/*
|
|
navigationControl: true,
|
|
navigationControlOptions: {
|
|
style: google.maps.NavigationControlStyle.SMALL
|
|
}*/
|
|
};
|
|
map = new google.maps.Map(document.getElementById("map"+mapNum), myOptions);
|
|
|
|
marker = createMarker(latlng, '', contentString, map);
|
|
}
|
|
|
|
function createMarker(point, title, content, map) {
|
|
var myMarkerImage = new google.maps.MarkerImage('http://maps.google.com/mapfiles/arrow.png');
|
|
var myMarkerShadow = new google.maps.MarkerImage('http://maps.google.com/mapfiles/arrowshadow.png');
|
|
var marker = new google.maps.Marker({
|
|
position: point,
|
|
map: map,
|
|
icon: myMarkerImage,
|
|
shadow: myMarkerShadow,
|
|
title: title
|
|
});
|
|
var infowindow = new google.maps.InfoWindow({
|
|
//content: content
|
|
content: createInfo(content,content, point),
|
|
//width: 500,
|
|
//height: 400
|
|
});
|
|
|
|
google.maps.event.addListener(marker, 'click', function() { /* mouseover */
|
|
if(curr_infw) { curr_infw.close();} // We check to see if there is an info window stored in curr_infw, if there is, we use .close() to hide the window
|
|
curr_infw = infowindow; // Now we put our new info window in to the curr_infw variable
|
|
infowindow.open(map, marker); // Now we open the window
|
|
});
|
|
return marker;
|
|
};
|
|
|
|
// Create information window
|
|
function createInfo(title, content, point) {
|
|
|
|
point = point.toString();
|
|
var coord = point.split(',');
|
|
latitude = coord[0].substring(1);
|
|
var t = coord[1].length;
|
|
longitude = coord[1].substring(0,(t-1));
|
|
|
|
var html = '<div class="infowindow">';
|
|
html += '<strong>'+ title +'</strong>';
|
|
html += '<p>'+content+'</p>';
|
|
html += '<ul><li>Lat: '+(Math.floor(latitude * 100000)/100000)+'</li>';
|
|
html += '<li>Long: '+(Math.floor(longitude * 100000)/100000)+'</li>';
|
|
html += '</div>';
|
|
return html;
|
|
}
|