<!--//
//生成洲下拉列表
function setContinentID(ContinentID,CountryID,CityID,FirstText,FirstValue)
{
	if (FirstText==null||FirstText=="")
	{
		FirstText='请选择';
	}
	if (FirstValue==null||FirstValue=="")
	{
		FirstValue='Qxz';
	}
	CountryID.length=0;
	var o=new Option(FirstText,FirstValue);
	CountryID.add(o);
	
	CityID.length=0;
	var o=new Option(FirstText,FirstValue);
	CityID.add(o);
	DataDispose.src="DataDispose.aspx?mode=area_continent"+"&ContinentID="+ContinentID.id+"&FirstText="+FirstText+"&FirstValue="+FirstValue;
}
//选择洲后重新生成国家下拉列表
function Change_Continent(ContinentID,CountryID,CityID,ContinentValue,FirstText,FirstValue)
{
//	alert(ContinentID.options[ContinentID.selectedIndex].value)//ContinentID.options[ContinentID.selected].value='selected'
	if (FirstText==null||FirstText=="")
	{
		FirstText='请选择';
	}
	if (FirstValue==null||FirstValue=="")
	{
		FirstValue='Qxz';
	}
	CountryID.length=0;
	var o=new Option(FirstText,FirstValue);
	CountryID.add(o);
	
	CityID.length=0;
	var o=new Option(FirstText,FirstValue);
	CityID.add(o);
	
	CountryID.length=0;
	CountryID.disabled=true;
	if (ContinentID.options[ContinentID.selectedIndex].value=='Qxz')
	{
		var o=new Option(FirstText,FirstValue);
		CountryID.add(o);
		CountryID.disabled=false;
	}
	else
	{
		var o=new Option('载入中......',FirstValue);
		CountryID.add(o);
		DataDispose.src="DataDispose.aspx?mode=area_country&ContinentID="+ContinentID.id+"&CountryID="+CountryID.id+"&ContinentValue="+ContinentValue+"&FirstText="+FirstText+"&FirstValue="+FirstValue;
	}
	
}
//选择国家后重新生成城市下拉列表
function Change_Country(CountryID,CityID,CountryValue,FirstText,FirstValue)
{
	if (FirstText==null||FirstText=="")
	{
		FirstText='请选择';
	}
	if (FirstValue==null||FirstValue=="")
	{
		FirstValue='Qxz';
	}
	CityID.length=0;
	CityID.disabled=true;
	if (CountryID.options[CountryID.selectedIndex].value=='Qxz')
	{
		var o=new Option(FirstText,FirstValue);
		CityID.add(o);
		CityID.disabled=false;
	}
	else
	{
		var o=new Option('载入中......',FirstValue);
		CityID.add(o);
		DataDispose.src="DataDispose.aspx?mode=area_city"+"&CountryID="+CountryID.id+"&CityID="+CityID.id+"&CountryValue="+CountryValue+"&FirstText="+FirstText+"&FirstValue="+FirstValue;
	}	
}
//选择下拉列表来控制标签和文本框的显示和隐藏
function ChangeDdlDisLbTxt(DropDownListID,SpanLabelID,SpanTextBoxID,TextBoxID)
{
	if (DropDownListID.options[DropDownListID.selectedIndex].value == "CD00000001")
	{
		//document.getElementById("SearchLeft_lbReturnDate").style.display="none";
		//document.getElementById("SearchLeft_txtReturnDate").style.display="none";
		
		document.getElementById(SpanLabelID.id).style.display="none";
		document.getElementById(SpanTextBoxID.id).style.display="none";
		TextBoxID.value='';
	}
	else
	{
		document.getElementById(SpanLabelID.id).style.display="block";
		document.getElementById(SpanTextBoxID.id).style.display="block";
	}
}
//跳转到机票查询结果页面前的检验
function Search(URL,Page,Gjz,TicketTypeID,AirwaysID,VoyageTypeID,SailTypeID,BunkGradeID,StartContinentID,StartCountryID,StartCityID,WhitherContinentID,WhitherCountryID,WhitherCityID,GoOff,ReturnDate)
{
	if (GoOff.value.length<1)//(document.Form1.SearchLeft_txtGoOff.value.length<1)
	{
		alert("请先输入出发时间！");
		GoOff.focus();//document.Form1.SearchLeft_txtGoOff.focus();
		return false;
	}
	if (GoOff.value.length<1 && ReturnDate.value.length>0)//(document.Form1.SearchLeft_txtGoOff.value.length<1 && document.Form1.SearchLeft_txtReturnDate.value.length>0)
	{
		alert("请先输入出发时间！");
		GoOff.focus();//document.Form1.SearchLeft_txtGoOff.focus();
		return false;
	}
	if (stringToDate(ReturnDate.value,true)<stringToDate(GoOff.value,true) && SailTypeID.options[SailTypeID.selectedIndex].value != "CD00000001")
	{
		alert("出发时间不得晚于返回时间"+ReturnDate.value+"日！");
		GoOff.focus();
		return false;
	}
	if (SailTypeID.options[SailTypeID.selectedIndex].value == "CD00000001")//(document.Form1.SearchLeft_ddlSailTypeID.options[document.Form1.SearchLeft_ddlSailTypeID.selectedIndex].value == "CD00000001")
	{
		ReturnDate.value='';
	}
	QtTicketSearch(URL,Page,Gjz,TicketTypeID.options[TicketTypeID.selectedIndex].value,AirwaysID.options[AirwaysID.selectedIndex].value,VoyageTypeID.options[VoyageTypeID.selectedIndex].value,SailTypeID.options[SailTypeID.selectedIndex].value,BunkGradeID.options[BunkGradeID.selectedIndex].value,StartContinentID.options[StartContinentID.selectedIndex].value,StartCountryID.options[StartCountryID.selectedIndex].value,StartCityID.options[StartCityID.selectedIndex].value,WhitherContinentID.options[WhitherContinentID.selectedIndex].value,WhitherCountryID.options[WhitherCountryID.selectedIndex].value,WhitherCityID.options[WhitherCityID.selectedIndex].value,GoOff.value,ReturnDate.value);
}
//跳转到机票查询结果页面前的检验(查询控件在中间的)
function SearchCenter(URL,Page,Gjz,TicketTypeID,AirwaysID,VoyageTypeID,SailTypeID,BunkGradeID,StartContinentID,StartCountryID,StartCityID,WhitherContinentID,WhitherCountryID,WhitherCityID,GoOff,ReturnDate)
{
	if (GoOff.value.length<1)//(document.Form1.SearchLeft_txtGoOff.value.length<1)
	{
		alert("请先输入出发时间！");
		GoOff.focus();//document.Form1.SearchLeft_txtGoOff.focus();
		return false;
	}
	if (GoOff.value.length<1 && ReturnDate.value.length>0)//(document.Form1.SearchLeft_txtGoOff.value.length<1 && document.Form1.SearchLeft_txtReturnDate.value.length>0)
	{
		alert("请先输入出发时间！");
		GoOff.focus();//document.Form1.SearchLeft_txtGoOff.focus();
		return false;
	}
	if (stringToDate(ReturnDate.value,true)<stringToDate(GoOff.value,true) && SailTypeID.options[SailTypeID.selectedIndex].value != "CD00000001")
	{
		alert("出发时间不得晚于返回时间"+ReturnDate.value+"日！");
		GoOff.focus();
		return false;
	}
	if (SailTypeID.options[SailTypeID.selectedIndex].value == "CD00000001")//(document.Form1.SearchLeft_ddlSailTypeID.options[document.Form1.SearchLeft_ddlSailTypeID.selectedIndex].value == "CD00000001")
	{
		ReturnDate.value='';
	}
	QtTicketSearch(URL,Page,Gjz,TicketTypeID,AirwaysID.options[AirwaysID.selectedIndex].value,VoyageTypeID.options[VoyageTypeID.selectedIndex].value,SailTypeID.options[SailTypeID.selectedIndex].value,BunkGradeID.options[BunkGradeID.selectedIndex].value,StartContinentID.options[StartContinentID.selectedIndex].value,StartCountryID.options[StartCountryID.selectedIndex].value,StartCityID.options[StartCityID.selectedIndex].value,WhitherContinentID.options[WhitherContinentID.selectedIndex].value,WhitherCountryID.options[WhitherCountryID.selectedIndex].value,WhitherCityID.options[WhitherCityID.selectedIndex].value,GoOff.value,ReturnDate.value);
}
//跳转到机票查询结果页面
function QtTicketSearch(URL,Page,Gjz,TicketTypeID,AirwaysID,VoyageTypeID,SailTypeID,BunkGradeID,StartContinentID,StartCountryID,StartCityID,WhitherContinentID,WhitherCountryID,WhitherCityID,GoOff,ReturnDate)
{
	window.location=URL+"?Page="+escape(Page)+"&Gjz="+escape(Gjz)+"&TicketTypeID="+escape(TicketTypeID)+"&AirwaysID="+escape(AirwaysID)+"&VoyageTypeID="+escape(VoyageTypeID)+"&SailTypeID="+escape(SailTypeID)+"&BunkGradeID="+escape(BunkGradeID)+"&StartContinentID="+escape(StartContinentID)+"&StartCountryID="+escape(StartCountryID)+"&StartCityID="+escape(StartCityID)+"&WhitherContinentID="+escape(WhitherContinentID)+"&WhitherCountryID="+escape(WhitherCountryID)+"&WhitherCityID="+escape(WhitherCityID)+"&GoOff="+escape(GoOff)+"&ReturnDate="+escape(ReturnDate);
}
//跳转到酒店查询结果页面
function QtHotelSearch(URL,Page,Gjz,CityID,Level,HouseName,Price,BunkGradeID,StartContinentID,StartCountryID,StartCityID,WhitherContinentID,WhitherCountryID,WhitherCityID,GoOff,ReturnDate)
{
	window.location=URL+"?Page="+escape(Page)+"&Gjz="+escape(Gjz.value)+"&CityID="+escape(CityID.options[CityID.selectedIndex].value)+"&Level="+escape(Level.options[Level.selectedIndex].value)+"&HouseName="+escape(HouseName.options[HouseName.selectedIndex].value)+"&Price="+escape(Price.options[Price.selectedIndex].value)+"&BunkGradeID="+escape(BunkGradeID)+"&StartContinentID="+escape(StartContinentID)+"&StartCountryID="+escape(StartCountryID)+"&StartCityID="+escape(StartCityID)+"&WhitherContinentID="+escape(WhitherContinentID)+"&WhitherCountryID="+escape(WhitherCountryID)+"&WhitherCityID="+escape(WhitherCityID)+"&GoOff="+escape(GoOff)+"&ReturnDate="+escape(ReturnDate);
}
//跳转到翻页下拉列表所示的页面
function QtDdlPage(URL,Page)
{
	window.location=URL+"?Page="+escape(Page);
}
//将日期字符串转换成日期类型
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 TimeCom(dateValue)
{
	var newCom = new Date(dateValue);
	this.year = newCom.getYear();
	this.month = newCom.getMonth()+1;
	this.day = newCom.getDate();
	this.hour = newCom.getHours();
	this.minute = newCom.getMinutes();
	this.second = newCom.getSeconds();
	this.msecond = newCom.getMilliseconds();
	this.week = newCom.getDay();
}

