function searchUser(mobile) {
	var key_word = $("#key_word").val();
	if (key_word==null || key_word.length < 1) {
		return false;
	}
	$.ajax({
		url: 'if/ajax_search_user.php',
		type: 'post',
		dataType: 'json',
		data: {mobile:key_word},
		async: false,
		success: function (data) {
			var html = data.html;
			$("#search_user_list").html(html);
		}
	});
}

//词集学员
function addUser(user_id, nickname) {
	//拼接html
	var func_html = "removeUser(" + user_id + ")";
	var child_html = "<div id='selected_user_" + user_id + "' class='selected_user_item' onClick='" + func_html + "'>" + nickname + "</div>";
	//添加子节点
	var user_ids = $("#user_ids").val();
	//没有的话就添加
	if(user_ids.indexOf("_" + user_id) == -1) {
		user_ids += "_" + user_id;
		$("#user_ids").val(user_ids);
		$("#selected_user_list").append(child_html);
	}
}

//词集删除单词
function removeUser(user_id) {
	//提交获取验证码
	var user_ids = $("#user_ids").val();
	user_ids = user_ids.replace("_" + user_id, '');
	$("#user_ids").val(user_ids);
	$("#selected_user_list").children().filter("#selected_user_" + user_id).remove();
}

function doCheck() {
	var title = $("#title").val();
	if (title==null || title.length < 1) {
		alert ("请输入名称");
		return false;
	}
	var live_url = $("#live_url").val();
	if (live_url==null || live_url.length < 1) {
		alert ("请直播间地址");
		return false;
	}
	var user_ids = $("#user_ids").val();
	if (user_ids==null || user_ids.length < 1) {
		alert ("请指定学员");
		return false;
	}
	
	document.user_class_batch_input.submit();
}