$(function() {
	// 連携キット、local時はexit
	if ($.LiVE.bdkit && location.protocol=="file:") return;
	
	var $counter = $.LiVE.Elements.WIDGETS.counter.find(".default_l_b");
	$counter.each(function() {
	
		var id = $(this).parent().attr("id"),
			data = $.LiVE.widget[id].data,
			targetDate = new Date(data.set[0],data.set[1]-1,data.set[2]),
			_counter = $("#counter-" + id);
		
		var d = new Date(),
			secs = d.getSeconds(),
			mins = d.getMinutes(),
			hours = d.getHours(),
			day = d.getDate(),
			month = d.getMonth(),
			year = d.getFullYear(),
			daysec = new Date(year,month,day,hours,mins);
			diff = Math.ceil((targetDate - daysec)/86400000);
		if ( 0 >= diff ) diff = 0;
		_counter.text(diff);
	});
});