$(function(){

	var hostId = localStorage.hostId;
	
	$("#submitBtn").click(function(){
		
		if(hostId == undefined || hostId==''||hostId==0){
			layer.msg('您还未登录！',{icon: 5});
			return;
		}
		
		var foldId = $("#foldId").val();
		var name = $("#name").val();
		var sys = $("#sys").val();
		var open = $("#open").val();
		
		var params = {
				foldId:foldId,
				name:name,
				open:open,
				sys:sys,
				hostId:hostId
		};

		var _httpURL = "";
		if(foldId==''){
			_httpURL = HttpRest+"folder/create.shtml";
		}else{
			_httpURL = HttpRest+"folder/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});
				}
			}
		});
	});

	onloadurl();
});