Here is the script in my document head:
Expand|Select|Wrap|Line Numbers
- <script>
- var map;
- function load() {
- if (GBrowserIsCompatible()) {
- map = new GMap2(document.getElementById("map"));
- map.setCenter(new GLatLng(51.500152, -0.126236), 11);
- map.addControl(new GSmallMapControl());
- map.getPane(G_MAP_FLOAT_SHADOW_PANE).style.display = "none";
- G_NORMAL_MAP.getMinimumResolution = function () { return 12 };
- addMarkersFromXML();
- }
- }
- function addMarkersFromXML(){
- var batch = [];
- mgr = new MarkerManager(map);
- var request = GXmlHttp.create();
- request.open('GET', 'data.xml', true);
- request.onreadystatechange = function() {
- if (request.readyState == 4 && request.status == 200) {
- var xmlDoc = request.responseXML;
- var xmlrows = xmlDoc.documentElement.getElementsByTagName("Row");
- for (var i = 0; i < xmlrows.length; i++) {
- var xmlrow = xmlrows[i];
- var xmlcellLongitude = xmlrow.getElementsByTagName("Longitude")[0];
- var xmlcellLatitude = xmlrow.getElementsByTagName("Latitude")[0];
- var point = new GLatLng(parseFloat(xmlcellLatitude.firstChild.data), parseFloat(xmlcellLongitude.firstChild.data));
- //get the building name
- var xmlcellName = xmlrow.getElementsByTagName("Name")[0];
- var celltextName = xmlcellName.firstChild.data;
- var xmlcellImage = xmlrow.getElementsByTagName("Image")[0];
- var celltextImage = xmlcellImage.firstChild.data;
- //get the address
- var xmlcellGenre = xmlrow.getElementsByTagName("Genre")[0];
- var celltextGenre = xmlcellGenre.firstChild.data;
- //get the ownership
- var xmlcellBio = xmlrow.getElementsByTagName("Bio")[0];
- var celltextBio = xmlcellBio.firstChild.data;
- var xmlcellSong = xmlrow.getElementsByTagName("Song")[0];
- var celltextSong = xmlcellSong.firstChild.data;
- var xmlcellSongtitle = xmlrow.getElementsByTagName("Songtitle")[0];
- var celltextSongtitle = xmlcellSongtitle.firstChild.data;
- var xmlcellVenue = xmlrow.getElementsByTagName("Venue")[0];
- var celltextVenue = xmlcellVenue.firstChild.data;
- var xmlcellStarttime = xmlrow.getElementsByTagName("Starttime")[0];
- var celltextStarttime = xmlcellStarttime.firstChild.data;
- var xmlcellEndtime = xmlrow.getElementsByTagName("Endtime")[0];
- var celltextEndtime = xmlcellEndtime.firstChild.data;
- var xmlcellDate = xmlrow.getElementsByTagName("Date")[0];
- var celltextDate = xmlcellDate.firstChild.data;
- var marker = createMarker(point,celltextName,celltextImage,celltextGenre,celltextBio,celltextSong,celltextSongtitle,celltextVenue,celltextStarttime,celltextEndtime,celltextDate);
- batch.push(marker);
- }
- mgr.addMarkers(batch,11);
- mgr.refresh();
- }
- }
- request.send(null);
- }
- function createMarker(point,name,image_source,genrevar,bio,song_source,songtitlevar,venuevar,starttime,endtime,datevar) {
- var marker = new GMarker(point);
- GEvent.addListener(marker, "click", function() {
- texttitle.innerHTML=name;
- genre.innerHTML=genrevar;
- text.innerHTML=bio;
- songtitle.innerHTML=songtitlevar;
- document.getElementById('image').src=image_source;
- document.getElementById('audiobutton').style.display='block';
- document.getElementById('audiobutton').src='play.png';
- document.getElementById('audioplayer').src=song_source;
- marker.openInfoWindowHtml('<h>'+name+'</h>'+'<br>'+venuevar+'<br>'+starttime+' - '+endtime);
- });
- return marker;
- }
- </script>
Expand|Select|Wrap|Line Numbers
- <Root>
- <Row>
- <Longitude>-0.126236</Longitude>
- <Latitude>51.500152</Latitude>
- <Name>Soundgarden</Name>
- <Image>http://www.musicbabylon.com/files/Soundgarden.jpg</Image>
- <Genre>Grunge</Genre>
- <Bio>Soundgarden is an American rock band formed in Seattle, Washington in 1984 by lead singer and drummer Chris Cornell, lead guitarist Kim Thayil, and bassist Hiro Yamamoto. Matt Cameron became the band's permanent drummer in 1986 while bassist Ben Shepherd became a permanent replacement for Yamamoto in 1990. Soundgarden was one of the seminal bands in the creation of grunge, a style of alternative rock that developed in Seattle, and was one of a number of grunge bands signed to the record label Sub Pop. Soundgarden was the first grunge band to sign to a major label (AM Records, in 1988), though the band did not achieve commercial success until they popularized "grunge" in the early 1990s with Seattle contemporaries Nirvana, Alice in Chains and Pearl Jam.</Bio>
- <Song>http://www.pampelmoose.com/audio/Soundgarden-Jesus_Christ_Pose.mp3</Song>
- <Songtitle>Jesus Christ Pose</Songtitle>
- <Venue>Pub</Venue>
- <Starttime>19:00</Starttime>
- <Endtime>22:00</Endtime>
- <Date>02/10/2010</Date>
- </Row>
- <Row>
- <Longitude>-0.132093</Longitude>
- <Latitude>51.501624</Latitude>
- <Name>Elliott Smith</Name>
- <Image>http://upload.wikimedia.org/wikipedia/commons/7/7c/Elliott_Smith_Memorial_Wall.jpg</Image>
- <Genre>Folk</Genre>
- <Bio>Steven Paul "Elliott" Smith (August 6, 1969 – October 21, 2003) was an American singer-songwriter and musician. Smith was born in Omaha, Nebraska, raised primarily in Texas, and resided for a significant portion of his life in Portland, Oregon, where he first gained popularity. His primary instrument was the guitar, but he was also proficient at piano, clarinet, bass guitar, drums, and harmonica. Smith had a distinctive vocal style characterized by his "whispery, spiderweb-thin delivery"[1] and use of multi-tracking to create vocal layers, textures, and harmonies. After playing in rock band Heatmiser for several years, Smith began his solo career in 1994 with releases on the independent record labels Cavity Search and Kill Rock Stars. In 1997 he signed a contract with DreamWorks Records, for which he recorded two albums. Smith rose to mainstream prominence when his song "Miss Misery" — included in the soundtrack for the film Good Will Hunting — was nominated for an Oscar in the Best Original Song category in 1998.</Bio>
- <Song>http://etpatatietpatata.typepad.com/observing_the_process_wil/files/04_good_to_go.mp3</Song>
- <Songtitle>Good To Go</Songtitle>
- <Venue>Bar</Venue>
- <Starttime>18:30</Starttime>
- <Endtime>23:00</Endtime>
- <Date>21/10/2010</Date>
- </Row>
- </Root>