$(function() {
	var O_Submit = $("#O_Submit");
	O_Submit.click(function() {
		var O_SiteName = $("#O_SiteName");
		var O_Title = $("#O_Title");
		var O_Keywords = $("#O_Keywords");
		var O_Description = $("#O_Description");
		var O_CityName = $("#O_CityName");
		var O_MapX = $("#O_MapX");
		var O_MapY = $("#O_MapY");
		var O_Phone1 = $("#O_Phone1");
		var O_Phone2 = $("#O_Phone2");
		var O_MemberHotelReturn = $("#O_MemberHotelReturn");
		var O_HotelCommentTakeMoney = $("#O_HotelCommentTakeMoney");
		var O_HotelPhotoTakeMoney = $("#O_HotelPhotoTakeMoney");
		var O_HotelPhotoMaxUploadNum = $("#O_HotelPhotoMaxUploadNum");
		
		var v_siteName = O_SiteName.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_title = O_Title.val();
		var v_keywords = O_Keywords.val();
		var v_description = O_Description.val();
		var v_cityName = O_CityName.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_mapX = O_MapX.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_mapY = O_MapY.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_phone1 = O_Phone1.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_phone2 = O_Phone2.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_memberHotelReturn = O_MemberHotelReturn.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_hotelCommentTakeMoney = O_HotelCommentTakeMoney.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_hotelPhotoTakeMoney = O_HotelPhotoTakeMoney.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		var v_hotelPhotoMaxUploadNum = O_HotelPhotoMaxUploadNum.val().replace(/ /g, '').replace(/'/g, '').replace(/"/g, '');;
		
		if(v_siteName == "") {
			alert("网站名称不能为空！");
			O_SiteName.val("");
			O_SiteName.focus();
		} else if(v_cityName == "") {
			alert("默认城市不能为空！");
			O_CityName.val("");
			O_CityName.focus();
		} else if(v_mapX == "") {
			alert("地图横坐标不能为空！");
			O_MapX.val("");
			O_MapX.focus();
		} else if(isNaN(v_mapX)) {
			alert("地图横坐标格式错误！");
			O_MapX.val("");
			O_MapX.focus();
		} else if(v_mapY == "") {
			alert("地图纵坐标不能为空！");
			O_MapY.val("");
			O_MapY.focus();
		} else if(isNaN(v_mapY)) {
			alert("地图纵坐标格式错误！");
			O_MapY.val("");
			O_MapY.focus();
		} else if(v_memberHotelReturn == "") {
			alert("普通会员返现比例不能为空！");
			O_MemberHotelReturn.val("");
			O_MemberHotelReturn.focus();
		} else if(isNaN(v_memberHotelReturn)) {
			alert("普通会员返现比例格式错误！");
			O_MemberHotelReturn.val("");
			O_MemberHotelReturn.focus();
		} else if(v_hotelCommentTakeMoney == "") {
			alert("酒店评论奖金不能为空！");
			O_HotelCommentTakeMoney.val("");
			O_HotelCommentTakeMoney.focus();
		} else if(isNaN(v_hotelCommentTakeMoney)) {
			alert("酒店评论奖金格式错误！");
			O_HotelCommentTakeMoney.val("");
			O_HotelCommentTakeMoney.focus();
		} else if(v_hotelPhotoTakeMoney == "") {
			alert("酒店图片奖金不能为空！");
			O_HotelPhotoTakeMoney.val("");
			O_HotelPhotoTakeMoney.focus();
		} else if(isNaN(v_hotelPhotoTakeMoney)) {
			alert("酒店图片奖金格式错误！");
			O_HotelPhotoTakeMoney.val("");
			O_HotelPhotoTakeMoney.focus();
		} else if(v_hotelPhotoMaxUploadNum == "") {
			alert("会员最多可传图片数不能为空！");
			O_HotelPhotoMaxUploadNum.val("");
			O_HotelPhotoMaxUploadNum.focus();
		} else if(isNaN(v_hotelPhotoMaxUploadNum)) {
			alert("会员最多可传图片数格式错误！");
			O_HotelPhotoMaxUploadNum.val("");
			O_HotelPhotoMaxUploadNum.focus();
		} else {
			O_Submit.attr("disabled", true);
			$("#O_UploadForm").ajaxSubmit({
				success:function(data) {
					var ary = eval("(" + data + ")");
					alert(ary[1]);
					window.location.reload();
				}
			});
		}
	});
});