function DateDiff(interval,date1,date2)
{
	var TimeCom1 = new TimeCom(date1);
	var TimeCom2 = new TimeCom(date2);
	var result;
	switch(String(interval).toLowerCase())
	{
		case "y":
		case "year":
		result = TimeCom1.year-TimeCom2.year;
		break;
		case "n":
		case "month":
		result = (TimeCom1.year-TimeCom2.year)*12+(TimeCom1.month-TimeCom2.month);
		break;
		case "d":
		case "day":
		result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day))/(1000*60*60*24));
		break;
		case "h":
		case "hour":
		result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour))/(1000*60*60));
		break;
		case "m":
		case "minute":
		result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour,TimeCom1.minute)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour,TimeCom2.minute))/(1000*60));
		break;
		case "s":
		case "second":
		result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour,TimeCom1.minute,TimeCom1.second)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour,TimeCom2.minute,TimeCom2.second))/1000);
		break;
		case "ms":
		case "msecond":
		result = Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day,TimeCom1.hour,TimeCom1.minute,TimeCom1.second,TimeCom1.msecond)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day,TimeCom2.hour,TimeCom2.minute,TimeCom2.second,TimeCom1.msecond);
		break;
		case "w":
		case "week":
		result = Math.round((Date.UTC(TimeCom1.year,TimeCom1.month-1,TimeCom1.day)-Date.UTC(TimeCom2.year,TimeCom2.month-1,TimeCom2.day))/(1000*60*60*24)) % 7;
		break;
		default:
		result = "invalid";
	}
	return(result);
}

