$(function(){	
        $.ajax({
            url: 'js/proxy.php?url=http://www.earlywing.com/staff/feed',
            async: true,
            cache: true,
            dataType: "xml",
            success: function(xml){
				$('#information').html('');
                $(xml).find('item').each(function(i){
                    if (i == 7) {
                        return false;
                    }
                    var title = $(this).find('title').text();
                    var url = $(this).find('link').text();
                    var date = $(this).find('pubDate').text();
                    //月表示を数字表示に変換する
                    date = dateChanger(date);
                    $('#information').append('<h2>' + date + '&nbsp;<a href="' + url + '">' + title + '</a></h2>');
                });

            },
            //エラー表示
            error: function(xml){
                $('#information').html('<h2>最新情報の読み込みに失敗しました。</h2>');
            }
        });
        //月表示を数字表示に変換する
        var dateChanger = function(str){
            var mydate = new Date(str);
            yy = mydate.getFullYear();
            mm = mydate.getMonth() + 1;
            dd = mydate.getDate();
            if (mm < 10) { mm = "0" + mm; }
            if (dd < 10) { dd = "0" + dd; }
            datestr = yy + "年" + mm + "月" + dd + "日";
            return datestr;
        };
});


