var latlngs = new Array();
var positions = new Array();
var authors = new Array();
var titles = new Array();
var times = new Array();
var teams = new Array();
var messages = new Array();
//set up the icons for the different teams
var iconGreen = new GIcon();
iconGreen.image = 'http://midsummerenergy.co.uk/drk/icons/marker-brightgreen.png';
iconGreen.shadow = 'http://midsummerenergy.co.uk/drk/icons/marker-shadow.png';
iconGreen.iconSize = new GSize(34, 34);
iconGreen.shadowSize = new GSize(49, 32);
iconGreen.iconAnchor = new GPoint(17, 34);
iconGreen.infoWindowAnchor = new GPoint(17, 1);
var iconPink = new GIcon();
iconPink.image = 'http://midsummerenergy.co.uk/drk/icons/marker-pink.png';
iconPink.shadow = 'http://midsummerenergy.co.uk/drk/icons/marker-shadow.png';
iconPink.iconSize = new GSize(34, 34);
iconPink.shadowSize = new GSize(49, 32);
iconPink.iconAnchor = new GPoint(17, 34);
iconPink.infoWindowAnchor = new GPoint(17, 1);
var iconYellow = new GIcon();
iconYellow.image = 'http://midsummerenergy.co.uk/drk/icons/marker-yellow.png';
iconYellow.shadow = 'http://midsummerenergy.co.uk/drk/icons/marker-shadow.png';
iconYellow.iconSize = new GSize(34, 34);
iconYellow.shadowSize = new GSize(49, 32);
iconYellow.iconAnchor = new GPoint(17, 34);
iconYellow.infoWindowAnchor = new GPoint(17, 1);
var customIcons = [];
customIcons["Spork"] = iconYellow;
customIcons["Safari Njema"] = iconPink;
customIcons["Jua Kali"] = iconGreen;
function initialize() {
function createMarker(point, message, author, position, time, team) {
var marker = new GMarker(point, {icon:customIcons[team]});
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml("
" + author + " (Team " + team + ")
"+ message + "
" + position +" " + time + " ");
});
return marker;
}
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map_canvas"));
map.setCenter(new GLatLng(maplat, maplong), mapzoom, G_PHYSICAL_MAP);
map.addControl(new GSmallMapControl());
map.enableScrollWheelZoom();
map.addMapType(G_PHYSICAL_MAP);
if (controls > 0 ) {
map.addControl(new GMapTypeControl());
}
//add the old blobs:
GDownloadUrl("http://midsummerenergy.co.uk/drk/blobs-old.xml", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
//get the latitude and the longitude
latlngs[i] = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
//get the message and the author and named position
positions[i] = (markers[i].getAttribute("position"));
authors[i] = (markers[i].getAttribute("author"));
titles[i] = (markers[i].getAttribute("title"));
times[i] = (markers[i].getAttribute("time"));
messages[i] = (markers[i].getAttribute("message"));
teams[i] = 'Couch Potatoes';
if (authors[i] === 'PK') {teams[i] = 'Safari Njema'};
if (authors[i] === 'Xina') {teams[i] = 'Safari Njema'};
if (authors[i] === 'Kieran') {teams[i] = 'Safari Njema'};
if (authors[i] === 'Adrienne') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Mark') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Sam') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Sarah') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Spork') {teams[i] = 'Spork'};
if (authors[i] === 'Adam') {teams[i] = 'Spork'};
if (authors[i] === 'Marie') {teams[i] = 'Spork'};
if (authors[i] === 'Simon') {teams[i] = 'Spork'};
var latlng = latlngs[i]
if (markers[i].getAttribute("lat")>1) {
map.addOverlay(createMarker(latlng, messages[i], authors[i], positions[i], times[i], teams[i]));
}
}
});
//and repeat for current blobs:
GDownloadUrl("http://midsummerenergy.co.uk/drk/blobs.xml", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
//get the latitude and the longitude
latlngs[i] = new GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
//get the message and the author and named position
positions[i] = (markers[i].getAttribute("position"));
authors[i] = (markers[i].getAttribute("author"));
titles[i] = (markers[i].getAttribute("title"));
times[i] = (markers[i].getAttribute("time"));
messages[i] = (markers[i].getAttribute("message"));
teams[i] = 'Couch Potatoes';
if (authors[i] === 'PK') {teams[i] = 'Safari Njema'};
if (authors[i] === 'Xina') {teams[i] = 'Safari Njema'};
if (authors[i] === 'Kieran') {teams[i] = 'Safari Njema'};
if (authors[i] === 'Adrienne') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Mark') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Sam') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Sarah') {teams[i] = 'Jua Kali'};
if (authors[i] === 'Spork') {teams[i] = 'Spork'};
if (authors[i] === 'Adam') {teams[i] = 'Spork'};
if (authors[i] === 'Marie') {teams[i] = 'Spork'};
if (authors[i] === 'Simon') {teams[i] = 'Spork'};
var latlng = latlngs[i]
if (markers[i].getAttribute("lat")>1) {
map.addOverlay(createMarker(latlng, messages[i], authors[i], positions[i], times[i], teams[i]));
}
}
});
//add the geofeeds, by tag:
var geojuakali = new GGeoXml("http://api.flickr.com/services/feeds/geo/?id=29917691@N04&lang=en-us&tags=juakali&format=rss_200");
map.addOverlay(geojuakali);
var geosafarinjema = new GGeoXml("http://api.flickr.com/services/feeds/geo/?id=29917691@N04&lang=en-us&tags=safarinjema&format=rss_200");
map.addOverlay(geosafarinjema);
var geospork = new GGeoXml("http://api.flickr.com/services/feeds/geo/?id=29917691@N04&lang=en-us&tags=spork&format=rss_200");
map.addOverlay(geospork);
var geosporknew = new GGeoXml("http://api.flickr.com/services/feeds/geo/?id=34941617@N08&lang=en-us&format=rss_200");
map.addOverlay(geosporknew);
}
}