You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

240 lines
7.5 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

// JavaScript Document
document.write("<script language=\"javascript\" src=\"/js/inland.js\"></script>");
$(function(){
//函数getAirPortCode
//根据城市名获得机场代码
//m_HTML1-城市数组源m_HTML2机场代码数组源m_cityName输入城市名m_Hide-输出位置(为一个隐藏域)
function getAirPortCode(m_HTML1,m_HTML2,m_cityName,m_Hide){
var airport_split = citystr.split(",");
var airportCode_split = citystrcode.split(",");
var m_cityName_temp = m_cityName.toUpperCase();
for(i=0;i<airport_split.length-1;i++){
if(airport_split[i]==m_cityName_temp){
$("#"+m_Hide).val(airportCode_split[i]);
// alert($("#"+m_Hide).val());return false;
break;
}
}
}
//提交机票首页搜索
// $("#js_search_flights_button").click(function(){
// if($("#destinationCode2Text").val()==""){
// var startCode1Text = $("#startCode1Text").val();
// var destinationCode1Text = $("#destinationCode1Text").val();
// var temp = getAirPortCode("airport","airportCode",startCode1Text,"startCode1");
// var temp1 = getAirPortCode("airport","airportCode",destinationCode1Text,"destinationCode1");
// }
// else{
// var startCode1Text = $("#startCode1Text").val();
// var destinationCode1Text = $("#destinationCode1Text").val();
// var destinationCode2Text = $("#destinationCode2Text").val();
// var temp = getAirPortCode("airport","airportCode",startCode1Text,"startCode1");
// var temp1 = getAirPortCode("airport","airportCode",destinationCode1Text,"destinationCode1");
// var temp2 = getAirPortCode("airport","airportCode",destinationCode2Text,"destinationCode2");
// }
// return false;
// $("#flightsform").attr("action","/china-flights/postquery.asp");
// $("#flightsform").submit();
// });
$(".triptype").click(function(){
$(".getFromCity").hide();
if($(this).val()=="1"){
$("#tReturn").css("display","none");
$("#flightFromTo").html("&nbsp; To: ");
$("#StrseCity").css("display","none");
$("#Depart").html("Depart: ");
$("#aReturn").html("To");
}
else if($(this).val()=="2"){
$("#tReturn").css("display","");
$("#flightFromTo").html("&nbsp; To: ");
$("#StrseCity").css("display","none");
$("#Depart").html("Depart: ");
$("#Return").html("Return");
$("#aReturn").html("To");
}
else if($(this).val()=="3"){
$("#flightFromTo").html("&nbsp; Fst Arrival: ");
$("#StrseCity").css("display","");
$("#Return").html("Sec Depart: ");
$("#Depart").html("Fst Depart:");
$("#tReturn").css("display","");
$("#aReturn").html("Fst Arrival");
}
});
});
///////Country弹窗
function getCityList(cityText,cityDiv,cityCode){
$("#"+cityDiv).css("display","");
var w = $("#"+cityText).val();
var ajax_url = "/include/ajax-getcity.asp?w="+w+"&cityText="+cityText+"&cityCode="+cityCode+"&cityDiv="+cityDiv
postget(ajax_url,cityDiv);}
//cc:城市代码 cn:城市名
function SelectCity(cc,cn,cityText,cityCode,cityDiv){
$("#"+cityText).val(cn);
$("#"+cityCode).val(cc);
$("#"+cityDiv).css("display","none");
}
function CancelDiv(strDiv){$("."+strDiv).hide();}
$(function(){
$("#startCode1Text").focus(function(){
$(".getFromCity").hide();
$("#getFromCity1").show();
})
});
$(function(){
$("#destinationCode1Text").focus(function(){
$(".getFromCity").hide();
$("#getFromCity2").show();
})
});
$(function(){
$("#destinationCode2Text").focus(function(){
$(".getFromCity").hide();
$("#getFromCity3").show();
})
});
///////Country弹窗
$(document).ready(function(){
//航班搜索JS代码
//CZY - finish
//CJ - move into
var oLabel=$("#typeSelect input");
oLabel.eq(0).attr("checked","checked");
//定义一个函数先隐藏全部的label标签
function hideAll(){
$("#frame2 label").hide();
$("#frame3 label").hide();
}
//遍历三个label分别给加上点击事件
oLabel.each(function(i){
switch(i){
case 0:
this.onclick=function(){
hideAll();
$("#fromWhere").show();
$("#toWhere").show();
$("#startDate").show();
$("#textTo").html("<strong>Going to:</strong");
$("#takeoffDate1").bind("click",'', function(){showCalendar('dateImage1',false,'takeoffDate1')});
}
break
case 1:
this.onclick=function(){
hideAll();
$("#fromWhere").show();
$("#toWhere").show();
$("#startDate").show();
$("#endDate").show();
$("#textTo").html("<strong>Going to:</strong>");
$("#textRetuenDate").html("&nbsp;<strong>Return:</strong>");
$("#takeoffDate1").bind("click",function(){showCalendar('dateImage1',false,'takeoffDate1', 'dateImage2', 'takeoffDate2');});
}
break
case 2:
this.onclick=function(){
hideAll();
$("#fromWhere").show();
$("#toWhere").show();
$("#startDate").show();
$("#endDate").show();
$("#textTo").html("&nbsp;<strong>Fst Arrival:</strong>");
$("#arrival").show();
$("#textRetuenDate").html("&nbsp;<strong>Sec Depart:</strong>")
}
break
}
});
//航班搜索JS代码
//作用页面 flight-list.asp flight-list-02.asp
//机票ALL Classes 展开效果
$(".tableResult .allclass").click(function(){
var strtmp = $(this).attr("name");
var arrstrtmp = strtmp.split("_");
//PEK,SHA_SHA,PEK_1895815_79476_1
var cstar = arrstrtmp[0];
var cdest = arrstrtmp[1];
var id = arrstrtmp[2];
var queryId = arrstrtmp[3];
var blsave = arrstrtmp[4];
var datapag;
var js_Cache = "<tr class='js_openClass'><td colspan='7'><img src='/pic/ajax-loader-1.gif' /></td></tr>";
if($(this).attr("id") == "js_openClass")
{
$(this).parents("tr").after(js_Cache);
$(this).text("Hide Classes").attr("id","js_closeClass")//更改ID跟显示文本
.parents("tr").attr("id",$(this).parents("tr").attr("class")).removeClass().addClass("openClass");
//缓存后不调用AJAX
if($(".tr"+id).length > 0 )
{
$(".js_openClass").remove();
$(".tr"+id).show();
return;
}
//缓存后不调用AJAX
$.post("/include/ajax.asp",{strtemp:"get-other-flight-price",id:id,queryId:queryId,cstar:cstar,cdest:cdest,blsave:blsave},function(data){
// alert(data);
$(".js_openClass").remove();
$(".allclass[name="+strtmp+"]").parents("tr").after(data);
});
}
else
{
$(this).text("All Classes").attr("id","js_openClass")//切换回ID跟显示文本
.parents("tr").removeClass().addClass($(this).parents("tr").attr("id"));
$(".tr"+id).hide();
}
});
//机票ALL Classes 展开效果
$(".ParamSort").click(function(){
// alert($(this).attr("name"));return false;
if($(this).attr("id") == "OrderByTime")
{
$("#orderBy_Price").val("");
$("#orderBy_Time").val($(this).attr("name"));
}
else
{
$("#orderBy_Time").val("");
$("#orderBy_Price").val($(this).attr("name"));
}
// alert($("#orderBy_Time").val());
// alert($("#orderBy_Price").val());
// return false;
$("#flightForm").submit();
});
//作用页面 flight-list.asp flight-list-02.asp
//flight-list.asp flight-list-02.asp
//页面筛选航空公司和时间按钮效果
//Wushitang 09-8-29
$.each($(".flightSort input:visible"),function(){
$(this).click(function(){
if($(this).attr("checked"))
{
$("#flightForm").submit();
return;
}
});
});
//flight-list.asp flight-list-02.asp
//页面筛选航空公司和时间按钮效果
//flight-list.asp
//点击触发选择往返或联程最便宜价格组合的事件
$("#js_chooseLowPrice").click(function(){
$(this).parents("form").submit();
});
//flight-list.asp
//点击触发选择往返或联程最便宜价格组合的事件
})