map.html - the output

Last updated by steven

remember you have to change the API KEY

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Dropzones / Sprungpl&auml;tze</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAABDMTaeSqjRobOZpApN8Y1xQ2YVEoW3njgKUFMY_49e7T28VW-RQYRdxbieSiFtD6kvJgTDOaTctzlA"
type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[

var iconBlue = new GIcon();
iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconBlue.iconSize = new GSize(12, 20);
iconBlue.shadowSize = new GSize(22, 20);
iconBlue.iconAnchor = new GPoint(6, 20);
iconBlue.infoWindowAnchor = new GPoint(5, 1);

var iconRed = new GIcon();
iconRed.image = 'http://labs.google.com/ridefinder/images/mm_20_red.png';
iconRed.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
iconRed.iconSize = new GSize(12, 20);
iconRed.shadowSize = new GSize(22, 20);
iconRed.iconAnchor = new GPoint(6, 20);
iconRed.infoWindowAnchor = new GPoint(5, 1);

/* var customIcons = [];
customIcons["restaurant"] = iconBlue;
customIcons["bar"] = iconRed; */

function load() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(51.096623, 10.258367), 5);

GDownloadUrl("generate_xml.php", function(data) {
var xml = GXml.parse(data);
var dropzones = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < dropzones.length; i++) {
var name = dropzones[i].getAttribute("name");
var street = dropzones[i].getAttribute("street");
var city = dropzones[i].getAttribute("city");
var phone = dropzones[i].getAttribute("phone");
var fax = dropzones[i].getAttribute("fax");
var mail = dropzones[i].getAttribute("mail");
var internet = dropzones[i].getAttribute("internet");
var type = dropzones[i].getAttribute("type");
var point = new GLatLng(parseFloat(dropzones[i].getAttribute("latitude")),
parseFloat(dropzones[i].getAttribute("longitude")));
var marker = createMarker(point, name, street, city, phone, fax, mail, internet, type);
map.addOverlay(marker);
}
});
}
}

function createMarker(point, name, street, city, phone, fax, mail, internet, type) {
var marker = new GMarker(point, iconRed[type]);
var html = "<b>" + name + "</b> <br/>" + street + "<br/>" + city + "<br/>" + mail + "<br/>" + internet;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
}
//]]>
</script>
</head>

<body onload="load()" onunload="GUnload()">
<div id="map" style="width: 600px; height: 400px"></div>
</body>
</html>