// JavaScript Document
function CreateCity(CityID,SelectedValue,PostReturnValue)
{
var ReturnValue
var Re="ABCDEFGHIJKLMNOPQRSTUVWXYZ-" //del E/P过滤拼音
    Re=Re+"abcdefghijklmnopqrstuvwxyz" //del E/P
if(PostReturnValue!=null)//返回值不为空
{
	for(var f=0;f<FlightCityCode.length;f++)
	{
		if((FlightCityCode[f])==PostReturnValue)
		{
		ReturnValue=FlightCityText[f]
		break
		}
	}
	//alert(Re)
	//ReturnValue="ABCDEFG"
    var replacetext//拼音字符
	replacetext=""
	for(var s=0;s<ReturnValue.length;s++)
		{
			
			if (Re.indexOf(ReturnValue.substring(s,s+1))!=-1) //汉字)>0)
			{
				//alert(ReturnValue.substring(s,s+1))
				replacetext=replacetext+ReturnValue.substring(s,s+1)//拼音组合
			}
		}
	ReturnValue=ReturnValue.replace(replacetext,"")
	ReturnValue=ReturnValue.replace(" ","")
	return ReturnValue
}
else
	{
	var SelectCity=document.getElementById(CityID)
	for(var  i=0;i<FlightCityCode.length;i++)
	{
	 
	 SelectCity.options[i]=new  Option(FlightCityText[i],FlightCityCode[i])
	 if (SelectedValue!=null){
		if (FlightCityCode[i]==SelectedValue)
		{
		SelectCity.options[i].selected=true
		}
	 }
		 //break
	}
	}
}




//国外城市
function CreateCityFG(CityID,SelectedValue,PostReturnValue)
{
var ReturnValue
var Re="ABCDEFGHIJKLMNOPQRSTUVWXYZ-" //del E/P过滤拼音
    Re=Re+"abcdefghijklmnopqrstuvwxyz" //del E/P
if(PostReturnValue!=null)//返回值不为空
{
	for(var f=0;f<FlightCityCodeFG.length;f++)
	{
		if((FlightCityCodeFG[f])==PostReturnValue)
		{
		ReturnValue=FlightCityTextFG[f]
		break
		}
	}
	//alert(Re)
	//ReturnValue="ABCDEFG"
    var replacetext//拼音字符
	replacetext=""
	for(var s=0;s<ReturnValue.length;s++)
		{
			
			if (Re.indexOf(ReturnValue.substring(s,s+1))!=-1) //汉字)>0)
			{
				//alert(ReturnValue.substring(s,s+1))
				replacetext=replacetext+ReturnValue.substring(s,s+1)//拼音组合
			}
		}
	ReturnValue=ReturnValue.replace(replacetext,"")
	ReturnValue=ReturnValue.replace(" ","")
	return ReturnValue
}
else
	{
	var SelectCity=document.getElementById(CityID)
	for(var  i=0;i<FlightCityCodeFG.length;i++)
	{
	 
	 SelectCity.options[i]=new  Option(FlightCityTextFG[i],FlightCityCodeFG[i])
	 if (SelectedValue!=null){
		if (FlightCityCodeFG[i]==SelectedValue)
		{
		SelectCity.options[i].selected=true
		}
	 }
		 //break
	}
	}
}



