function OpenUrl(Url,Width,Height,scrollbars){
 window.open(""+Url,"","Width="+Width+",Height="+Height+",top=100,left=100,status=no,scrollbars="+scrollbars)
}
function GP(n){
 var dight = n/10;
 var l = dight.toString().length - (dight.toString().indexOf('.') + 1);
 for(var i=l;i>=0;i--)
	dight = new Number(dight.toFixed(i));
 return dight*10; 
} 
function showTable(sel){
 var val = sel.value;
 var cur = form1.IsTrue.value;
 document.getElementById("intermoreE").style.display = "none";
 if(val == 0){
	document.getElementById("BackDate").style.display = "none";
	document.getElementById("sMultiCity").style.display = "none";
	document.getElementById("eMultiCity").style.display = "none";
	document.getElementById("MultiDate").style.display = "none";
	if(cur == 3){
		ACN(form1.StartCity,"PEK");
		ACN(form1.EndCity,"PVG");
		SV(form1.StartTime,"");	
		AWN(form1.AirLine);}
	else{
		SV(form1.StartCity,"PEK,北京首都");
		SV(form1.EndCity,"PVG,上海浦东");
		SV(form1.StartTime,"");	
		SV(form1.AirLine,"");}}
 else if(val == 1){
	document.getElementById("BackDate").style.display = "block";
	document.getElementById("sMultiCity").style.display = "none";
	document.getElementById("eMultiCity").style.display = "none";
	document.getElementById("MultiDate").style.display = "none";
	if(cur == 3){
		ACN(form1.StartCity,"PEK");
		ACN(form1.EndCity,"PVG");
		SV(form1.StartTime,"");	
		SV(form1.BackTime,"");	
		AWN(form1.AirLine);}
	else{
		SV(form1.StartCity,"PEK,北京首都");
		SV(form1.EndCity,"PVG,上海浦东");
		SV(form1.StartTime,"");	
		SV(form1.BackTime,"");	
		SV(form1.AirLine,"");}}
 else if(val == 2){
	document.getElementById("BackDate").style.display = "none";
	document.getElementById("sMultiCity").style.display = "block";
	document.getElementById("eMultiCity").style.display = "block";
	document.getElementById("MultiDate").style.display = "block";
	if(cur == 3){
		ACN(form1.StartCity,"PEK");
		ACN(form1.EndCity,"PVG");
		ACN(form1.StartCity2,"PVG");
		ACN(form1.EndCity2,"CAN");
		SV(form1.StartTime,"");	
		SV(form1.StartTime2,"");	
		AWN(form1.AirLine);}
	else{
		SV(form1.StartCity,"PEK,北京首都");
		SV(form1.EndCity,"PVG,上海浦东");
		SV(form1.StartCity2,"PVG,上海浦东");
		SV(form1.EndCity2,"CAN,广州");
		SV(form1.StartTime,"");	
		SV(form1.StartTime2,"");
		SV(form1.AirLine,"");}}
 else{
	document.getElementById("intermoreE").style.display = "";
	document.getElementById("BackDate").style.display = "none";
	document.getElementById("sMultiCity").style.display = "none";
	document.getElementById("eMultiCity").style.display = "none";
	document.getElementById("MultiDate").style.display = "none";
	if(cur == 3){
		SV(form1.StartCity,"");
		SV(form1.EndCity,"");
		SV(form1.StartTime,"");
		SV(form1.AirLine,"");}
	else{
		AII(form1.StartCity);
		ACI(form1.EndCity);
		ST(form1.StartTime);	
		AWI(form1.AirLine);}}
 form1.IsTrue.value = val;
}
function CheckDate(s){
 var Today = new Date();
 var y,m,d,t;
 y = Today.getFullYear();
 m = Today.getMonth() + 1;
 if(m<10) m = "0"+m;
 d = Today.getDate();
 if(d<10) d = "0"+d;
 t = y + "-" + m + "-" + d;
 return (t>s);
}
function Check(){
with(form1){
 var sel = Istrue.value;
 if(sel == 3){
	action = "Abroad.asp";
}
 else{
	if(EndCity.value == StartCity.value){
		alert("出发城市与到达城市不能相同！");
		EndCity.focus();
		return false;}
	if(CheckDate(StartDate.value)){
		alert("出发日期不能小于当前日期！");
		StartDate.focus();
		return false;}
	if(sel == 1){
		if(CheckDate(BackDate.value)){
			alert("回程日期不能小于当前日期！");
			BackDate.focus();
			return false;}
		if(BackDate.value < StartDate.value){
			alert("回程日期不能小于出发日期！");
			BackDate.focus();
			return false;}}
	if(sel == 2){
		if(EndCity2.value == StartCity2.value){
			alert("出发城市与到达城市不能相同！");
			EndCity2.focus();
			return false;}
		if(CheckDate(StartDate2.value)){
			alert("第二出发日期不能小于当前日期！");
			StartDate2.focus();
			return false;}
		if(StartDate2.value < StartDate.value){
			alert("第二出发日期不能小于第一出发日期！");
			StartDate2.focus();
			return false;}}
	}
 }
}
