$(document).ready(function() {
	$('#startcheck').click(function(){
		$('#load').html('检测中');
		var self=$(this);
		if (self.attr("data-lock") === "true") return;
			else self.attr("data-lock", "true");
		var touin;
		$(".nocheck").each(function(){
			var checkself=$(this);
			uin=checkself.attr('uin');
			sid=checkself.attr('sid');
			touin=checkself.attr('uin');
			checkself.html("<img src='/css/images/load.gif' height=25>")
			var url="/dx.php";
			xiha.postData(url,'uin=touin='+touin, function(d) {
				if(d.code ==0){
					if(d.is==0){
						checkself.html("<font color='red'>NO</font>");
					}else{
						checkself.html("<font color='green'>OK</font>");
					}
				}else{
					alert(d.msg);
				}
			});
			//return false;
		});
		alert('检测完成');
		self.attr("data-lock", "false");
	});
});
var xiha={
	postData: function(url, parameter, callback, dataType, ajaxType) {
		if(!dataType) dataType='json';
		$.ajax({
			type: "POST",
			url: url,
			async: true,
			dataType: dataType,
			json: "callback",
			data: parameter,
			success: function(data) {
				if (callback == null) {
					return;
				} 
				callback(data);
			},
			error: function(error) {
				alert('创建连接失败');
			}
		});
	}
}