
var strPartName = "gfeed";		//RSSを表示するタグのID
var contentLength = 10;		//表示する記事数
var strFeedUrl  = "http://nagadenfudosansuzaka.blog15.fc2.com/?xml";		//FeedのURL

 
google.load("feeds", "1");

function initialize() {
  var feed = new google.feeds.Feed(strFeedUrl);
	feed.setNumEntries(contentLength);

  feed.load(function(result) {
    if (!result.error) {
      var container = document.getElementById(strPartName);

      var 	htmlstr = "<dl>"
      for (var i = 0; i < result.feed.entries.length; i++) {
        var entry = result.feed.entries[i];
		
        var strdate = createDateString(entry.publishedDate);
        htmlstr += "<dt>" + strdate + "</dt>";
        htmlstr += "<dd><a href=\"" + entry.link + "\">" + entry.title + "</a></dd>";
        
				/*
        var div = document.createElement("div");
        div.appendChild(document.createTextNode(entry.title));
        container.appendChild(div);
				*/
      }
      container.innerHTML = htmlstr + "</dl>";
    }
  });
}
google.setOnLoadCallback(initialize);
 

/* 日付フォーマット */
function createDateString(publishedDate){
  var pdate = new Date(publishedDate);

  var pyear = pdate.getFullYear();
  var pmonth = pdate.getMonth() + 1; if(pmonth < 10) pmonth = "0" + pmonth;
  var pday = pdate.getDate(); if(pday < 10) pday = "0" + pday;
  var phour = pdate.getHours(); if(phour < 10) phour = "0" + phour;
  var pminute = pdate.getMinutes(); if(pminute < 10) pminute = "0" + pminute;
  var psecond = pdate.getSeconds();
  //var strdate = pyear + "年" + pmonth + "月" + pday + "日" + phour + "時" + pminute + "分" + psecond + "秒";
  //var strdate = pyear + "/" + pmonth + "/" + pday + " " + phour + ":" + pminute;
    var strdate = pyear + "." + pmonth + "." + pday;
  return strdate;
}

