﻿	function showOpen(){
		j$("#divObj").hide();
		j$("#divOpen").show();
	}
	function show(){
		j$("#divOpen").hide();
		j$("#divObj").show();
	}
	function gotoCode(){
		var fligthNo = document.getElementById("flightNo").value;
		if(fligthNo == "\u8f93\u5165\u822a\u73ed\u53f7"){
			document.getElementById("flightNo").value='';
		}
		document.getElementById("codeForm").submit();
	}
	function goto(){
		document.getElementById("mainForm").submit();
	}
	
	//如果城市或者航空公司作为条件时，分页需将值带回页面
	var al="";
	var ds="";
	
	//判断是国内或者国际，到港或者离港
	var d='0';	
	function setCityvalue(direction){
	if(direction == null){
		direction = 0;
	}
	document.getElementById("direction").value = direction;
	d = direction;
	var depart = 'true';
	var international = 'true';
	if(d == '0' || d == '2'){
		depart = 'true';
		show();
	}else{
		depart = 'false';
		showOpen();
	}	 	
	if(d == '0' || d == '1'){
		international = 'false';
		FlightService.findAirline(depart,international,createList2);	
		try{
			document.getElementById("airline").disabled  = false;
		} catch (e) {}
	}else{
		international = 'true';
		try{
				document.getElementById("airline").disabled  = true;		
				document.getElementById("airline").options[0].selected=true;
		} catch (e) {}
	}
		FlightService.findCity(depart,international,createList1);
	}
	//ajax查询城市
	function createList1(data) {
		DWRUtil.removeAllOptions("dest");
		DWRUtil.addOptions("dest", data);
		if(ds!=""){			
			DWRUtil.setValue("dest",ds);			
		}
	} 
	//ajax查询航空公司
	function createList2(data){
		DWRUtil.removeAllOptions("airline");		
		DWRUtil.addOptions("airline", data);
		if(al!=""){
			DWRUtil.setValue("airline",al);				
		}
	}
	setCityvalue(0);