var emailformat=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
var countformat=/[0-9]{1,4}/

function check(){
	flag=0;
	for(var i=0;i<this.form1.ordercount.length;i++){
		if(this.form1.ordercount[i].value != ''){
			flag=1;
			break;
		}
	}
	if(this.form1.ordernum.value == undefined){
		flag2=0;
		for(var i=0;i<this.form1.ordernum.length;i++){
			if(this.form1.ordernum[i].value != ''){
				flag2=1;
				break;
			}
		}
	}
	else{
		if(this.form1.ordernum.value == ''){
			flag2=0;		
		}
		else{
			flag2=1;
		}
	}
	if((flag == 0) && (flag2 == 0)){
		alert("请填写预订房间的数量！");
		return false;
	}
	if(this.form1.checkindate.value == ""){
		this.form1.checkindate.focus();
		alert("请填写入住日期！");
		return false;
	}
	if(this.form1.checkoutdate.value == ""){
		this.form1.checkoutdate.focus();
		alert("请填写离开日期！");
		return false;
	}
	if(this.form1.adultnum.value == "" && this.form1.childnum.value == ""){
		this.form1.adultnum.focus();
		alert("请填写人数！");
		return false;
	}
	if(this.form1.roomcount.value == ""){
		this.form1.roomcount.focus();
		alert("请填写房间数！");
		return false;
	}
	if(this.form1.fname.value == ""){
		this.form1.fname.focus();
		alert("请填写姓氏！");
		return false;
	}
	if(this.form1.name.value == ""){
		this.form1.name.focus();
		alert("请填写名字！");
		return false;
	}
	if(this.form1.email.value == ""){
		this.form1.email.focus();
		alert("请填写电子邮箱！");
		return false;
	}
	if(!emailformat.exec(document.form1.email.value)){
		document.form1.email.focus();
		alert("电子邮箱不正确！");
		return false;
	}
	if(this.form1.atel.value == ""){
		this.form1.atel.focus();
		alert("请填写区号！");
		return false;
	}
	if(this.form1.tel.value == ""){
		this.form1.tel.focus();
		alert("请填写电话号码！");
		return false;
	}
}
