function daysElapsed(date1,date2) {
					var difference = Date.UTC(date1.getYear(),date1.getMonth(),date1.getDate(),0,0,0)
								   - Date.UTC(date2.getYear(),date2.getMonth(),date2.getDate(),0,0,0);
					var difdays=difference/(1000*60*60*24);
					if(difdays<0){
						return 0-difdays;
					}else{
						return difdays;
					}
				}

                function getStrDate(todayTime)
				{
					var beginDate = "" + todayTime.getYear() + "-";
					if(todayTime.getMonth()+1 < 10) {
						beginDate += "0" + (todayTime.getMonth()+1) + "-";
					}
					else {
						beginDate += "" + (todayTime.getMonth()+1) + "-";
					}
					if(todayTime.getDate() < 10) {
						beginDate += "0" + todayTime.getDate();
					}
					else {
						beginDate += "" + todayTime.getDate();
					}		
                    return beginDate;
				}

				function queryHotelFront(form){
                   
					var beginDate = document.getElementById("inDate").value;
					var endDate = document.getElementById("outDate").value;
					var cityName = document.getElementById('hCity').value;
				    var judgeATy=document.getElementById("judgeATy").value;
					if (judgeATy==0&&(cityName == "" || cityName == "中文/拼音"))	{
						alert("请选择您要入住的城市！");
						return false;
					}
					document.getElementById("queryHotelForWebBean.cityName").value = cityName;

					if(judgeATy==0&&getThreeWordByCity(cityName) == ""){
						alert("请填写正确的入住城市!");
						return false;
					}
					var cityId = getThreeWordByCitysFlight(cityName); 
					if(beginDate.length==0 || beginDate == "yyyy-mm-dd" ){
						alert("请选择入住日期！");
						return;
					}

					if(endDate.length==0 || endDate == "yyyy-mm-dd"){
						alert("请选择离店日期！");
						return;
					}

                    var aodayBegin = new Date('2008','07','01');
					var aodayEnd = new Date('2008','07','31');
					var todayTime = new Date();
					var today = new Date(todayTime.getYear(),todayTime.getMonth(),todayTime.getDate());
					var date1 = new Date(beginDate.replace('-','/'));
					var date2 = new Date(endDate.replace('-','/'));
/* || cityId=='SHA' || cityId=='HKG' || cityId=='TAO' || cityId=='SHE' || cityId=='QHD'*/
					if (( cityId=='PEK' || cityId=='HKG' || cityId=='TAO')
					     && (getStrDate(date1) >= getStrDate(aodayBegin) && getStrDate(date2) <= getStrDate(aodayEnd)))
					{
							if(date1>=date2){
								alert("入住日期应早于离店日期！");
								return;
							}
					}else{
						if(date1>=date2){
							alert("入住日期应早于离店日期！");
							return;
						}
						if(date1<today){
							alert("入住日期不能小于今天！");
							return;
						}

						if(daysElapsed(today,date2)>28){
							alert("如需查询28天后的房价，请致电呼叫中心 40066 40066，谢谢！");
							return; 	    	
						}
					}
					if(document.getElementById("judgeATy").value==0){
					document.getElementById("queryHotelForWebBean.cityId").value = cityId;
					}else{
					document.getElementById("queryHotelForWebBean.cityId").value = document.getElementById("GAS").value;
					document.getElementById("queryHotelForWebBean.cityName").value = document.searchForm.GAS.options[document.searchForm.GAS.options.selectedIndex].text;
					document.getElementById("hCity").value = document.searchForm.GAS.options[document.searchForm.GAS.options.selectedIndex].text;
					}
					form.submit();
				}
