
function searchKnow() {
	var keywords = $("#keyword");
	var searchform = $("#searchform");
	if (keywords.val() == "") {
		alert("请输入关键字！");
		keywords.focus();
	} else {
		searchform.submit();
		window.event.returnValue = false;
	}
}
function setKnow(id) {
	var img = '';
	for ( var i = 1; i < 4; i++) {
		if (i == id) {
			document.getElementById('Know' + i).className = 'knowmenu_yes';
			document.getElementById('KnowBox' + i).style.display = '';
		} else {
			document.getElementById('Know' + i).className = '';
			document.getElementById('KnowBox' + i).style.display = 'none';
		}
	}
	if(id==2){		
		var data="keywords="+$("#keywords").val()+"&qtid="+$("#qtid").val()+"&status="+0+"&id="+id;
		showQuestion(data,2);
	}else if(id==3){
		var data="keywords="+$("#keywords").val()+"&qtid="+$("#qtid").val()+"&status="+1+"&id="+id;
		showQuestion(data,3);
	}
}

function setKonwType(id){
	for ( var i = 1; i < 4; i++) {
		if (i == id) {
			document.getElementById('Know' + i).className = 'knowmenu_yes';
			document.getElementById('KnowBox' + i).style.display = '';
		} else {
			document.getElementById('Know' + i).className = '';
			document.getElementById('KnowBox' + i).style.display = 'none';
		}
	}
}

$(document).ready( function() {
	$("#loading2").ajaxStart( function() {
		$(this).show();
	});
	$("#loading2").ajaxStop( function() {
		$(this).hide();
	});
	$("#loading3").ajaxStart( function() {
		$(this).show();
	});
	$("#loading3").ajaxStop( function() {
		$(this).hide();
	});
});

function showQuestion(data,id){
	$.ajax( {
		url : url+"/KnowShow/showQuestion",
		type : 'GET',
		data: data,//对页面所有input元素进行序列化
		dataType : 'html',
		error : function() {
			//alert('Error loading XML document');
		},
		success : function(data) {
			$("#KnowBox"+id).html(data);
		}
	});
}
function checkform(){
	var acontent=$("#acontent");
	if(""==$.trim(acontent.val())){
		alert("请输入答案内容！");
		acontent.focus();
		return false;
	}
}
