var map = null;
var geocoder = null;
var pt = null;
//load Google Map
function session_map_load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("maps"));
geocoder = new GClientGeocoder();
map.addControl(new GSmallMapControl());
//geocoder.setBaseCountryCode("NL");
//add controls
map.addControl(new GMapTypeControl());
//create randomnumber to prevent caching and retrieve xml file
var randomnumber=Math.floor(Math.random()*11111)
GDownloadUrl("../markers/data_1000135074a8b0e54403878.81969361.xml?random="+randomnumber, function(data, responseCode) {
var xml = GXml.parse(data);
//store markers in markers array
var markers = xml.documentElement.getElementsByTagName("marker");
// create marker icon
var icon = new GIcon();
icon.image = "/icons/iconr.png";
icon.iconSize = new GSize(24, 23);
icon.iconAnchor = new GPoint(0, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
//loop over the markers array
for (var i = 0; i < markers.length; i++) {
var address = markers[i].getAttribute("address");
var html = markers[i].getAttribute("html");
showAddress(map,geocoder,address,html,icon);
} //close for loop
}
); //close GDownloadUrl
//Create marker and set up event window
function createMarker(point,html,icon){
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
marker.setOpacity(70);
});
return marker;
}
//showAddress
function showAddress(map,geocoder,address,html,icon) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " niet gevonden");
} else {
map.setCenter(point, 6);
var marker = createMarker(point,html,icon);
//var marker = new GMarker(point);
map.addControl(new GMapTypeControl());
map.addOverlay(marker);
marker.openInfoWindowHtml("
" + html + "
");
}
}
);
}
} //close GBrowserIsCompatible
} //close session_map_load
//load Google Map
function load() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("maps"));
geocoder = new GClientGeocoder();
map.addControl(new GSmallMapControl());
//geocoder.setBaseCountryCode("NL");
//add controls
map.addControl(new GMapTypeControl());
//create randomnumber to prevent caching and retrieve xml file
var randomnumber=Math.floor(Math.random()*11111)
GDownloadUrl("../data.xml?random="+randomnumber, function(data, responseCode) {
var xml = GXml.parse(data);
//store markers in markers array
var markers = xml.documentElement.getElementsByTagName("marker");
// create marker icon
var icon = new GIcon();
icon.image = "/icons/iconr.png";
icon.iconSize = new GSize(24, 23);
icon.iconAnchor = new GPoint(0, 20);
icon.infoWindowAnchor = new GPoint(5, 1);
//loop over the markers array
for (var i = 0; i < markers.length; i++) {
var address = markers[i].getAttribute("address");
var html = markers[i].getAttribute("html");
showAddress(map,geocoder,address,html,icon);
} //close for loop
}
); //close GDownloadUrl
//Create marker and set up event window
function createMarker(point,html,icon){
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(html);
marker.setOpacity(70);
});
return marker;
}
//showAddress
function showAddress(map,geocoder,address,html,icon) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " niet gevonden");
} else {
map.setCenter(point, 6);
var marker = createMarker(point,html,icon);
//var marker = new GMarker(point);
map.addControl(new GMapTypeControl());
map.addOverlay(marker);
marker.openInfoWindowHtml("" + html + "
");
}
}
);
}
} //close GBrowserIsCompatible
} //close load
function showAddress(address, html) {
address = address// + ", Amsterdam"
if (geocoder) {
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(point, 9);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(address);
marker.openInfoWindowHtml(html);
//pt = document.getElementById("point");
//pt.innerHTML = "" + point + "
";
}
}
);
}
}