// JavaScript Document
$(document).ready(function() {  
						   
 $("#toTop").hide();  
  
 $(window).scroll(function () {  
  if ($(this).scrollTop() > 500) {  
   $('#toTop').fadeIn();  
  } else {  
   //隠す  
   $('#toTop').fadeOut();  
  }  
 });
}); 

/* ブログタイトル 月-日 時:分 */
function test2() {

	$('#feeds').googleMultiFeed({
    urls: [
			'http://www.lovedisney.net/blog/rss.xml',
			'http://feedblog.ameba.jp/rss/ameblo/yu-chip-dale/rss20.xml',
			'http://rss.exblog.jp/rss/exblog/queselog/index.xml',
			'http://potepotechi0209.blog14.fc2.com/?xml'
	],
    numEntries: 1,
	format: titleOnly
  	});

};

/* エントリータイトル[ブログタイトル] 年-月-日 */
function test3() {

	$('#feeds').googleMultiFeed({
    urls: [
			'http://www.lovedisney.net/blog/rss.xml',
			'http://feedblog.ameba.jp/rss/ameblo/yu-chip-dale/rss20.xml',
			'http://rss.exblog.jp/rss/exblog/queselog/index.xml',
			'http://potepotechi0209.blog14.fc2.com/?xml'
	],
    numEntries: 1
  	});

};

function titleOnly(entry, feed) {
  var link = $('<a />').attr({href: entry.link, target: "_blank"}).text(feed.title);
  var strdate = createDateString(entry.publishedDate);
  return $('<li />').append(link,strdate);
}

function createDateString(publishedDate){
  var pdate = new Date(publishedDate);

  var pday = pdate.getDate();
  if (pday < 10) {pday = "0" + pday;}
  var pmonth = pdate.getMonth() + 1;
  if (pmonth < 10) {pmonth = "0" + pmonth;}
  var pyear = pdate.getFullYear();
  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 ptime = pdate.getTime();
  var newptime = ptime + 43200000;
  var nowtime = new Date().getTime();
  if (nowtime < newptime){
	  var newmark = "<span style=\"color:red;\">new!</span>";
  } else {
	  var newmark = "";
  }
  
  /*
  var strdate = " " + nowtime + " " + newptime;
  */

  var strdate = "<br />" + pmonth + "-" + pday + " " + 
              phour + ":" + pminute + " " + newmark;

  return strdate;
}


