/**
 * Lists blog entries from the specified JSON feed by creating a new 'ul' element in the DOM.
 * Each bullet is the title of one blog entry, and contains a hyperlink to that entry's URL.
 * @param {JSON} json is the JSON object pulled from the Blogger service.
 */
function listEntries(json) {

  var ul = document.createElement('ul');
	ul.appendChild(document.createTextNode ('Recent Posts'));
  for (var i = 0; i < 4; i++) {
    var entry = json.feed.entry[i];
    var alturl;

    for (var k = 0; k < entry.link.length; k++) {
      if (entry.link[k].rel == 'alternate') {
        alturl = entry.link[k].href;
        break;
      }
    }

    var li = document.createElement('li');
    var a = document.createElement('a');
    a.href = alturl;
    a.target = '_blank';

    var txt = document.createTextNode(entry.title.$t);
    a.appendChild(txt);
    li.appendChild(a);

    ul.appendChild(li);
  }

  // Install the bullet list of blog posts.

var bl=document.getElementById('blog');
document.getElementById('data').appendChild(ul)
}

/**
 * Create a new script element in the DOM whose source is the JSON feed
 * shalbourne.blogspot.com, and specifies that the callback function is 'listEntries' (above).
 */

  // Retrieve the JSON feed.
  var script = document.createElement('script');
  script.setAttribute('src', 'http://shalbourne-soaring.blogspot.com/feeds/posts' +
                      '/default?alt=json-in-script&callback=listEntries');
  script.setAttribute('id', 'jsonScript');
  script.setAttribute('type', 'text/javascript');
  document.documentElement.firstChild.appendChild(script);
