//检查用户名、密码、验证码是否输入
function checklogin(theForm){
		if(theForm.userName.value==""){
			alert("用户名不能为空!");
			theForm.userName.focus();
			return false;
		}
		if(theForm.userPsw.value==""){
			alert("密码不能为空!");
			theForm.userPsw.focus();
			return false;
		}
		if(theForm.userCheck.value==""){
			alert("验证码不能为空!");
			theForm.userCheck.focus();
			return false;
		}
		if(isNaN(theForm.userCheck.value)){
			alert("验证码有误!");
			theForm.userCheck.select();
			return false;
		}
		return ;
	}

// 检测加盟商
function checkReghotel(theForm){
	if(theForm.userName.value=="" || theForm.userName.value.length<3 || theForm.userName.value.length>30){
		alert("用户必须在3~30个字符之间!");
		theForm.userName.focus();
		return false;
	}
	if(theForm.userPsw.value=="" || theForm.userPsw.value.length<6){
		alert("密码不能少于6位!");
		theForm.userPsw.select();
		return false;
	}
	if(theForm.userCpsw.value=="" || (theForm.userCpsw.value!=theForm.userPsw.value)){
		alert("确认密码有误!");
		theForm.userCpsw.select();
		return false;
	}
	if(theForm.userCname.value==""){
		alert("请填写姓名!");
		theForm.userCname.focus();
		return false;
	}
	if(document.getElementsByName("sex")[0].checked==false && document.getElementsByName("sex")[1].checked==false){
		alert("请选择性别!");
		document.getElementsByName("sex")[0].focus();
		return false;
	}
	if(theForm.MB.value==""){
		alert("请填写手机号码!");
		theForm.MB.focus();
		return false;
	}
	if(isNaN(theForm.MB.value)==true || theForm.MB.value.substring(0,1)!=1 || theForm.MB.value.length<11){
		alert("手机号码填写不正确!")
		theForm.MB.select();
		return false;
	}
	if(theForm.mail.value==""){
		alert("请填写电子邮箱!");
		theForm.mail.focus();
		return false;
	}
	if(theForm.mail.value.indexOf("@",1)==-1 ||theForm.mail.value.indexOf(".",1)==-1 ){
		alert("电子邮箱地址不正确!");
		theForm.mail.select();
		return false;
	}
	if(theForm.mcChs.value==""){
		alert("请填写酒店名称!");
		theForm.mcChs.focus();
		return false;
	}
	if(theForm.star.value==""){
		alert("请选择酒店星级!");
		theForm.star.focus();
		return false;
	}
	if(theForm.dc.value==""){
		alert("请选择酒店档次!");
		theForm.dc.focus();
		return false;
	}
	if(theForm.lx.value==""){
		alert("请选择酒店类型!");
		theForm.lx.focus();
		return false;
	}
	if(theForm.area.value==""){
		alert("请选择省份!");
		theForm.area.focus();
		return false;
	}
	if(theForm.city.value==""){
		alert("请选择地区!");
		theForm.city.focus();
		return false;
	}
	if(theForm.kysj.value==""){
		alert("请填写开业时间!");
		theForm.kysj.focus();
		return false;
	}
	if(theForm.fjsl.value==""){
		alert("请填写房间数量!");
		theForm.fjsl.focus();
		return false;
	}
	if(theForm.addr.value==""){
		alert("请填写酒店地址!");
		theForm.addr.focus();
		return false;
	}
	if(theForm.post.value==""){
		alert("请填写邮编!");
		theForm.post.focus();
		return false;
	}
	if(theForm.tel.value==""){
		alert("请填写酒店电话!");
		theForm.tel.focus();
		return false;
	}
	if(theForm.ydbFax.value==""){
		alert("请填写预订部传真!");
		theForm.ydbFax.focus();
		return false;
	}
	if(theForm.qtFax.value==""){
		alert("请填写前台传真!");
		theForm.qtFax.focus();
		return false;
	}
	if(theForm.xsblxr.value==""){
		alert("请填写销售部联系人!");
		theForm.xsblxr.focus();
		return false;
	}
	if(theForm.xsbMB.value==""){
		alert("请填写手机!");
		theForm.xsbMB.focus();
		return false;
	}
	if(theForm.xsbTel.value==""){
		alert("请填写电话!");
		theForm.xsbTel.focus();
		return false;
	}
	if(theForm.xsbFax.value==""){
		alert("请填写传真!");
		theForm.xsbFax.focus();
		return false;
	}
	if(theForm.cwblxr.value==""){
		alert("请填写财务部联系人!");
		theForm.cwblxr.focus();
		return false;
	}
	if(theForm.cwbMB.value==""){
		alert("请填写手机!");
		theForm.cwbMB.focus();
		return false;
	}
	if(theForm.cwbTel.value==""){
		alert("请填写电话!");
		theForm.cwbTel.focus();
		return false;
	}
	if(theForm.cwbFax.value==""){
		alert("请填写传真!");
		theForm.cwbFax.focus();
		return false;
	}
	if(theForm.txt.value==""){
		alert("请填写酒店简介!");
		theForm.txt.focus();
		return false;
	}
	if(theForm.jt.value==""){
		alert("请填写酒店交通!");
		theForm.jt.focus();
		return false;
	}
	if(theForm.bzxjz.value==""){
		alert("请填写酒店附近标志性建筑!");
		theForm.bzxjz.focus();
		return false;
	}
	return;
}

