﻿google.load("feeds", "1");
var entryArray = new Array();
var entryNum = 0;
//alert(entryArray.length);

function initialize() {
feedAdd("http://www.iscraft.net/blog/atom.xml", 0);
feedAdd("http://www.aromapot.jp/blog/atom.xml", 0);
feedAdd("http://seiwa.pr-pro.jp/information/atom.xml", 0);
feedAdd("http://meganenokawaguchi.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://green-maki.pr-pro.jp/newinfo/atom.xml", 0);
feedAdd("http://nokhuuk.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://ichibankan.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://www.oigenchi.jp/oigenchiblog/atom.xml", 0);
feedAdd("http://sanopost.com/blog/atom.xml", 0);
feedAdd("http://www.keihin-kenma.jp/blog/atom.xml", 0);
feedAdd("http://crunchhair.com/blog/atom.xml", 0);
feedAdd("http://bowhair.jp/blog/atom.xml", 0);
feedAdd("http://mine.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://aflac.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://kawaguchi-sumai-ansin.co.jp/blog/atom.xml", 0);
feedAdd("http://kenchikukoubou-ishizue.jp/ishizue-blog/atom.xml", 0);
feedAdd("http://brighthair.jp/blog/atom.xml", 0);
feedAdd("http://taikengakushu.jp/local/atom.xml", 0);
feedAdd("http://satou-jidousha.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://dali-web.com/daliinformation/atom.xml", 0);
feedAdd("http://dali-web.com/daliblog/atom.xml", 0);
feedAdd("http://don-buono.com/blog/atom.xml", 0);
feedAdd("http://hada.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://mika.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://ebe-aircon.jp/blog/atom.xml", 0);
feedAdd("http://asli.pr-pro.jp/asliblog/atom.xml", 0);
feedAdd("http://yonemo.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://wataniku.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://www.crunchcare.jp/newinfo/atom.xml", 0);
feedAdd("http://colors-h-r.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://aikawa.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://kk-kawaguchi.co.jp/blog/atom.xml", 0);
feedAdd("http://denen.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://nudie.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://www.kakeinooishasan.com/oshirase/atom.xml", 0);
feedAdd("http://ontheroad.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://onoken.pr-barts.jp/blog/atom.xml", 0);
feedAdd("http://auto-garage-s.jp/blog/atom.xml", 0);
feedAdd("http://gaty-hair.com/gatyblog/atom.xml", 0);
feedAdd("http://hanzo2.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://hasegawasekizai.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://arc-t-design.com/blog/atom.xml", 0);
feedAdd("http://dakara.aromapot.jp/blog/atom.xml", 0);
feedAdd("http://benri-service.net/information/atom.xml", 0);
feedAdd("http://sato-dental-clinic.net/blog/atom.xml", 0);
feedAdd("http://nakacho-color.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://comfort-gotemba.com/estate/atom.xml", 0);
feedAdd("http://sano-kawara.com/blog/atom.xml", 0);
feedAdd("http://daysburger.pr-barts.jp/daysburgerblog/atom.xml", 0);
feedAdd("http://komagataya.pr-barts.jp/dagashi/atom.xml", 0);
feedAdd("http://komagataya.pr-barts.jp/plamodel/atom.xml", 0);
feedAdd("http://natural-sweet.pr-pro.jp/powapowablog/atom.xml", 0);
feedAdd("http://art-p.info/information/atom.xml", 0);
feedAdd("http://matsu-kenchiku.com/construct/atom.xml", 0);
feedAdd("http://natu-life.jp/blog/atom.xml", 0);
feedAdd("http://zeal-japan.net/blog/atom.xml", 0);
feedAdd("http://hugofjapan.com/blog/atom.xml", 0);
feedAdd("http://hanosuisan.co.jp/information/atom.xml", 0);
feedAdd("http://td.orpro.jp/blog/atom.xml", 0);
feedAdd("http://nakazono-kogyo.jp/blog/atom.xml", 0);
feedAdd("http://manokaihatsu.com/purchase/atom.xml", 0);
feedAdd("http://manokaihatsu.com/atom.xml", 0);
feedAdd("http://www.stk-s.co.jp/stkblog/atom.xml", 0);
feedAdd("http://seapara.jp/see/atom.xml", 0);
feedAdd("http://chibagrass.jp/blog/atom.xml", 0);
feedAdd("http://nakazono-kogyo.jp/construct/atom.xml", 0);
feedAdd("http://emuemu-corporation.com/purchase/atom.xml", 0);
feedAdd("http://antique-museum.com/ajmblog/atom.xml", 0);
feedAdd("http://www.miyabisetsubi.jp/blog/atom.xml", 0);
feedAdd("http://beach.returns.co.jp/blog/atom.xml", 0);
feedAdd("http://spapremium.returns.co.jp/blog/atom.xml", 0);
feedAdd("http://goldendoor.returns.co.jp/blog/atom.xml", 0);
feedAdd("http://ide-kenchiku.com/blog/atom.xml", 0);
feedAdd("http://www.shin-kowa.co.jp/product/atom.xml", 0);
feedAdd("http://www.shin-kowa.co.jp/cowablog/atom.xml", 0);
feedAdd("http://katsu-ken.net/blog/atom.xml", 0);
feedAdd("http://sajirushi.jp/blog/atom.xml", 0);
feedAdd("http://plus-style.net/design-blog/atom.xml", 0);
feedAdd("http://gochizo.jp/gochizo-blog/atom.xml", 0);
feedAdd("http://do-architects.jp/event-news/atom.xml", 0);
feedAdd("http://reformhouse-hosoi.com/reform-blog/atom.xml", 0);
feedAdd("http://isotomo.net/tsurikichi-blog/atom.xml", 0);
feedAdd("http://meganenomishima.pr-pro.jp/blog/atom.xml", 0);
feedAdd("http://office-u-coltd.com/officeublog/atom.xml", 0);
feedAdd("http://yashiro-car.com/yashiro-blog/atom.xml", 0);
feedAdd("http://jobyell.net/jobyell-blog/atom.xml", 0);
feedAdd("http://gaby.jp/blog/atom.xml", 0);
feedAdd("http://obihiro-yss.jp/information-qanda/atom.xml", 0);
feedAdd("http://www.yamada-design.co.jp/yamadadesign-blog/atom.xml", 0);
feedAdd("http://houchin-saikan.com/blog/atom.xml", 0);
feedAdd("http://cielo-home.com/cieloblog/atom.xml", 0);
feedAdd("http://kimononomuraki.com/feed.rss", 1);
}

