function readyOrderHotel(hotelId,roomTypeId,costPrice,isTwoBeds,adultNeedNumber){
	if(isNull(hotelId) || isNull(roomTypeId))
		return ;
	var url="/globalHotelOrder.do?method=readyOrderHotel&hotelID="+hotelId+"&roomTypeId="+roomTypeId;
	var checkInDateValue=$("#hotelCheckInDate").val();
	var checkOutDateValue=$("#hotelCheckOutDate").val();
	var roomNumber=$("#hotelRoomNumber").val();
	if(isNull(checkInDateValue) || isNull(checkOutDateValue)|| isNull(roomNumber))
		return false;
	 if(!setUpRoomStatus()){
		 return false;
	 }
	 var roomStatus=$("#hotelRoomStatus").val();
	 url+="&checkInDate="+checkInDateValue;
	 url+="&checkOutDate="+checkOutDateValue;
	 url+="&roomQuantity="+roomNumber;   
	 url+="&roomStatus="+roomStatus;  
	 url+="&costPerPrice="+costPrice;
	 url+="&isTowBeds="+isTowBeds;
	 url+="&adultNeedNumber="+adultNeedNumber;
	 location.href=url;
}

function readyOrderHotelInShowPage(hotelId,roomTypeId,roomNum,roomStatus,checkInDate,checkOutDate){
	if(isNull(hotelId) || isNull(roomTypeId) || isNull(roomNum)|| isNull(roomStatus)||isNull(checkInDate)|| isNull(checkOutDate)){
		alert("提交出错，请重新刷新页面!!");
		return ;
	}
	var url="/globalHotelOrder.do?method=readyOrderHotel&hotelID="+hotelId+"&roomTypeId="+roomTypeId;
	var num=parseInt(roomNum);
	if(isNaN(num) || num<1){
		alert("提交出错，请重新刷新页面!!");
		return false;
	}
	 var roomPlanInfor=$("#roomPlanInfor"+roomTypeId).val();
	 
	 url+="&checkInDate="+checkInDate;
	 url+="&checkOutDate="+checkOutDate;
	 url+="&roomQuantity="+num;   
	 url+="&roomStatus="+roomStatus;
	 url+="&roomPlanInfor="+roomPlanInfor;
	 location.href=url;
}


function isNull(str){
	if(str==null || str==undefined || str=="")
		return true;
	return false;
}

function orderGlobalHotel(roomTotal){
	if(isNull($("#contact").val())){
		alert("温馨提示:请输入联系人");
		 $("#contact").focus();
		return false;
	}
	var mobilStr=$("#contactMobile").val();
	if(isNull(mobilStr)){
		showOrderMobileMsg("请输入联系电话");
		return false;
	}
	if(mobilStr.match(/^[0-9]+$/)==null){
		showOrderMobileMsg("手机号码必须是数字");
		return false;
	}
	if(mobilStr.length!=11){
		showOrderMobileMsg("手机号码必须是11位");
		return false;
	}
	var telStr=$("#contactTel").val();
	if(!isNull(telStr)){
		if(telStr.match(/^[0-9]+$/)==null){
			showOrderTelMsg("电话号码必须是数字");
			return false;
		}
		if(telStr.length!=11){
			showOrderTelMsg("电话号码必须是11位");
			return false;
		}
	}
	if(roomTotal==null){
		alert("提交出错，请重新刷新页面!!");
		return false;
	}
	var roomPlanInfor="";
	for(var i=1;i<=roomTotal;i++){
		var subInfor=$("#priceOccup"+i+"Value").val();
		if(subInfor==null  && subInfor==undefined || subInfor==""){
			alert("请选择第"+i+"号房间的房型!!");
			return false;
		}
		roomPlanInfor=roomPlanInfor+subInfor+"@";
	}
	$("#roomPlanInfor").val(roomPlanInfor);  
	//$("#orderButton").click();
}

function showOrderMobileMsg(strInfo){
	document.getElementById("order_mobile_msg").style.display = "block";
	$("#contactMobile").css({   backgroundColor: '#ffd7d7',  border:'1px solid #f00' }); 
	document.getElementById("order_mobile_msg").innerHTML = "<img src='/style/img/checke.gif' align='absmiddle' />&nbsp;<font color=red>"+strInfo+"</font>";
	$("#contactMobile").focus();
}

