// JavaScript Document $(document).ready(function(e) { $("#loading").hide(); $(".flyloading").remove(); $(".relinfo").show(); lowestcss(); $(".flightstop").tablesorter({widthFixed: true}).tablesorterPager({container: $("#mypager"),size:1}); $(".intelFlight").tablesorter({sortList:[[5,0]],cssAsc: "sortDown",cssDesc: "sortUp"}); if(parseInt($("#totalpage").html())==1){$(".prev").hide;$(".next").hide()}; var utcdeparture=$('.utcdeparture').html(); if(utcdeparture!=='' && typeof utcdeparture != 'undefined'){$(".utcdeparture").html('('+getUTCdate(utcdeparture)+')')} var utcreturn=$('.utcreturn').html(); if(utcreturn!='' && typeof utcreturn != 'undefined'){$(".utcreturn").html('('+getUTCdate(utcreturn)+')')}; var utcmreturn=$('.utcmreturn').html(); if(utcmreturn!='' && typeof utcmreturn != 'undefined'){$(".utcmreturn").html('('+getUTCdate(utcmreturn)+')')}; $(".futcdate").each(function() { var ut=getUTCdate($(this).html()); $(this).html(ut) }); dfradio(); if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){$('.ffonly').addClass('flightcode')} NumStop(); resultCity(); gotop(); }); function resultCity() { var ca=$(".dpcity").html();var cb=$(".dtcity").html();var cc=$(".rfcity").html();var cd=$(".rtcity").html() $(".dpc").html(ca); $(".dtc").html(cb); $(".rfc").html(cc); $(".rtc").html(cd); } //goTop function gotop() { var $backToTopTxt = "Top", $backToTopEle = $('
').appendTo($("body")) .text($backToTopTxt).attr("title", $backToTopTxt).click(function() { $("html, body").animate({ scrollTop: 0 }, 120); }), $backToTopFun = function() { var st = $(document).scrollTop(), winh = $(window).height(); (st > 0)? $backToTopEle.show(): $backToTopEle.hide(); //IE6下的定位 if (!window.XMLHttpRequest) { $backToTopEle.css("top", st + winh - 166); } }; $(window).bind("scroll", $backToTopFun); $(function() { $backToTopFun(); }); } //设置与lowest相等的单元格样式 function lowestcss() { var nonlow=$(".nonlow").html();var onelow=$(".onelow").html();var twolow=$(".twolow").html() $(".islow").each(function() { var thislow=$(this).html(); if(thislow==nonlow || thislow==onelow || thislow==twolow) { $(this).attr("class","low") } }); } // function NumStop() { var non=parseInt($("#stnon").html());var one=parseInt($("#stone").html());var two=parseInt($("#sttwo").html()); if(non==0){$("#snon").hide(); $("#stonon").attr("onclick",""); $("#stonon").attr("title","non flight");} if(one==0){$("#sone").hide(); $("#stoone").attr("onclick",""); $("#stoone").attr("title","non flight");} if(two==0){$("#stwo").hide(); $("#stotwo").attr("onclick",""); $("#stotwo").attr("title","non flight");} } //搜索框默认选择oneway/roundtrip/multicities function dfradio() { var dfr=$("#rflytype").html(); if(dfr=='oneway'){$('.onetype').click()}else if(dfr=='roundtrip'){$('.roundtype').click()}else if(dfr=="multicities"){$('.multitype').click()} } //切换左边的菜单 function Togle(obj,id,callback){ var mObj = $(obj); var isHiden = true; var sObj = $("#"+id); if(sObj.is(":hidden")){ sObj.slideDown("slow"); isHiden = false; mObj.removeClass("filtercategoryclose").addClass("filtercategory"); }else{ sObj.slideUp("slow"); mObj.removeClass("filtercategory").addClass("filtercategoryclose"); } if(typeof callback != 'undefined'){ callback(mObj,isHiden); } } //显示或隐藏航程详情 function FlightDetial(DoClass) { var tempPartent=DoClass.replace("SD","DoSD"); if($('.'+DoClass).is(":hidden")) { $('.'+tempPartent).html('Hide Flight Details') $('.'+tempPartent).attr('title','Click to Hide Flight Details') $('.'+DoClass).show() }else { $('.'+tempPartent).html('Show Flight Details') $('.'+tempPartent).attr('title','Click to Show Flight Details') $('.'+DoClass).hide() } } //显示或隐藏机场信息 function showairport(DoClass) { if($('.'+DoClass).is(":hidden")) { $('.'+DoClass).show() }else{ $('.'+DoClass).hide() } } //排序功能样式 function doSort(Did) { $('#'+Did).click(); var tem=$("#"+Did).attr("class"); temarr=tem.split(' '); thiscss=temarr[2]; $('.sortTable a').attr("class","sortunUp") if(Did=="Departure"){ $('.sortTable tr:first').find('td').eq(1).find('a').attr("class",thiscss); }else if(Did=="Arrival"){ $('.sortTable tr:first').find('td').eq(2).find('a').attr("class",thiscss); }else if(Did=="Stops"){ $('.sortTable tr:first').find('td').eq(3).find('a').attr("class",thiscss); }else if(Did=="Duration"){ $('.sortTable tr:first').find('td').eq(4).find('a').attr("class",thiscss); }else if(Did=="sPrice"){ $('.sortTable tr:first').find('td').eq(5).find('a').attr("class",thiscss); } } //显示所有航班 function ftshowall() { resetdepartureTime(); resetsegment(); allairline('clear'); $("#notresult").hide(); $("#intelFlight>tbody>tr").show(); $("#ftsult").html($("#intelFlight>tbody>tr:visible").length) $("#showall").hide(); } //右侧中转次数 function ftTransit(o) { $("#numberStop dt").attr("class","unselect"); $(o).siblings().attr("class","unselect2").end().attr("class","select2"); ftResult(); } //Departure Time function DTime(o) { $("#departuretime dt").attr("class","unselect"); $(o).siblings().attr("class","unselect2").end().attr("class","select2"); ftResult(); } //头部中转次数 function ftHTransit(seg) { resetdepartureTime(); $("#notresult").hide(); $("#intelFlight>tbody>tr").show(); $("#intelFlight>tbody>tr:visible").filter(function(e){ if($(this).attr("seg")==seg){return false}else{return true} }).hide(); if($("#intelFlight>tbody>tr:visible").length<1){ $("#notresult").show(); } $("#ftsult").html($("#intelFlight>tbody>tr:visible").length) $("#showall").show(); stopcss(seg); airlinecss(seg); } //头部航空公司+经停 function ftTopTransit(seg,airline) { resetdepartureTime(); $("#notresult").hide(); $("#intelFlight>tbody>tr").show(); $("#intelFlight>tbody>tr:visible").filter(function(e){ if($(this).attr("seg")==seg && $(this).attr("airline")==airline){return false}else{return true} }).hide(); if($("#intelFlight>tbody>tr:visible").length<1){ $("#notresult").show(); } $("#ftsult").html($("#intelFlight>tbody>tr:visible").length) $("#showall").show(); airlinecss(airline); stopcss(seg); } //最低价格+中转 function ftlowestprice(price,seg) { resetdepartureTime(); $("#notresult").hide(); $("#intelFlight>tbody>tr").show(); $("#intelFlight>tbody>tr:visible").filter(function(e){ if(parseInt($(this).attr("totalprice"))==parseInt(price)){return false}else{return true} }).hide(); //最后提示是否存在结果 if($("#intelFlight>tbody>tr:visible").length<1){ $("#notresult").show(); } $("#ftsult").html($("#intelFlight>tbody>tr:visible").length) $("#showall").show(); airlinecss(seg); stopcss(seg); } //Airline function ftAirline(o){ //resetsegment(); if($(o).attr("class")=="select"){ $(o).attr("class","unselect"); }else{ $(o).attr("class","select") } ftResult(); } //Header Airline function Hairline(strcode) { $("#notresult").hide(); $("#intelFlight>tbody>tr").show(); $("#intelFlight>tbody>tr:visible").filter(function(e){ var re=true; if($(this).attr("airline")==strcode){re = false} return re; }).hide(); if($("#intelFlight>tbody>tr:visible").length<1){ $("#notresult").show(); } $("#ftsult").html($("#intelFlight>tbody>tr:visible").length) $("#showall").show(); airlinecss(strcode); resetsegment(); resetdepartureTime(); } function ftResult(ar1,ar2,ar3,ar4) { $("#notresult").hide() o1=$("#numberStop"); //中转次数 o2=$("#airlineName"); //航空公司 o3=$("#departuretime"); //时间 var arg1 = "",arg2 = "",arg3 = "",arg4 = "",arg5 = "",mintime="",maxtime="",minarrival="",maxarrival=""; arg1 = o1.find("dt").filter(".select2").attr("val"); o2.find("dt").filter(".select").each(function(){arg2 = arg2?arg2+=(","+$(this).attr("val")):$(this).attr("val");}); arg3=o3.find("dt").filter(".select2").attr("val"); arg1 = ar1?ar1:arg1; arg2 = ar2?ar2:arg2; arg3 = ar3?ar3:arg3; $("#intelFlight>tbody>tr").show(); //显示所有行 //中转次数 if(arg1 != "" && typeof arg1 != "undefined"){ $("#intelFlight>tbody>tr:visible").filter(function(e){ if($(this).attr("seg")==arg1){return false}else{return true} }).hide(); } //航空公司 if(arg2 !== ""){ arg2 = arg2.split(","); $("#intelFlight>tbody>tr:visible").filter(function(e){ var re=true; for(var i=0;i