﻿function callback(json) {
	var recent_html = '';
	var nowdate = new Date();
	var mon  = nowdate.getMonth() + 1;
	var date = nowdate.getDate();
	var blogid = ''
	var monno ='';
	var dateno ='';
	var timeno = '';
	$.each(json.items, function(){
		if(this.date != undefined) {
			if(this.id == 'satou' || this.id == 'fujii' || this.id == 'yoshida' || this.id == 'obara' || this.id == 'mizutani' || this.id == 'ksatou' || this.id == 'ondachii' || this.id == 'ehonda' || this.id == 'maeda' || this.id == 'shonda' || this.id == 'matsuoka' || this.id == 'agatsuma' || this.id == 'shikanai' || this.id == 'kashida' || this.id == 'toida'){
				if(this.date.substring(5,7) < '10'){ monno = this.date.substring(6,7) }else{ monno = this.date.substring(5,7) }
				if(this.date.substring(8,10) < '10'){ dayno = '&nbsp;' + this.date.substring(9,10) }else{ dayno = this.date.substring(8,10) }
				if(this.date.substring(11,13) < '10'){ timeno = this.date.substring(12,14) + this.date.substring(14,16) }else{ timeno = this.date.substring(11,16) }
				dateno = this.date.substring(8,10);
				if(mon == monno && date == dateno){ blogid = this.id + '2' }else{ blogid = this.id }
				recent_html += (
//					'<li class="blogBox" id="a_' + this.id + '">' +
					'<li class="blogBox" id="a_' + blogid + '">' +
//						'<a href="http://weblog.ctv.co.jp/' + this.id + '" title="' + this.title + '" /">' + this.blogtitle + '</a>' +
//						'<a href="http://weblog.ctv.co.jp/' + this.id + '" onmouseover="Tip(\'<strong>' + this.title + '</strong><br/>' + this.blogtitle + '<br/>　' + monno + '/' + dayno + '　' + this.date.substring(11,16) + 'up!' + '\', FADEIN, 100, FADEOUT, 100)" onmouseout="UnTip()" /">' + this.blogtitle + '</a>' +
						'<a href="http://weblog.ctv.co.jp/' + this.id + '" onmouseover="Tip(\'' + this.blogtitle + '<br/>　' + monno + '/' + dayno + '　' + timeno + 'up!' + '\', TITLE, \'' + this.title + '\', FONTSIZE, \'12px\', FADEIN, 100, FADEOUT, 100)" onmouseout="UnTip()" /">' + this.blogtitle + 
						'<div class="blog_up">' +
						'<span class="blog_day">' +
//						 this.date.substring(5,10).replace(/-/g, '/') +
						 monno + '/' + dayno + 'up!</span></div>' + '</a>' +
					'</li>'
				);
			}
		}
	});
	$('#blogmain-box').html(recent_html).show();
};

$(function(){
	$.getJSON('http://ctv-dmd.net/ctvblog/update.jsonp?callback=?');
});