// 修改酒店信息
function checkEdithotel(theForm){
	if(theForm.mcChs.value==""){
		alert("请填写酒店名称!");
		theForm.mcChs.focus();
		return false;
	}
	if(theForm.star.value==""){
		alert("请选择酒店星级!");
		theForm.star.focus();
		return false;
	}
	if(theForm.dc.value==""){
		alert("请选择酒店档次!");
		theForm.dc.focus();
		return false;
	}
	if(theForm.lx.value==""){
		alert("请选择酒店类型!");
		theForm.lx.focus();
		return false;
	}
	if(theForm.area.value==""){
		alert("请选择省份!");
		theForm.area.focus();
		return false;
	}
	if(theForm.city.value==""){
		alert("请选择地区!");
		theForm.city.focus();
		return false;
	}
	if(theForm.kysj.value==""){
		alert("请填写开业时间!");
		theForm.kysj.focus();
		return false;
	}
	if(theForm.fjsl.value==""){
		alert("请填写房间数量!");
		theForm.fjsl.focus();
		return false;
	}
	if(theForm.addr.value==""){
		alert("请填写酒店地址!");
		theForm.addr.focus();
		return false;
	}
	if(theForm.post.value==""){
		alert("请填写邮编!");
		theForm.post.focus();
		return false;
	}
	if(theForm.tel.value==""){
		alert("请填写酒店电话!");
		theForm.tel.focus();
		return false;
	}
	if(theForm.ydbFax.value==""){
		alert("请填写预订部传真!");
		theForm.ydbFax.focus();
		return false;
	}
	if(theForm.qtFax.value==""){
		alert("请填写前台传真!");
		theForm.qtFax.focus();
		return false;
	}
	if(theForm.xsblxr.value==""){
		alert("请填写销售部联系人!");
		theForm.xsblxr.focus();
		return false;
	}
	if(theForm.xsbMB.value==""){
		alert("请填写手机!");
		theForm.xsbMB.focus();
		return false;
	}
	if(theForm.xsbTel.value==""){
		alert("请填写电话!");
		theForm.xsbTel.focus();
		return false;
	}
	if(theForm.xsbFax.value==""){
		alert("请填写传真!");
		theForm.xsbFax.focus();
		return false;
	}
	if(theForm.cwblxr.value==""){
		alert("请填写财务部联系人!");
		theForm.cwblxr.focus();
		return false;
	}
	if(theForm.cwbMB.value==""){
		alert("请填写手机!");
		theForm.cwbMB.focus();
		return false;
	}
	if(theForm.cwbTel.value==""){
		alert("请填写电话!");
		theForm.cwbTel.focus();
		return false;
	}
	if(theForm.cwbFax.value==""){
		alert("请填写传真!");
		theForm.cwbFax.focus();
		return false;
	}
	if(theForm.txt.value==""){
		alert("请填写酒店简介!");
		theForm.txt.focus();
		return false;
	}
	if(theForm.jt.value==""){
		alert("请填写酒店交通!");
		theForm.jt.focus();
		return false;
	}
	if(theForm.bzxjz.value==""){
		alert("请填写酒店附近标志性建筑!");
		theForm.bzxjz.focus();
		return false;
	}
	return;
}