//取得するフィードの追加（rssUrl：フィードのURL , boolNum：追加するフィードURLが最後の場合「1」を入れる）
function feedAdd(rssUrl, boolNum) {
var feed = new google.feeds.Feed(rssUrl);//フィードの取得
feed.setNumEntries(2);//ブログ1つあたりの取得するフィード数
feed.load(function(result) {
if (!result.error) {
for (var i = 0; i < result.feed.entries.length; i++) {
entryArray.push(result.feed.entries[i]);
var date = new Date(result.feed.entries[i].publishedDate);
entryArray[entryNum].sortDate = ( date.getFullYear()*10000 ) + ( (date.getMonth() + 1)*100 ) + date.getDate();//ソート用（日付）を連想配列に代入
entryArray[entryNum].blogName = result.feed.title;//ブログ名を連想配列に代入
entryNum+=1;
}
}
if(boolNum==1){
feedOutput("feed2", 39);//フィードの出力
}
});
}

//フィードの出力（feedId：出力するオブジェクトのID , listNum：出力するリスト数。「0」の場合全て）
function feedOutput(feedId, listNum){
var useFeed = "";
var container = document.getElementById(feedId);//表示部分を選択
entryArray = asort(entryArray, "sortDate");//日付でソート
if(listNum==0){
listNum = entryNum;
}
for (var i = 0; i < listNum; i++) {
var entry = entryArray[i];
var date = new Date(entry.publishedDate);//日付の表示変更
useFeed += '<li>' + date.getFullYear() + '/' + (date.getMonth() + 1 ) + '/' + date.getDate() + '　<a href="' + entry.link + '" target="_blank">' + entry.title + '</a>（' + entry.blogName + '）</li>';//HTMLで書き出し
}
container.innerHTML = '<ul>' + useFeed + '</ul>';
}
function asort(myArray, key){
//return myArray.sort ( function (b1, b2) { return b1[key] > b2[key] ? 1 : -1; } );//昇順
return myArray.sort ( function (b1, b2) { return b1[key] > b2[key] ? -1 : 1; } );//降順
}

google.setOnLoadCallback(initialize);
