function doCheck() {
	var title = $("#title").val();
	if (title==null || title.length < 1) {
		alert ("请输入题目");
		return false;
	}
	var selection1 = $("#selection1").val();
	if (selection1==null || selection1.length < 1) {
		alert ("请输入选择项1");
		return false;
	}
	var selection2 = $("#selection2").val();
	if (selection2==null || selection2.length < 1) {
		alert ("请输入选择项2");
		return false;
	}
	var selection3 = $("#selection3").val();
	if (selection3==null || selection3.length < 1) {
		alert ("请输入选择项3");
		return false;
	}	
	var selection4 = $("#selection4").val();
	if (selection4==null || selection4.length < 1) {
		alert ("请输入选择项4");
		return false;
	}	
	document.subject_data_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 searchSubject() {	
	document.subject_dat_list.submit();
}

function addSubject2Mst(mst_id,index) {
	var subject_id = $("#subject_id" + index).val();
	window.location.href = "examination_dat_operate.php?action=add&mst_id=" + mst_id + "&subject_id=" + subject_id;
}



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);
			
		}
	});
}