var highLightIndex = -1;
$(function() {
	var O_Type = $("#O_Type");
	var mainlist = $("#mainlist");
	var O_AreaDrop = $("#areaDrop");
	var O_HotelDrop = $("#hotelDrop");
	var O_RoomDrop = $("#roomDrop");
	var O_SearchBtn = $("#O_SearchBtn");
	var O_Key = $("#searchKey");
	var O_KeyOffset = O_Key.offset();
	var O_Auto = $("#auto");
	var O_AutoF = $("#autoF");
	O_Auto.hide(); //隐藏自动补全框
	O_AutoF.hide(); //隐藏自动补全框
	var top = O_KeyOffset.top + O_Key.height() + 5;
	var left = O_KeyOffset.left;
	O_Auto.css("border", "1px solid #817F82")
	.css("background-color", "#fff")
	.css("position", "absolute")
	.css("z-index", "1000")
	.css("top", top)
	.css("left", left)
	.css("width", O_Key.width() + 3);
	
	var O_Flush = $("#O_Flush");
	O_Flush.hide();
	mainlist.find(".page").click(function() {
		mainlist.find("#loading").show();
		pageClick(this);
	});
	//点击区域搜索下拉列
	O_AreaDrop.change(function() {
		var areaId = O_AreaDrop.val();
		$.post("?m=admin/hotel.getListByArea", { areaId:areaId, pageSize:0, json:true }, function(data) {
			O_HotelDrop.empty();
			O_HotelDrop.append("<option value=\"\">==酒店==</option>");
			$.each(data, function(id, item) {
				O_HotelDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
			});
			O_Key.val("");
			var hotelId = O_HotelDrop.val();
			O_RoomDrop.empty();
			O_RoomDrop.append("<option value=\"\">==客房==</option>");
			if(hotelId.length > 0) {//选了具体酒店
				$.post("?m=admin/room.getListByHotel", { hotelId:hotelId, pageSize:0, json:true }, function(data) {
					$.each(data, function(id, item) {
						O_RoomDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
					});
				}, "json");
			}
			//设置列表类型
			var O_Type = $("#O_Type");
			if(hotelId.length > 0) {
				O_Type.val("byhotel");
			} else {
				O_Type.val("list");
			}
			loadList(1);//加载列表
		}, "json");
		
	});
	//点击酒店筛选下拉列
	O_HotelDrop.change(function() {
		var hotelId = O_HotelDrop.val();
		if(hotelId.length > 0) {//选了具体酒店
			O_Key.val(O_HotelDrop.find("option:selected").text());
			$.post("?m=admin/room.getListByHotel", { hotelId:hotelId, pageSize:0, json:true }, function(data) {
				O_RoomDrop.empty();
				O_RoomDrop.append("<option value=\"\">==客房==</option>");
				$.each(data, function(id, item) {
					O_RoomDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
				});
			}, "json");
		} else {//没选酒店
			O_Key.val("");
			var areaId = "";
			O_AreaDrop.attr("value", areaId);
			$.post("?m=admin/hotel.getListByArea", { areaId:areaId, pageSize:0, json:true }, function(data) {
				O_HotelDrop.empty();
				O_HotelDrop.append("<option value=\"\">==酒店==</option>");
				$.each(data, function(id, item) {
					O_HotelDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
				});
				O_RoomDrop.empty();
				O_RoomDrop.append("<option value=\"\">==客房==</option>");
			}, "json");
		}
		//设置列表类型
		var O_Type = $("#O_Type");
		if(hotelId.length > 0) {
			O_Type.val("byhotel");
		} else {
			O_Type.val("list");
		}
		loadList(1);//加载列表
		updateFormSrc();//更新所有上传Form的Src属性
	});	
	//点击客房筛选下拉列
	O_RoomDrop.change(function() {
		$("#O_Type").val("byhotelandroom");
		loadList(1);//加载列表
		updateFormSrc();//更新所有上传Form的Src属性
	});	
	O_SearchBtn.click(function(){
		hotelSearch();
	});
	O_Key.focus();
	O_Key.keyup(function(event) {
		var myEvent = event || window.event;
		var keyCode = myEvent.keyCode;//alert(keyCode);
		var key = O_Key.val().replace(/ /g, '').replace(/'/g, '');
		if(key.length > 0) {
			if(keyCode >= 48 && keyCode <= 57 || keyCode >= 65 && keyCode <= 90 || keyCode == 8 || keyCode == 46 || keyCode == 32) {//alert(keyCode);
				highLightIndex = -1;
				var field = "name";
				getKeyList(field, key);
			} else if (keyCode == 38 || keyCode == 40) {//alert(keyCode);
				//向上/向下箭头
				var nodes = O_Auto.children("div");
				//使未向上移时的当前项底色去掉
				if(highLightIndex != -1) { nodes.eq(highLightIndex).css("background-color", "#fff"); }
				if(keyCode == 38) { //向上
					nodes.css("background-color", "#fff").css("border", "1px solid #fff");
					highLightIndex--;
					if(highLightIndex == -1) { highLightIndex = nodes.length - 1; }
				}
				if(keyCode == 40) { //向下
					nodes.css("background-color", "#fff").css("border", "1px solid #fff");
					highLightIndex++;
					if(highLightIndex == nodes.length) { highLightIndex = 0; }
				}
				//使用当前项高亮
				nodes.eq(highLightIndex).css("background-color", "#eee").css("border", "1px solid #ccc");
			} else if (keyCode == 13) {
				//如果输入的是回车
				//如果下拉框有高亮内容
				if(highLightIndex != -1) {
					O_Key.val(O_Auto.children("div").eq(highLightIndex).html());
					highLightIndex = -1;
					O_Auto.html("");
					O_AutoF.hide();O_Auto.hide();
				} else {
					O_SearchBtn.trigger("click");
				}
			} else {
			}
		} else {
			highLightIndex = -1;
			O_Auto.html("");
			O_AutoF.hide();O_Auto.hide();
			//绑定回车键与点击快捷搜索一致
			if (keyCode == 13) { O_SearchBtn.trigger("click"); }
		}
		
	});
	//搜索失去焦点
	O_Key.blur(function() {
		if(highLightIndex != -1) {
			var nodes = O_Auto.children("div");
			O_Key.val(nodes.eq(highLightIndex).html());
			highLightIndex = -1;
		}
		O_AutoF.hide();
		O_Auto.hide();
		O_SearchBtn.focus();
	});
	//点击搜索关键字
	O_Key.click(function() {
		var field = "name";
		var key = O_Key.val().replace(/ /g, '').replace(/'/g, '');
		getKeyList(field, key);
	});
	//设为封面图片
	var O_SetDefaultPhoto = $(".setDefaultPhoto");
	O_SetDefaultPhoto.click(function() {
		var page = $("#O_CurrentPage").val();
		setDefaultPhoto(this, page);
	});
	//点选删除
	var O_DelPhoto = $(".delPhoto");
	O_DelPhoto.click(function() {
		delPhoto(this);
	});
	getCount();
});
//获取关键字列表
function getKeyList(field, key){
	var O_Auto = $("#auto");
	var O_AutoF = $("#autoF");
	var O_Key = $("#searchKey");
	var O_KeyOffset = O_Key.offset();
	if(key.length > 0) {
		$.post("?m=admin/hotel.simpleSearch", { field:field, key:key, json:true }, function(data) {//alert(data);
			var str = "";
			$.each(data, function(id, item) {
				str += "<div>" + item.name + "</div>";
			});
			if(str.length > 0) {
				O_Auto.html(str);
				var top = O_KeyOffset.top + O_Key.height() + 5;
				var left = O_KeyOffset.left;
				O_Auto.css("top", top)
				.css("left", left);
				
				var width = O_Auto.width();
				var height = O_Auto.height() + 10;
				if($.browser.mozilla) {//修正火狐偏差
					width = width - 2;
					height = height - 4;
				}
				O_AutoF.css("top", top)
				.css("left", left)
				.css("width", width)
				.css("height", height);

				O_Auto.show();
				O_AutoF.show();
				
				var nodes = O_Auto.children("div");
				var width = O_Auto.width() - 2;
				nodes.each(function(i) {
					var node = $(this);
					node.attr("id", i).css("width", width).css("cursor", "pointer").css("overflow", "hidden").css("line-height", "25px").css("height", "25px").css("border", "1px solid #fff");
					//鼠标移上
					node.mouseover(function() {
						nodes.css("background-color", "#fff").css("border", "1px solid #fff");
						highLightIndex = this.id; 
						node.css("background-color", "#eee").css("border", "1px solid #ccc");
					});
					//鼠标离开
					node.mouseout(function() {
						node.css("background-color", "#fff").css("border", "1px solid #fff");
						highLightIndex = -1;
					});
					//鼠标点击
					node.click(function() {
						O_Key.focus();
						O_Key.val(node.html());
						highLightIndex = -1;
						O_Auto.html("");
						O_AutoF.hide();
						O_Auto.hide();
					});
				});
			} else {
				O_Auto.html("");
				O_AutoF.hide();
				O_Auto.hide();
			}
		}, "json");
	} else {
		O_Auto.html("");
		O_AutoF.hide();
		O_Auto.hide();
	}
}
//酒店搜索
function hotelSearch() {
	var O_Panel = $(".todayinfo1");
	var mainlist = $("#mainlist");
	var O_AreaDrop = O_Panel.find("#areaDrop");
	var O_HotelDrop = O_Panel.find("#hotelDrop");
	var O_RoomDrop = O_Panel.find("#roomDrop");
	var v_field = "name";
	var O_Key = $("#searchKey");
	var v_key = O_Key.val().replace(/ /g, '').replace(/'/g, '');
	var O_SearchBtn = $("#O_SearchBtn");
	O_SearchBtn.html("搜索中...");
	$.post("?m=admin/hotel.getCount", { field:v_field, key:v_key }, function(data) {
		var count = data.all;
		if(count > 1) {
			//2个以上酒店
			$.post("?m=admin/hotel.simpleSearch", { field:v_field, key:v_key, pageSize:0, json:true }, function(data) {//alert(data);
				O_HotelDrop.empty();
				O_HotelDrop.append("<option value=\"\">==酒店==</option>");
				$.each(data, function(id, item) {
					O_HotelDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
				});
				O_SearchBtn.html("搜索酒店");
			}, "json");
		} else if(count == 0) {
			var areaId = "";
			$.post("?m=admin/hotel.getListByArea", { areaId:areaId, pageSize:0, json:true }, function(data) {
				O_HotelDrop.empty();
				O_HotelDrop.append("<option value=\"\">==酒店==</option>");
				$.each(data, function(id, item) {
					O_HotelDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
				});
				O_SearchBtn.html("搜索酒店");
			}, "json");
		} else if(count == 1) {
			$.post("?m=admin/hotel.getInfoByName", { name:v_key }, function(data) {
				if(data != null) {
					var areaId = data.areaId;
					var hotelId = data.id;
					O_AreaDrop.attr("value", areaId);
					$.post("?m=admin/hotel.getListByArea", { areaId:areaId, pageSize:0, json:true }, function(data) {
						O_HotelDrop.empty();
						O_HotelDrop.append("<option value=\"\">==酒店==</option>");
						$.each(data, function(id, item) {
							O_HotelDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
						});
						O_HotelDrop.attr("value", hotelId);
						$.post("?m=admin/room.getListByHotel", { hotelId:hotelId, pageSize:0, json:true }, function(data) {
							O_RoomDrop.empty();
							O_RoomDrop.append("<option value=\"\">==客房==</option>");
							$.each(data, function(id, item) {
								O_RoomDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
							});
						}, "json");
						O_SearchBtn.html("搜索酒店");
					}, "json");
				} else {
					O_Flush.show();
					var areaId = "";
					O_AreaDrop.attr("value", areaId);
					$.post("?m=admin/hotel.getListByArea", { areaId:areaId, pageSize:0, json:true }, function(data) {
						O_HotelDrop.empty();
						O_HotelDrop.append("<option value=\"\">==酒店==</option>");
						$.each(data, function(id, item) {
							O_HotelDrop.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
						});
						O_SearchBtn.html("搜索酒店");
					}, "json");
				}
			}, "json");
		}
	}, "json");
}
//点击状态按钮
function statusClick(v_status) {
	var mainlist = $("#mainlist");
	var O_Flush = $("#O_Flush");
	//设置列表类型
	$("#O_Type").val("bystatus");
	$("#currentStatus").val(v_status);
	O_Flush.show();
	$.post("?m=admin/photo.getListByStatus", { status:v_status }, function(data) {
		mainlist.html(data);
		mainlist.find(".page").click(function() {
			mainlist.find("#loading").show();
			pageClick(this);
		});
		O_Flush.hide();
	});
}
//设置封面
function setDefaultPhoto(obj, page) {
	var ary = obj.value.split('=');
	var photoId = ary[0];
	highLightItem(photoId);//高亮项
	if(obj.checked == false) {
		photoId = 0;
	}
	$.post("?m=admin/hotel.updateCoverHandle", { id:ary[1], cover:photoId }, function(data) {//alert(data);
		if(data[0] == "success") {
			loadList(page, photoId);
		} else {
			alert(data[1]);
		}
	}, "json");
}
//加载列表
function loadList(page, linehighId) {
	var v_type = $("#O_Type").val();
	var O_Flush = $("#O_Flush");
	O_Flush.show();
	if(v_type == "list") {
		$.post("?m=admin/photo.getList", { page:page }, function(data) {
			var mainlist = $("#mainlist");
			mainlist.html(data);
			mainlist.find(".page").click(function() {
				mainlist.find("#loading").show();
				pageClick(this);
			});
			mainlist.find(".setDefaultPhoto").click(function() {
				setDefaultPhoto(this, page);
			});
			mainlist.find(".delPhoto").click(function() {
				delPhoto(this);
			});
			if(linehighId) {
				mainlist.find("#O_ItemPhoto_" + linehighId).addClass("on");//高亮行
			}
			O_Flush.hide();
		});
	} else if(v_type == "byhotel") {
		var hotelId = $("#hotelDrop").val();
		$.post("?m=admin/photo.getListByHotel", { hotelId:hotelId, page:page }, function(data) {
			var mainlist = $("#mainlist");
			mainlist.html(data);
			mainlist.find(".page").click(function() {
				mainlist.find("#loading").show();
				pageClick(this);
			});
			mainlist.find(".setDefaultPhoto").click(function() {
				setDefaultPhoto(this, page);
			});
			mainlist.find(".delPhoto").click(function() {
				delPhoto(this);
			});
			if(linehighId) {
				mainlist.find("#O_ItemPhoto_" + linehighId).addClass("on");//高亮行
			}
			O_Flush.hide();
		});
	} else if(v_type == "byhotelandroom") {
		var hotelId = $("#hotelDrop").val();
		var roomId = $("#roomDrop").val();
		$.post("?m=admin/photo.getListByHotelAndRoom", { hotelId:hotelId, roomId:roomId, page:page }, function(data) {
			var mainlist = $("#mainlist");
			mainlist.html(data);
			mainlist.find(".page").click(function() {
				mainlist.find("#loading").show();
				pageClick(this);
			});
			mainlist.find(".setDefaultPhoto").click(function() {
				setDefaultPhoto(this, page);
			});
			mainlist.find(".delPhoto").click(function() {
				delPhoto(this);
			});
			if(linehighId) {
				mainlist.find("#O_ItemPhoto_" + linehighId).addClass("on");//高亮行
			}
			O_Flush.hide();
		});
	}
}
//点选删除
function delPhoto(obj) {
	var item = $(obj).parent().parent();
	if(obj.checked) {
		item.addClass("ondel");
	} else {
		item.removeClass("ondel");
		$("#o_delall").attr("checked", false);
	}
}
//分页点击
function pageClick(t){
	loadList(t.id);
}
//首页
function firstPage(){
	var O_FirstPage  = document.createElement("span");
	O_FirstPage.id = "1";
	$("#loading").show();
	pageClick(O_FirstPage);
}
//上一页
function prevPage(){
	var prevPage = parseInt($("#O_CurrentPage").val()) - 1;
	var O_PrevPage = $("#" + prevPage.toString());
	O_PrevPage.triggerHandler("click");
}
//下一页
function nextPage(){
	var nextPage = parseInt($("#O_CurrentPage").val()) + 1;
	var O_NextPage = $("#" + nextPage.toString());
	O_NextPage.triggerHandler("click");
}
//尾页
function lastPage(){
	var pageCount = parseInt($("#O_PageCount").val());
	var O_LastPage  = document.createElement("span");
	O_LastPage.id = pageCount.toString();
	$("#loading").show();
	pageClick(O_LastPage);
}
//跳转到下拉列
function goPage() {
	var O_Page = $("#O_Page");
	var O_Go = $("#O_Go");
	var O_GoPage  = document.createElement("span");
	O_GoPage.id = O_Page.val();
	$("#loading").show();
	pageClick(O_GoPage);
}
//添加图片
function addClick() {
	$("#divUpdate h1 span").html("酒店图片信息添加");
	var O_Content = $("#contentUpdate");
	O_Content.html('<div style="width:580px;height:200px;_height:300px;font-size:14px;text-align:center;"><div style="margin-top:120px;margin-bottom:15px;">正在加载...</div><img src="theme/admin/images/loading.gif"></div>');
	setUpdate();
	$.post("?m=admin/photo.add", {}, function(data) {//alert(data);
		O_Content.html(data);
		setUpdate();
		var O_HotelDrop_Photo = O_Content.find("#O_HotelDrop_Photo");
		var O_RoomDrop_Photo = O_Content.find("#O_RoomDrop_Photo");
		//酒店下拉表
		O_HotelDrop_Photo.change(function() {
			var v_hotelId = $(this).val();
			if(v_hotelId == '') v_hotelId = '0';
			O_RoomDrop_Photo.empty();
			O_RoomDrop_Photo.append("<option value=\"0\">==客房==</option>");
			if(v_hotelId.length > 0) {
				$.post("?m=admin/room.getListByHotel", { hotelId:v_hotelId, pageSize:0, json:true }, function(data) {
					$.each(data, function(id, item) {
						O_RoomDrop_Photo.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
					});
				}, "json");
			}
		});
		$("#O_SumbitUpdate").attr("disabled", false).unbind("click").click(function() { add(); });
	});
	//启动浏览模式
	openUpdate();
}
//信息更新
function updateClick(t){
	$("#divUpdate h1 span").html("酒店图片信息更新");
	var O_Content = $("#contentUpdate");
	O_Content.html('<div style="width:580px;height:200px;_height:300px;font-size:14px;text-align:center;"><div style="margin-top:120px;margin-bottom:15px;">正在加载...</div><img src="theme/admin/images/loading.gif"></div>');
	setUpdate();
	var id = t.id.replace(/O_Update_/g, '');
	highLightItem(id);//高亮行
	$.post("?m=admin/photo.update", { id:id }, function(data) {//alert(data);
		O_Content.html(data);
		setUpdate();
		var O_HotelDrop_Photo = O_Content.find("#O_HotelDrop_Photo");
		var O_RoomDrop_Photo = O_Content.find("#O_RoomDrop_Photo");
		//酒店下拉表
		O_HotelDrop_Photo.change(function() {
			var v_hotelId = $(this).val();
			if(v_hotelId == '') v_hotelId = '0';
			O_RoomDrop_Photo.empty();
			O_RoomDrop_Photo.append("<option value=\"0\">==客房==</option>");
			if(v_hotelId.length > 0) {
				$.post("?m=admin/room.getListByHotel", { hotelId:v_hotelId, pageSize:0, json:true }, function(data) {
					$.each(data, function(id, item) {
						O_RoomDrop_Photo.append("<option value=\"" + item.id + "\">" + item.name + "</option>");
					});
				}, "json");
			}
		});
		$("#O_SumbitUpdate").attr("disabled", false).unbind("click").click(function() { update(); });
	});
	//启动浏览模式
	openUpdate();
}
//全选删除
function checkDelAll() {
	var O_DelPhoto = $(".delPhoto");
	var O_ItemPhoto = $(".itemPhoto");
	if($("#o_delall").attr("checked")) {
		O_DelPhoto.attr("checked", true);
		O_ItemPhoto.addClass("ondel");
	} else {
		O_DelPhoto.attr("checked", false);
		O_ItemPhoto.removeClass("ondel");
	}
}
//批量删除
function delSelectClick(){
	if(confirm("删除所选酒店图片，确认？")) {
		var arrChk = $(":input[class='delPhoto']:checked");  
		var v_ids = "";  
		for(var i = 0; i < arrChk.length; i++){ 
			v_ids += arrChk[i].value;
			if(i < arrChk.length - 1) { v_ids += ","; }
		}
		$.post("?m=admin/photo.delSelectHandle", { ids:v_ids }, function(data) {
			//刷新列表
			var page = $("#O_CurrentPage").val();
			loadList(page);
			//刷新统计
			getCount();
		});
		return true; 
	}
	return false;
}
//更新状态
function updateStatusClick(t){
	var id = t.id.replace(/O_Status_/g,'');
	highLightItem(id);//高亮行
	var O_CurCheck = $("#O_StatusCheck_" + id);
	var status = O_CurCheck.attr("checked") ? "已停用" : "已审核";
	var page = $("#O_CurrentPage").val();
	$.post("?m=admin/photo.updateStatusHandle", { id:id, status:status }, function(data) {
		if(data[0] == "success") {
			//刷新列表
			var page = $("#O_CurrentPage").val();
			loadList(page, id);
			//刷新统计
			getCount();
		} else {
			alert(data[1]);
		}
	}, "json");
}
//获取统计
function getCount() {
	$.post("?m=admin/photo.getCount", {}, function(data) {
		var str = "共 <span class=\"f_14b_f00\">" + data.all + "</span> 个, 已审核 <span class=\"f_14b_f00\">" + data.check + "</span> 个, 待审核 <span class=\"f_14b_f00\">" + data.wait + "</span> 个, 已停用 <span class=\"f_14b_f00\">" + data.stop + "</span> 个";
		$("#O_Count").html(str);
		$("#O_Flush").hide();
	}, "json");
}
//高亮行
function highLightItem(id) {
	$(".itemPhoto").removeClass("on");
	$("#O_ItemPhoto_" + id).addClass("on");
}
//获取窗体区域
function getRange() {//得到屏幕的大小
    var top = document.body.scrollTop;
    var left = document.body.scrollLeft;
    var height = document.body.clientHeight;
    var width = document.body.clientWidth;
    if (top == 0 && left == 0 && height == 0 && width == 0) {
        top = document.documentElement.scrollTop;
        left = document.documentElement.scrollLeft;
        height = document.documentElement.clientHeight;
        width = document.documentElement.clientWidth;
    }
    return { top: top, left: left, height: height, width: width };
}
//处理
function add() {
	var page = $("#O_CurrentPage").val();
	var O_HotelDrop_Photo = $("#O_HotelDrop_Photo");
	var v_categoryRelId = O_HotelDrop_Photo.val();
	
	if(v_categoryRelId == "0") {
		alert("请选择所属酒店！");
		O_HotelDrop_Photo.focus();
	} else {
		var O_Submit = $("#O_SumbitUpdate");
		O_Submit.attr("disabled", true);
		$("#content").val($("#O_Content").val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, ''));
		$("#O_UploadForm").ajaxSubmit({
			success:function(data) {
				var ary = eval("(" + data + ")");
				if(ary[0] == "success") {
					//刷新列表
					loadList(page);
					//刷新统计
					getCount();
					//隐藏阴影
					closeUpdate();
				} else {
					alert(ary[1]);
				}
				O_Submit.attr("disabled", false);
			}
		});
	}
}
function update() {
	var page = $("#O_CurrentPage").val();
	var O_ID = $("#O_ID");
	var O_HotelDrop_Photo = $("#O_HotelDrop_Photo");
	var O_RoomDrop_Photo = $("#O_RoomDrop_Photo");
	var O_Content = $("#O_Content");
	
	var v_id = O_ID.val();
	var v_categoryRelId = O_HotelDrop_Photo.val();
	var v_typeRelId = O_RoomDrop_Photo.val();
	var v_content = O_Content.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');
	
	/*if(v_categoryRelId == "0") {
		alert("请选择所属酒店！");
		O_HotelDrop_Photo.focus();
	} else {*/
		var O_Submit = $("#O_SumbitUpdate");
		O_Submit.attr("disabled", true);
		$.post("?m=admin/photo.updateHandle", 
			   { id:v_id, categoryName:"hotel", categoryRelId:v_categoryRelId, typeRelId:v_typeRelId, content:v_content }, function(data) 
			   {//alert(data);
					if(data[0] == "success") {
						//刷新列表
						loadList(page, v_id);
						//刷新统计
						getCount();
						//隐藏阴影
						closeUpdate();
					} else {
						alert(data[1]);
					}
					O_Submit.attr("disabled", false);
		}, "json");
	
}