var EpExam = {};
var locked = false;

EpExam.addSubmit = function() {
	var id = $("#id").val();
	var checkState = $("#checkState").val();
	var checkMsg = $("#checkMsg").val();
	if(checkState == null || checkState == ""){
		Feng.info("请选择审核状态");
		return ;
	}
	if(checkMsg == null || checkMsg == ""){
		Feng.info("请填写审核意见");
		return ;
	}
	var da = {"id":id, "checkState":checkState, "checkMsg":checkMsg};
	var operation = function() {
		var ajax = new $ax(Feng.ctxPath + "/admin/enterprise/doExamine", function (data) {
			if (data.code == 200) {
				window.parent.Enterprise.table.refresh();
				parent.layer.closeAll();
			}
			Feng.info(data.msg);
		}, function (data) {
			Feng.error("操作失败!" + data.responseJSON.message + "!");
		});
		ajax.set(da);
		ajax.start();
	};
	Feng.confirm("确定提交吗?", operation);
};

EpExam.toggleField = function(){
	var checkState = $("#checkState").val();
	var checkMsg = $("#checkMsg").val();
	if(checkState==3){
		if(checkMsg == null || checkMsg == ''){
			$("#checkMsg").val("机构账号注册审核通过。");
		}
	}else{
		$("#checkMsg").val("");
	}
}

$(function () {
	var checkStateTemp = $("#checkStateTemp").val();
	if (checkStateTemp!=null && checkStateTemp!='' && checkStateTemp!=1) {
		$("#checkState").val(checkStateTemp);
	}
});