/**
 * parses any RSS/XML feed through Google and returns JSON data
 * source: http://stackoverflow.com/a/6271906/477958
 */
function parseRSS(url, container) {
  $.ajax({
    url: 'https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
    dataType: 'json',
    success: function(data) {
      $.each(data.responseData.feed.entries, function(key, value){
        var thehtml = '<li><a href="#" onClick="window.open('+ "'" + value.link + "'" +',' + "'_blank'" + ',' + "'location=yes'" +')">'+value.title+'</a></li>';
          $(container).append(thehtml);
      });
    }
  });
}

/**
 * Capitalizes the first letter of any string variable
 * source: http://stackoverflow.com/a/1026087/477958
 */
function capitaliseFirstLetter(string) {
    return string.charAt(0).toUpperCase() + string.slice(1);
}

parseRSS('http://feedsifter.com/?f=http%3A%2F%2Fwww.gmanetwork.com%2Fnews%2Frss%2Fnews%2Fmetromanila&mrt&train&lrt&pnr','#news-container');
