
		
		//提交酒店搜索表单验证
function searchsubmit()
{var fH=document.ListItemForSale;

if(!isDateString(fH.starttime.value)){alert("Please input check in date!");
fH.starttime.focus();return false;}

if(!isDateString(fH.deptime.value))
{alert("Please input check out date!");
fH.deptime.focus();return false;}

if (stringToDate(fH.deptime.value,true)<=stringToDate(fH.starttime.value,true))
{alert("Check out date cannot be earlier or same as check in date  "+fH.starttime.value+"!");
fH.deptime.focus();return false;}


if(daysBetween(fH.deptime.value,fH.starttime.value) > 25)
						{
							alert('Check-in/out date interval should not more than 25 days!');
							
							return false;
						}

return true;} 
//计算日期差
function daysBetween(DateOne,DateTwo) 
	{   
		var OneMonth = DateOne.substring(5,DateOne.lastIndexOf ('-')); 
		var OneDay = DateOne.substring(DateOne.length,DateOne.lastIndexOf ('-')+1); 
		var OneYear = DateOne.substring(0,DateOne.indexOf ('-')); 
		var TwoMonth = DateTwo.substring(5,DateTwo.lastIndexOf ('-')); 
		var TwoDay = DateTwo.substring(DateTwo.length,DateTwo.lastIndexOf ('-')+1); 
		var TwoYear = DateTwo.substring(0,DateTwo.indexOf ('-'));    
		var cha=((Date.parse(OneMonth+'/'+OneDay+'/'+OneYear)- Date.parse(TwoMonth+'/'+TwoDay+'/'+TwoYear))/86400000);   
		return Math.abs(cha); 
	}  
	
//调用函数
function stringToDate(sDate, bIgnore)
{	var bValidDate, year, month, day
	var iaDate = new Array(3)
	
	if (bIgnore) bValidDate = true
	else bValidDate = isDateString(sDate)
	
	if (bValidDate)
	{  iaDate = sDate.toString().split("-")
		year = parseFloat(iaDate[0])
		month = parseFloat(iaDate[1]) - 1
		day=parseFloat(iaDate[2])
		return (new Date(year,month,day))
	}
	else return (new Date(1900,1,1))
}

//判断数值是否日期类型
function isDateString(sDate)
{	var iaMonthDays = [31,28,31,30,31,30,31,31,30,31,30,31]
	var iaDate = new Array(3)
	var year, month, day

	if (arguments.length != 1) return false
	iaDate = sDate.toString().split("-")
	if (iaDate.length != 3) return false
	if (iaDate[1].length > 2 || iaDate[2].length > 2) return false
	if (isNaN(iaDate[0])||isNaN(iaDate[1])||isNaN(iaDate[2])) return false

	year = parseFloat(iaDate[0])
	month = parseFloat(iaDate[1])
	day=parseFloat(iaDate[2])

	if (year < 1900 || year > 2100) return false
	if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) iaMonthDays[1]=29;
	if (month < 1 || month > 12) return false
	if (day < 1 || day > iaMonthDays[month - 1]) return false
	return true
}

//日历入住日期设定
function setCheckInDate(d)
{
	document.getElementById("hdate1").value=d;
	if(document.getElementById("hdate2").value.length==10||document.getElementById("hdate2").value.length==9||document.getElementById("hdate2").value.length==8)
	{
		showCalendar_hotel('dimg2',false,'hdate2','hdate1');
	}
}


//点击跳转机票预订页面
function showFlightPage()
			{
				window.open('http://www.efairbooking.com/FlightEn/FlightSearch.asp','_blank','');
				return false;
			}
