1 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
3 <link rel="SHORTCUT ICON" href="/favicon.ico" type="image/x-icon" />
4 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
5 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
6 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
7 <title>Where are our books comming from?</title>
8 <script type="text/javascript">
16 // Load the map script...
18 function loadScript() {
20 var script = document.createElement("script");
21 script.type = "text/javascript";
22 script.src = "http://maps.google.com/maps/api/js?sensor=false&callback=initialize";
23 document.body.appendChild(script);
28 function initialize() {
29 var myLatlng = new google.maps.LatLng(45,15);
31 // Create the volcano tile layer...
33 var volcanoOptions = {
34 getTileUrl: function(tile, zoom) {
40 return "koha/tiles/" + zoom + "/v_" + x + "_" + tile.y + ".png";
42 tileSize: new google.maps.Size(256, 256),
49 var volcanoMapType = new google.maps.ImageMapType(volcanoOptions);
57 mapTypeId: google.maps.MapTypeId.TERRAIN
59 map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
60 map.overlayMapTypes.insertAt(0, volcanoMapType);
62 // Keep zoom within limits...
64 google.maps.event.addListener(map, 'zoom_changed', function() {
65 if ( map.getZoom() > maxZoom ) {
66 map.setZoom( maxZoom ) ;
67 } else if ( map.getZoom() < minZoom ) {
68 map.setZoom( minZoom ) ;
72 // Initialize an infoWindow...
74 infoWindow = new google.maps.InfoWindow();
76 // Add a click listener...
78 google.maps.event.addListener(map, 'click', function(event) {
79 processClick(event.latLng);
83 // Set the map size based on the type of agent...
85 function detectBrowser() {
86 var useragent = navigator.userAgent;
87 var mapdiv = document.getElementById("map_canvas");
88 if ( useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) {
89 mapdiv.style.width = '100%';
90 mapdiv.style.height = '100%';
93 mapdiv.style.width = '800px';
94 mapdiv.style.height = '600px';
96 mapdiv.style.width = '100%';
97 mapdiv.style.height = '100%';
101 // Check for an active click (on a map icon)...
103 function processClick ( point )
105 var request = window.ActiveXObject ? new ActiveXObject('Microsoft.XMLHTTP') : new XMLHttpRequest;
106 var parms = "POINT=" + point.toUrlValue() + "&ZOOM=" + map.getZoom() ;
107 request.open("POST", "koha.pl", true);
108 request.setRequestHeader('Content-Type','application/x-www-form-urlencoded') ; // Thanks to Darkstar 3D!
109 request.onreadystatechange = function()
111 document.getElementById("loading").innerHTML = "Loading, please wait..." ;
113 if (request.readyState == 4)
115 var xmlDoc = request.responseXML ;
118 var info = xmlDoc.documentElement.getElementsByTagName("info") ;
119 var error = info[0].getAttribute("error") ;
126 var name = info[0].getAttribute("name") ;
127 var lat = parseFloat(info[0].getAttribute("lat")) ;
128 var lng = parseFloat(info[0].getAttribute("lng")) ;
129 var clickLatlng = new google.maps.LatLng(lat,lng) ;
130 var description = info[0].getElementsByTagName("description")[0].firstChild.nodeValue ;
131 var html = "<div style='height:300px; width:350px;overflow:auto;'>" + description + "</div>" ;
134 infoWindow.setOptions({
136 position: clickLatlng
138 infoWindow.open(map);
142 alert("Some error occured during program processing:" + e) ;
144 document.getElementById("loading").innerHTML = "" ;
154 <body bgcolor="#D1D0CD" text="black" link="#444444" alink="gray" vlink="#111111" onload="loadScript();">
155 <div id="map_canvas"></div>
156 <div id="loading" title="loading message for map" style="background-color:#D1D0CD; position:absolute; left:120px; top:200px;"></div>