// 菜单
function openMenu(URL){
	if(URL.indexOf("packages",1)!=-1){
		window.open("http://www.myshunda.com/","_blank");	
	}
	else if(URL.indexOf("bbs",1)!=-1 || URL.indexOf("shop",1)!=-1){
		window.open(URL,"_blank");
	}else{
		window.location.href=URL;
	}
}

//检测酒店搜索
function checkindexSearch(theForm){
	cityName=document.getElementsByName("cityName");
	if(cityName[0].value==""){
		alert("城市名称不能为空!");
		cityName[0].focus();
		return false;
	}	
	if(theForm.inDate.value==""){
		alert("请选择入住日期!");
		event.cancelBubble=true;
		showCalendar('sltInDate',false,'inDate','outDate');
		return false;
	}
	var matchArray = theForm.inDate.value.match(/^[0-9]+-[0-1][0-9]-[0-3][0-9]$/);
	if(matchArray==null){	
		alert("入住日期有误!")
		event.cancelBubble=true;
		showCalendar('sltInDate',false,'inDate','outDate');
		return false;	
	}
	if(theForm.outDate.value==""){
		alert("请选择离店日期!");
		event.cancelBubble=true;
		showCalendar('outDate',false,'outDate','inDate');
		return false;
	}
	var matchArray = theForm.outDate.value.match(/^[0-9]+-[0-1][0-9]-[0-3][0-9]$/);
	if(matchArray==null){	
		alert("离店日期有误!")
		event.cancelBubble=true;
		showCalendar('sltOutDate',false,'outDate','inDate');
		return false;	
	}
	var inDate =theForm.inDate.value;
	var outDate =theForm.outDate.value;
	var inDates=inDate.split("-");
	var outDates=outDate.split("-");
	if (Date.parse(inDates[1]+"/"+inDates[2]+"/"+inDates[0]) < Date.parse(outDates[1]+"/"+outDates[2]+"/"+outDates[0])==false){
		alert("离店日期必须大于入住日期!");
		event.cancelBubble=true;
		showCalendar('sltOutDate',false,'outDate','inDate');
		return false;			
	}
	var iDates = new Date(inDates[0],inDates[1],inDates[2]);
	var oDates = new Date(outDates[0],outDates[1],outDates[2]);
	var t = Math.abs(oDates.getTime()-iDates.getTime());
	var Days = t/(1000*60*60*24)
	if(Days>20){
		alert("如果您需要在酒店入住20天以上,请和我们预定中心联系,联系电话:0551-5150513-8121,我们将竭诚为您服务!");
		event.cancelBubble=true;
		showCalendar('sltOutDate',false,'outDate','inDate');
		return false;
	}
	return;
}
