// JavaScript Document
google.load("feeds", "1");

function initialize() {
  var feed = new google.feeds.Feed("http://www.oopshair.jp/blog/?feed=rss2");
  feed.load(function(result) {
    if (!result.error) {
      var container = document.getElementById("feed");
      for (var i = 0; i < result.feed.entries.length; i++) {
        var entry = result.feed.entries[i];
        var dd = new Date(entry.publishedDate); // now
        var yearNum = dd.getYear();
        if (yearNum < 2000) yearNum += 1900;
        var date = yearNum + "-"+(dd.getMonth()+1)+"-"+dd.getDate()+"";
        container.innerHTML += "<p>" + date +"   <a href='" + entry.link + "' target='_blank'>" + entry.title + "</a></p>";
      }
    }
  });
}
google.setOnLoadCallback(initialize);
$(document).ready(function(){

	// hide #back-top first
	$("#back-top").hide();
	
	// fade in #back-top
	$(function () {
		$(window).scroll(function () {
			if ($(this).scrollTop() > 100) {
				$('#back-top').fadeIn();
			} else {
				$('#back-top').fadeOut();
			}
		});

		// scroll body to 0px on click
		$('#back-top a').click(function () {
			$('body,html').animate({
				scrollTop: 0
			}, 800);
			return false;
		});
	});

});
