function doChecExaminationMst() {
	var title = $("#title").val();
	if (title==null || title.length < 1) {
		alert ("请输入试卷名称");
		return false;
	}
	var max_time = $("#max_time").val();
	if (max_time==null || max_time.length < 1) {
		alert ("请输入答题时间！");
		return false;
	}
	if (!isNumber(max_time)) {
		alert ("答题时间必须为数字");
		return false;
	}
	if (max_time < 300) {
		alert ("答题时间太短");
		return false;
	}

	document.examination_mst_edit.submit();
}

function doCheckCsv() {
	var csv_file = $("#csv_file").val();
	if (csv_file==null || csv_file.length < 1) {
		alert ("请输入CSV文件");
		return false;
	}	
	document.word_data_batch.submit();
}

function doCheckWordTheme() {
	var theme_type = $("#theme_type").val();
	if (theme_type==null || theme_type.length < 1) {
		alert ("请选择词集类型");
		return false;
	}
	
	var title = $("#title").val();
	if (title==null || title.length < 1) {
		alert ("请输入词集名称");
		return false;
	}
	document.word_theme_edit.submit();
}


function checkUploadMp3File() {
	$("#upload_thumbnail_preview").css("display", "");
	setImagePreview("upload_thumbnail_file", "upload_thumbnail_preview", "upload_thumbnail");
}

//上传词集封面
function checkUploadThemeFront() {
	$("#upload_thumbnail_preview").css("display", "");
	setImagePreview("upload_thumbnail_file", "upload_thumbnail_preview", "upload_thumbnail");
}


function searchWordTheme() {
	document.search_input.submit();
}

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

//词集添加单词
function addWord(theme_id, word_id) {
	//提交获取验证码
	$.ajax({
		url: 'if/ajax_operate_theme_word.php',
		type: 'post',
		dataType: 'json',
		data: {theme_id:theme_id, word_id:word_id, operate:'add'},
		async: false,
		success: function (data) {
			var html = data.html;
			$("#theme_word_list").html(html);
		}
	});
}

//词集删除单词
function removeWord(theme_id, word_id) {
	//提交获取验证码
	$.ajax({
		url: 'if/ajax_operate_theme_word.php',
		type: 'post',
		dataType: 'json',
		data: {theme_id:theme_id, word_id:word_id, operate:'remove'},
		async: false,
		success: function (data) {
			var html = data.html;
			$("#theme_word_list").html(html);
			
		}
	});
}

