var is = false;
$(function() {
	// 初始化页面
	$("#te").on('click',function(){
		$("#title").focus();
	})
		$("#st").on('click',function(){
		$("#sort").focus();
	})
	var myfile = document.getElementById('qwer');
	myfile.remove();
	$("#img")
			.append(
					"<span class='file-wrapper' id='qwer'>"
							+ "<img src='"
							+ res
							+ "/third-party/img/message/upload.png'/>"
							+ "<input type='file' name='upload1' id='upload1' value='上传图片1' onchange='onUploadImgChange(this,1)'/>"
							+ "</span>");
	// 提交表单
	$("#compere_btn_save").on('click', function() {
		validate();
		if (is) {
			document.form1.action = "/auth/carousel/saveCarouselInfoList";
			document.form1.submit();
		}
	});
	$("#compere_btn_edit").on('click', function() {
		validate();
		if (is) {
			document.form1.action = "/auth/carousel/editCarouselInfo?id=" + id;
			document.form1.submit();
		}
	});
});
function validate() {
	if ($("#title").val()=="") {
		alert('标题不能为空！');
		return;
	} else if ($("#upload1").val()=="") {
		alert('您还没有上传图片！');
		return;
	} else
		is = true;
}