//修改管理员信息
function checkgly(theForm){
	if(theForm.userPsw.value!=""){
		if(theForm.userPsw.value.length<6){
			alert("密码不能少于6位!");
			theForm.userPsw.select();
			return false;
		}
		if(theForm.userPsw.value!=theForm.userCpsw.value){
			alert("确认密码有误!");
			theForm.userCpsw.select();
			return false;
		}
	}
	if(theForm.userCname.value==""){
		alert("请填写姓名!");
		theForm.userCname.focus();
		return false;
	}
	if(theForm.MB.value==""){
		alert("请填写手机号码!");
		theForm.MB.focus();
		return false;
	}
	if(isNaN(theForm.MB.value)==true || theForm.MB.value.substring(0,1)!=1 || theForm.MB.value.length<11){
		alert("手机号码填写不正确!")
		theForm.MB.select();
		return false;
	}
	if(theForm.mail.value==""){
		alert("请填写电子邮箱!");
		theForm.mail.focus();
		return false;
	}
	if(theForm.mail.value.indexOf("@",1)==-1 ||theForm.mail.value.indexOf(".",1)==-1 ){
		alert("电子邮箱地址不正确!");
		theForm.mail.select();
		return false;
	}
	return;
}


// 检测用户名
var xmlHttp;
if(window.ActiveXObject){
	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
	xmlHttp = new XMLHttpRequest();
}

function checkUser(){
	var userName=document.getElementById("userName");
	if(userName=="" || userName.value.length<3 || userName.value.length>30){
		alert("用户必须在3~30个字符之间!");
		userName.focus();
		return false;
	}
	try{
		xmlHttp.open("post","chkuser.asp?userName="+escape(userName.value),true);
		xmlHttp.onreadystatechange=showMsg;
		xmlHttp.send(null);
	}catch(exception){
		return false;
	}
}

function showMsg(){
	if(xmlHttp.readystate==4 && xmlHttp.status==200){
		try{
			var response=xmlHttp.responseText;
			if(response=="1"){
				msg.innerHTML="可以使用此用户名!";
			}else{
				msg.innerHTML="该用户已被占用!";
			}
			return false;
		}catch(exception){
			return false;			
		}	
	}	
}

//添加客房
function checkkf(theForm){
	if(theForm.mc.value==""){
			alert("客户名称不能为空!");
			theForm.mc.focus();
			return false;
		}	
	if(theForm.msj.value=="" || isNaN(theForm.msj.value)){
			alert("请正确填写门市价!");
			theForm.msj.focus();
			return false;
		}	
	if(theForm.wsj.value=="" || isNaN(theForm.wsj.value)){
			alert("请正确填写网上预订价!");
			theForm.wsj.focus();
			return false;
		}	
	if(theForm.xyj.value=="" || isNaN(theForm.xyj.value)){
			alert("请正确填写协议底价!");
			theForm.xyj.focus();
			return false;
		}	
	if(theForm.zc.value==""){
			alert("请选择是否含早餐!");
			theForm.zc.focus();
			return false;
		}	
	if(theForm.net.value==""){
			alert("请选择宽带上网!");
			theForm.net.focus();
			return false;
		}	
		
	if(theForm.txt.value==""){
			alert("请选择房间简介");
			theForm.txt.focus();
			return false;
		}	
	return ;
}

//添加酒店图片
function checkImg(theForm){
	if(theForm.title.value==""){
			alert("图片描述不能为空!");
			theForm.title.focus();
			return false;
		}	
	if(theForm.imgURL.value==""){
			alert("请选择上传图片!");
			theForm.imgURL.focus();
			return false;
		}	
	return ;
}

//酒店确认订单状态
function checkjdqrState(){
	if(!document.getElementsByName("state")[0].checked	&& !document.getElementsByName("state")[1].checked	&& !document.getElementsByName("state")[2].checked){
		alert("请选择处理方式!")
		return false;
	}
	return ;
}

//佣金提交
function fyaction(theForm){
	window.open("./fylist.asp?year="+theForm.year.value+"&month="+theForm.month.value,"_blank");
}
