﻿function callback(json) {
	var recent_html = '';
	var recent_html2 = '';
	var nowdate = new Date();
	var mon  = nowdate.getMonth() + 1;
	var date = nowdate.getDate();
	var bloglist = ''
	var monno ='';
	var dateno ='';
	$.each(json.items, function(){
		if(this.date != undefined) {
			if(this.id == 'luckybrunch'){
				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) }
				dateno = this.date.substring(8,10);
				if(mon == monno && date == dateno){ bloglist = 'bloglist' + '2' }else{ bloglist = 'bloglist' }
				recent_html += (
					'<li class=' + bloglist + '>' +
//						 this.date.substring(5,10).replace(/-/g, '/') +
						 monno + '/' + dayno +
						'　<a href="http://weblog.ctv.co.jp/' + this.id + '/" target="_top" >' + this.title.substring(0,14) + '</a>' +
					'</li>'
				);
			}
		}
	});
	$('#blogmain-box').html(recent_html).show();

	$.each(json.items, function(){
		if(this.date != undefined) {
			if(this.id == 'lucky'){
				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) }
				dateno = this.date.substring(8,10);
				if(mon == monno && date == dateno){ bloglist = 'bloglist' + '2' }else{ bloglist = 'bloglist' }
				recent_html2 += (
					'<li class=' + bloglist + '>' +
//						 this.date.substring(5,10).replace(/-/g, '/') +
						 monno + '/' + dayno +
						'　<a href="http://weblog.ctv.co.jp/' + this.id + '/" target="_top" >' + this.title.substring(0,14) + '</a>' +
					'</li>'
				);
			}
		}
	});
	$('#blogmain-box2').html(recent_html2).show();
};

$(function(){
	$.getJSON('http://ctv-dmd.net/ctvblog/update.jsonp?callback=?');
});

