$(function(){

	var ue = UE.getEditor('editor');

	onloadurl();

	$("#submitBtn").click(function(){

		var eventId = $("#eventId").val();
		var name = $("#name").val();
		var status = $("#status").val();
		var pic = $("#pic").val();
		var prop = $("#prop").val();
		var signable = $("#signable").val();

		var content= UE.getEditor('editor').getContent();
		var params = {
				eventId:eventId,
				name:name,
				status:status,
				prop:prop,
				signable:signable,
				pic:pic,
				content:content
		};

		var _httpURL = "";
		if(eventId==''){
			_httpURL = HttpRest+"event/create.shtml";
		}else{
			_httpURL = HttpRest+"event/save.shtml";
		}
		$.ajax({
			url: _httpURL, 
			type: "post", 
			dataType: "json",
			data:$.toJSON(params),   
			contentType:"application/json",
			success: function(data) { 
				if(data.code=='01'){
					layer.confirm('保存成功！是否关闭窗口?', function(index) {
						parent.grid.loadData();
						parent.layer.close(parent.pageii);
						return false;
					});
				}else{
					layer.msg('保存失败！',{icon: 5});
				}
			}
		});
	});

});