google.load("feeds", "1");
function initialize() {
  var feedurl = "http://imaimasaru.seesaa.net/index.rdf";
  var feed = new google.feeds.Feed(feedurl);
  feed.setNumEntries(6);
  feed.load(dispfeed);

  function dispfeed(result){
    if (!result.error){
      var container = document.getElementById("feed");
      var htmlstr = "<dl>";
//      htmlstr += '<h2><a href="' + result.feed.link + '">' + result.feed.title + '</a></h2>';
//      htmlstr += "<p>説明:" + result.feed.description + "</p>";
//      htmlstr += "<p>作成者:" + result.feed.author + "</p>";
      var n = 0;
      for (var i = 0; i < result.feed.entries.length; i++) {
        var entry = result.feed.entries[i];
		if(entry.title.substr(0,4) != "[PR]" && n <3) {

        var strdate = createDateString(entry.publishedDate);
        htmlstr += '<dt>' + strdate + "</dt>";
        htmlstr += '<dd class="blogTtl"><a href="' + entry.link + '">' + entry.title;
/*        htmlstr += '<dd><a href="' + entry.link + '">' + entry.title.substr(0,10);
		if(entry.title.length  >10) {
	        htmlstr += '…';
		}*/
        htmlstr += '</a></dd>';
        htmlstr += '<dd class="blogTxt">' + entry.content.substr(0,46);
		if(entry.content.length  >46) {
	        htmlstr += '…';
		}
        htmlstr += "</dd>";
		
		n=n+1;
//        htmlstr += '<dd class="blogTxt">' + entry.contentSnippet.substr(0,46) + "</dd>";
/*        htmlstr += "<p>[カテゴリ]";
        for (var j = 0; j < entry.categories.length; j++) {
          htmlstr += "[" + entry.categories[j] + "]";
        }
        htmlstr += "</p>";*/
		}
      }
      htmlstr += "</dl>";

       container.innerHTML = htmlstr;
    }else{
       alert(result.error.code + ":" + result.error.message);
    }
  }

}
function createDateString(publishedDate){
  var pdate = new Date(publishedDate);

  var pday = pdate.getDate();
  var pmonth = pdate.getMonth() + 1;
  var pyear = pdate.getFullYear();
  var phour = pdate.getHours();
  var pminute = pdate.getMinutes();
  var psecond = pdate.getSeconds();
//  var strdate = pyear + "年" + pmonth + "月" + pday + "日" + 
//              phour + "時" + pminute + "分" + psecond + "秒";
//  var strdate = pyear + "." + pmonth + "." + pday  ;
  var strdate = pyear + "年" + pmonth + "月" + pday + "日" ;

  return strdate;
}

    google.setOnLoadCallback(initialize);

