contact us

Use the form on the right to contact us.

You can edit the text in this area, and change where the contact form on the right submits to, by entering edit mode using the modes on the bottom right.

           

123 Street Avenue, City Town, 99999

(123) 555-6789

email@address.com

 

You can set your address, phone number, email and site description in the settings tab.
Link to read me page with more information.

map.js

var currentPopup = 0;

function getData(entries) {
  var teams = {}
  for (entry in entries) {
    var entry = entries[entry]
    var team = entry.gsx$teamnumber.$t;
    if (teams[team] === undefined) {
      teams[team] = {};
      teams[team].name1 = entry.gsx$names1.$t;
      teams[team].name2 = entry.gsx$names2.$t;
      teams[team].locations = [];
    }
    var point = {};
    point.message = entry.gsx$message.$t;
    if (entry.gsx$location.$t && entry.gsx$location.$t != "" && entry.gsx$latitude.$t && entry.gsx$latitude.$t != "") {
      point.location = entry.gsx$location.$t;
      point.latitude = parseFloat(entry.gsx$latitude.$t);
      point.longitude = parseFloat(entry.gsx$longitude.$t);
      point.distance = parseInt(entry.gsx$distancemiles.$t);
      teams[team].locations.push(point);
    }
  }
  return teams;
}

function spreadsheetLoaded(root) {
  teams = getData(root.feed.entry);
  var myLatlng = new google.maps.LatLng(-34.397, 150.644);
  var myOptions = {
    zoom: 4,
    center: new google.maps.LatLng(50, 0),
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map"), myOptions);
  var list = document.getElementById("key");
  list.style.overflow="auto";
  for (team in teams) {
    var teamNumber = team;
    var team = teams[team];
    var latlnglist = [];
    var messageList = [];
    for (i in team.locations)
    {  
      var point = team.locations[i];
      var latlng = new google.maps.LatLng(point.latitude, point.longitude);
      latlnglist.push(latlng);
      if (point.message != ""){
    messageList.push(point.message);
      }
    }
    messageList.pop();
    messageList.reverse();
    var pastMessages = messageList.length == 0 ? "" : "<ul><li>" + messageList.join("</li><li>") + "</li></ul>";
    var i = team.locations.length - 1;
    var point = team.locations[i];      
    var marker = new google.maps.Marker({
      position : latlng,
      map : map, 
      title : team.name1 + " and " + team.name2
    });
    var popup = new google.maps.InfoWindow({
      content : "<h3> Team " + teamNumber + ": " + team.name1 + " and " + team.name2 + "</h3>" + "<h4>" + point.location + "</h4><h4>" + point.distance + " miles from Durham </h4><p>" + point.message + "</p><h4> Previous Messages:</h4><p>" + pastMessages + "</p>",
      maxWidth : 300,
    });
    
    function popupMarker(popup, marker) {
      return function() {
    if (currentPopup != 0) {
      currentPopup.close();
    }
    popup.open(map, marker);
    currentPopup = popup;
      }
    }
    
    google.maps.event.addListener(marker, 'click', popupMarker(popup, marker));

    listItem = document.createElement("li");
    listItem.appendChild(document.createTextNode("Team " + teamNumber + " - " + team.name1 + " and " + team.name2));
    listItem.style.color = "blue";
    listItem.style.cursor = "pointer";
    listItem.style.textDecoration = "underline";
    listItem.onclick = popupMarker(popup, marker);
    
    list.appendChild(listItem);
    list.appendChild(document.createElement("br"));
    var clList = new Array( "#FF0000", "#000000", "#0000FF", "#008000", "#800080", "#FF00FF", "#000033", "#000066", "#000099", "#0000CC", "#003300", "#003333", "#003366", "#003399", "#330000", "#330066", "#330099", "#333300", "#333366", "#333399", "#660000", "#660033", "#660066", "#660099", "#6600CC", "#6600FF", "#663300", "#663366", "#663399", "#990000", "#990033", "#990066", "#990099", "#993300", "#993366 ", "#993399", "#996600", "#CC0033", "#CC0066", "#CC0099", "#CC3300 ", "#CC3333", "#CC3366", "#FF0033", "#FF3300", "#FF3366" );
    var teamColour = clList[teamNumber % 46];
    var line = new google.maps.Polyline({
      path : latlnglist,
      map : map,
      strokeColor: teamColour,
      strokeOpacity: 1.0,
      strokeWeight: 1
    });
  }
}