$(function() {
	$.ajax({
		type: 'GET',
		url: 'https://www.dnpw.org/cn/api404-gohome.do?time='+Date(),
		dataType: 'json',
		success: function(result) {
			addBox(result);
			addBox2(result)
		}
	})
});




function addBox(result) {
	$.each(result, function(index, obj) {
		
		$('#babyinfo').append("<div class='hideit " + obj['current'] + "'><div class='child_avatar'><a href=" + obj['url'] + " target='_blank'><img src='"+obj['avatar']+"_140_188_2_90.jpg'></a></div><div class='child_info'><div class='info_name'><h2><span class='name_inner'>" + obj['name'] + "</span><span class='info_sex'>（" + obj['sex'] + "）</span></h2></div><p>出生日期：" + obj['born'] + "</p><p>走失时间：" + obj['dis_time'] + "</p><p>走失地点：" + obj['dis_address'] + "</p><p class='lh-s'>相关详情：" + obj['detail'] + "</p><a href=" + obj['url'] + " target='_blank' class='link_view'><span class='link_inner'>查看详情… &gt;&gt;</span></a></div></div>");
	
	})
}






function addBox2(result) {
	$.each(result, function(index, obj) {
		$('#showlist').append("<li class='dnpw-mod-li " + obj['current'] + "s'><div class='dnpw-mod-img horizon'><div class='dnpw-mod-link-wrap'><a class='dnpw-mod-link'><img src='" + obj['avatar'] + "_100_100_2_85.jpg' class='dnpw-mod-cover fadeOutIn-enter-active'><div class='nub-tl'></div></a></div><div class='title-wrap'><p class='main'><a class='link-txt'>" + obj['name'] + "</a></p></div></div></li>");
	})
}





$('#showlist').on('click', 'li', function() {
	$(this).addClass('currents').siblings().removeClass('currents');
	$('.hideit').eq($(this).index()).addClass('current').siblings().removeClass('current');
});





$(function() {
	$.ajax({
		type: 'GET',
		url: 'https://www.dnpw.org/cn/api-thank?you=' + document.domain + '&style=12',

	})
});




//BAIDU STAT
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?bf329994f1e3ebf56f3712e11a46cb4a";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