function DateAdd(interval, num, dateValue)
{
	var newCom = new TimeCom(dateValue);
	num = parseInt(num);
	switch(String(interval).toLowerCase())
	{
		case "y": case "year": newCom.year += num; break;
		case "n": case "month": newCom.month += num; break;
		case "d": case "day": newCom.day += num; break;
		case "h": case "hour": newCom.hour += num; break;
		case "m": case "minute": newCom.minute += num; break;
		case "s": case "second": newCom.second += num; break;
		case "ms": case "msecond": newCom.msecond += num; break;
		case "w": case "week": newCom.day += num*7; break;
		default: return("invalid");
	}
	//var now = newCom.year+"/"+newCom.month+"/"+newCom.day+" "+newCom.hour+":"+newCom.minute+":"+newCom.second;
	var now = newCom.year+"/"+(newCom.month)+"/"+newCom.day;
	//return(new Date(now));
	//var now =(newCom.year+'-'+newCom.month+'-'+newCom.day);
	return(new Date(now));
	//return now;
}
function addDate(type,NumDay,dtDate)
{
	var date = new Date(dtDate);
	type = parseInt(type);//类型 
	var lIntval = parseInt(NumDay);//间隔
	switch(type)
	{
		case 1 ://年
			date.setYear(date.getYear() + lIntval)
			break;
		case 2 ://季度
			date.setMonth(date.getMonth() + (lIntval * 3))
			break;
		case 3://月
			date.setMonth(date.getMonth() + lIntval)
			break;
		case 4://天
			date.setDate(date.getDate() + lIntval)
			break;
		case 5://时
			date.setHours(date.getHours() + lIntval)
			break;
		case 6://分
			date.setMinutes(date.getMinutes() + lIntval)
			break;
		case 7://秒
			date.setSeconds(date.getSeconds() + lIntval)
		break;
		default:
	} 
	//return date.getYear() +'-' +  (date.getMonth()+) + '-' +date.getDate()+ ' '+ date.getHours()+':'+date.getMinutes()+':'+date.getSeconds()
	//return (date.getYear() +'-' + (date.getMonth()+) + '-' +date.getDate());
	return(date.getYear()+'-'+(date.getMonth()+1)+'-'+date.getDate());
} 
//document.write(addDate("",,"00// 00:00:00"))
//document.write(addDate("4",5,"2005/5/21 00:00:00"))

//-->