function                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 (Key,SelectCityID)
{
var Keyvalue=Key
//alert(Keyvalue)
var ChangeCity=document.getElementById("ChangeCity")
var OptionName=document.getElementById(SelectCityID)
for(var  g=0;g<ChangeCity.options.length;g++)
{
ChangeCity.removeChild(ChangeCity.options[g])
}
for(var  i=0;i<OptionName.options.length;i++)
{
if ((OptionName.options[i].text.indexOf(Keyvalue))!=-1&&(Keyvalue!=""))
{
     //alert(OptionName.options[i].text)
     OptionName.options[i].selected=true
	 
	 //CityNumbers.value=OptionName.options[i].value
	 ChangeCity.options[ChangeCity.options.length]=new  Option(OptionName.options[i].text,OptionName.options[i].value)
	 //break
}

//if(OptionName.options[i].selected==true  &&  txt.value!="")
//{  
//alert(OptionName.options[i].text)
//}
}  
//DEL OPTION OptionName.removeChild(OptionName.options[1])
//	 
}
function OptionValue(SelectID,PostValue)
{
var SelectIDs=document.getElementById(SelectID)
for(var  i=0;i<SelectIDs.options.length;i++)
{
if ((SelectIDs.options[i].value.indexOf(PostValue))!=-1&&PostValue!='')
{
     //alert(CityNamevalue+OptionName.options[i].text)
	 SelectIDs.options[i].selected=true

	 break
}

//if(OptionName.options[i].selected==true  &&  txt.value!="")
//{  
//alert(OptionName.options[i].text)
//}
}  
//DEL OPTION OptionName.removeChild(OptionName.options[1])
//	NEW OPTION{OptionName.options[OptionName.options.length]=new  Option(txt.value,txt.value);}  
}

<!--
function onclick_flightway1(PostFlightWay)
  {
    document.getElementById('FlightWay').value=PostFlightWay
    UniteTable1.style.display  = "none";
    UniteTable2.style.display  = "none";
	DoubleTable1.style.display = "none";

  }
function onclick_flightway2(PostFlightWay )
     {
	document.getElementById('FlightWay').value=PostFlightWay 
    UniteTable1.style.display  = "none";
    UniteTable2.style.display  = "none";
	DoubleTable1.style.display = "block";
	 }
function onclick_flightway3(PostFlightWay )
     {
	document.getElementById('FlightWay').value=PostFlightWay 
    UniteTable1.style.display  = "block";
    UniteTable2.style.display  = "block";
	DoubleTable1.style.display = "none";
	 }

function FlightSearchCheck()
{

if(document.Flight.StartDate.value.length==0){
			alert("请输入出发日期！");
			document.Flight.StartDate.focus();
			return false
		}	
		if(!isDateString(document.Flight.StartDate.value)){
			alert("出发日期不符合格式规范或无效的日期！");
			document.Flight.StartDate.focus();
			return false
		}
		if (stringToDate(document.Flight.StartDate.value,true)<stringToDate("<%=date()%>",true)){
			alert("出发日期不能早于"+document.Flight.StartDate.value+"！");
			document.Flight.StartDate.focus();
			return false
		}	
if(document.getElementById('FlightWay').value=='double')	
	{
	
		if (document.Flight.ReturnDate.value.length==0){
			alert("请输入返程日期！");
			document.Flight.ReturnDate.focus();
			return false
	    }	
		
		if(!isDateString(document.Flight.ReturnDate.value)){
			alert("返程日期不符合格式规范或无效的日期！");
			document.Flight.ReturnDate.focus();
			return false
		}	
		if (stringToDate(document.Flight.ReturnDate.value,true)<stringToDate("<%=date()%>",true)){
			alert("返程日期不能早于"+document.Flight.ReturnDate.value+"！");
			document.Flight.ReturnDate.focus();
			return false
		}			
	}
		
if(document.getElementById('FlightWay').value=='unite')	
	{
	
		if (document.Flight.StartDate2.value.length==0){
			alert("请输入第二行程出发日期！");
			document.Flight.StartDate2.focus();
			return false
	    }	
		
		if(!isDateString(document.Flight.StartDate2.value)){
			alert("第二行程出发日期不符合格式规范或无效的日期！");
			document.Flight.StartDate2.focus();
			return false
		}	
		
		if (stringToDate(document.Flight.StartDate2.value,true)<stringToDate("<%=date()%>",true)){
			alert("第二行程出发日期不能早于"+document.Flight.StartDate2.value+"！");
			document.Flight.StartDate2.focus();
			return false
		}				
	}


return true
} 