$(document).ready(function() {
 
// Function populates "Mayor's Office Blog"; links to moblog.shtml
  $.get('/mayor/news/moblog.shtml', function(data) {
    $('#mayorsBlogEntries').empty();
    $(data).find('div.entry').each(function(i) {
     if(i<4) {

	var $title = $(this).find('h3').html();
	var $readmore = ('&hellip;<span class="moreLink"><a href="moblog.shtml#' + $title + '" title="Read more about ' + $title + '">Read more</a></span>');

var $headline = ('<h3>');
$headline += $(this).find('h3').html();
$headline += ('</h3>');

var $date = ('<h4>');
$date += $(this).find('h4').html();
$date += ('</h4>');

var $para = ('<p>');
      	$para += $(this).find('.excerpt').html();

        var $entry = $headline + $date + $para;

	$entry = $entry + $readmore;
        $entry += ('</p>');
        $('#mayorsBlogEntries').append($entry);
      }
    });
  });

// Function populates "Milestones & Achievements"; links to milestones.shtml 
  $.get('milestones.shtml', function(data) {
    $('#milestones').empty();
    $(data).find('div.item').each(function(i) {
     if(i<3) {
	var $title = $(this).find('h3').html();

	// The anchor is the text of <h3>.
	var $anchor = $title;
	var $link = $('<a href="milestones.shtml#'+$anchor+'"></a>').append($title);
	var $headline = $('<li></li>').append($link);
        $('#milestones').append($headline);
      }
    });
  });

// Function populates "City @ Work"; links to cityatwork.shtml
  $.get('/mayor/news/cityatwork.shtml', function(data) {
    $('#cityatworkItem').empty();
    $(data).find('div.item').each(function(i) {
     if(i<1) {

	var $title = $(this).find('h3').html();
	var $readmore = ('&hellip;<span class="moreLink"><a href="cityatwork.shtml#' + $title + '" title="Read more about ' + $title + '">Read more</a></span>');

var $headline = ('<h3>');
$headline += $(this).find('h3').html();
$headline += ('</h3>');

var $para = ('<p>');
      	$para += $(this).find('.excerpt').html();

        var $entry = $headline + $para;

	$entry = $entry + $readmore;
        $entry += ('</p>');
        $('#cityatworkItem').append($entry);
      }
    });
  });


});