function showOrderTelMsg(strInfo){
	document.getElementById("order_Tel_msg").style.display = "block";
	$("#contactTel").css({   backgroundColor: '#ffd7d7',  border:'1px solid #f00' }); 
	document.getElementById("order_Tel_msg").innerHTML = "<img src='/style/img/checke.gif' align='absmiddle' />&nbsp;<font color=red>"+strInfo+"</font>";
	$("#contactTel").focus();
}

function checkMobile(){
	var cValue=$("#contactMobile").val();
	document.getElementById("order_mobile_msg").style.display="block";
	if(isNull(cValue)){
		$("#contactMobile").css({   backgroundColor: '#ffd7d7',  border:'1px solid #f00' }); 
		document.getElementById("order_mobile_msg").innerHTML = "<img src='/style/img/checke.gif' align='absmiddle' />&nbsp;<font color=red>请输入手机号码</font>";
		document.getElementById("contactMobile").focus();
		document.getElementById("submitButton").disabled=true;document.getElementById("submitButton").title="手机号码不能为空";
	}
	if(cValue.match(/^[0-9]+$/)==null){
		$("#contactMobile").css({   backgroundColor: '#ffd7d7',  border:'1px solid #f00' }); 
		document.getElementById("order_mobile_msg").innerHTML = "<img src='/style/img/checke.gif' align='absmiddle' />&nbsp;<font color=red>手机号码必须是数字</font>";
		document.getElementById("contactMobile").focus();
		document.getElementById("submitButton").disabled=true;document.getElementById("submitButton").title="手机号码必须是数字";
	}else if(cValue.length!=11){
		$("#contactMobile").css({   backgroundColor: '#ffd7d7',  border:'1px solid #f00' }); 
		document.getElementById("order_mobile_msg").innerHTML = "<img src='/style/img/checke.gif' align='absmiddle' />&nbsp;<font color=red>手机号码必须是11位</font>";
		document.getElementById("contactMobile").focus();
		document.getElementById("submitButton").disabled=true;document.getElementById("submitButton").title="手机号码必须是11位";
	}else{
		$("#contactMobile").css({   backgroundColor: '#C4FFC4',  border:'1px solid #00FF00' }); 
		document.getElementById("order_mobile_msg").innerHTML = "<img src='/style/img/checkr.gif' align='absmiddle' />&nbsp;<font color=green>可用</font>";
		if(document.getElementById("submitButton").disabled){
			document.getElementById("submitButton").disabled=false;
		}
	}
}

function checkTel(){
	var cValue=$("#contactTel").val();
	document.getElementById("order_tel_msg").style.display="block";
	if(!isNull(cValue)){
		if(cValue.match(/^[0-9]+$/)==null){
			$("#contactTel").css({   backgroundColor: '#ffd7d7',  border:'1px solid #f00' }); 
			document.getElementById("order_tel_msg").innerHTML = "<img src='/style/img/checke.gif' align='absmiddle' />&nbsp;<font color=red>电话号码必须是数字</font>";
			document.getElementById("contactTel").focus();
			document.getElementById("submitButton").disabled=true;document.getElementById("submitButton").title="电话号码必须是数字";
		}else if(cValue.length!=11){
			$("#contactTel").css({   backgroundColor: '#ffd7d7',  border:'1px solid #f00' }); 
			document.getElementById("order_tel_msg").innerHTML = "<img src='/style/img/checke.gif' align='absmiddle' />&nbsp;<font color=red>电话号码必须是11位</font>";
			document.getElementById("contactTel").focus();
			document.getElementById("submitButton").disabled=true;document.getElementById("submitButton").title="电话号码必须是11位";
		}else{
			$("#contactTel").css({     backgroundColor: '#C4FFC4',  border:'1px solid #00FF00' }); 
			document.getElementById("order_tel_msg").innerHTML = "<img src='/style/img/checkr.gif' align='absmiddle' />&nbsp;<font color=green>可用</font>";
			if(document.getElementById("submitButton").disabled){
				document.getElementById("submitButton").disabled=false;
			}
		}
	}
}

function countAllPrice(length){
	if(length==null || length==undefined || length<1)
		return ;
	var allCost=0;
	var allString="";
	for(var i=1;i<=length;i++){
		var subInfor=$("#price"+i+"Value").val();
		if(subInfor==null  && subInfor==undefined || subInfor==""){
			return;
		}
		allCost+=subInfor;
		var cub=$("#priceAveg"+i+"Value").val();
		if(cub==null  && cub==undefined || cub==""){
			return;
		}
		if(i==length){
			allString+=cub;  
		}else{
			allString+=cub+"+";
		}
		
	}
	$("#roomAllPrice").html(allString+"=$"+allCost);
}

