// Rides planned for this week
// This code fetches the most recent "nextweek" entry from the blog and creates a <div> containing it
// To display this on a web page, use <div id="plannedrides"/>
// You need to declare the Google API key before calling this script

if (typeof google!="undefined") { 
	google.load("feeds", "1");
}

function initplannedrides() {

  var container = document.getElementById("plannedrides");
  var feed = new google.feeds.Feed("http://rides.ctc-cambridge.org.uk/feeds/posts/default/-/nextweek?alt=rss");
        
  feed.load(function(result) {
     if (!result.error) {

        var entry = result.feed.entries[0];
        var div1 = document.createElement("div");
        div1.innerHTML = "<h2>"+entry["title"]+"<h2>";     
        container.appendChild(div1);

        var div2 = document.createElement("div");
        div2.innerHTML = entry.content;     
        container.appendChild(div2);
     }
   });

}

if (typeof google!="undefined") { 
	google.setOnLoadCallback(initplannedrides);
}

