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.

138 lines
5.8 KiB
JavaScript

function createSelectYear(o){
o = document.getElementById(o);
o.options.length=101;
dt = new Date();
tmpyear = dt.getFullYear();
initYear = tmpyear-100;
for (i=0;i<=100;i++){
o.options[i].text=initYear+i
o.options[i].value=initYear+i
if (i==53){o.options[i].selected="selected";}
}
}
function createSelectMonth(o){
o = document.getElementById(o);
o.options.length=31;
for (i=0;i<=30;i++){
o.options[i].text=1+i;
o.options[i].value=1+i;
}
}
//调整显示框
function changePassenger(){
an = parseInt($("#adultNum").val());
cn = parseInt($("#childNum").val()||0);
bn = parseInt($("#babyNum").val()||0);
(cn) ? $("#flightPerPrice_C,#flightPerPrice_C_show,#flightPerPrice_R_C,#flightPerPrice_R_C_show").attr('class',''):
$("#flightPerPrice_C,#flightPerPrice_C_show,#flightPerPrice_R_C,#flightPerPrice_R_C_show").attr('class','none');
(bn) ? $("#flightPerPrice_B,#flightPerPrice_B_show,#flightPerPrice_R_B,#flightPerPrice_R_B_show").attr('class',''):
$("#flightPerPrice_B,#flightPerPrice_B_show,#flightPerPrice_R_B,#flightPerPrice_R_B_show").attr('class','none');
for(i = 1; i <= 20;i++){
if(i<=an){
if($("#expi"+i).length<1){
$("#expi1").clone(true).attr("id","expi"+i).appendTo($("#extbody"));
$(".traveller",$("#expi"+i)).html("Adults "+i);
$("#plastname1",$("#expi"+i)).attr("id","plastname"+i).val("");
$("#pfirstname1",$("#expi"+i)).attr("id","pfirstname"+i).val("");
$("#passport1",$("#expi"+i)).attr("id","passport"+i).val("");
$("#pexpdate1",$("#expi"+i)).attr("id","pexpdate"+i).val("");
}
}else{$("#expi"+i).remove();}
if(i<=cn){
if($("#expic"+i).length<1){
$("#expi1").clone(true).attr("id","expic"+i).appendTo($("#extbody1"));
$(".traveller",$("#expic"+i)).html("Children "+i);
$("#plastname1",$("#expic"+i)).attr("id","plastname_cn_"+i).val("");
$("#pfirstname1",$("#expic"+i)).attr("id","pfirstname_cn_"+i).val("");
$("#passport1",$("#expic"+i)).attr("id","passport_cn_"+i).val("");
$("#pexpdate1",$("#expic"+i)).attr("id","pexpdate_cn_"+i).val("");
}
}else{$("#expic"+i).remove();}
if(i<=bn){
if($("#expib"+i).length<1){
$("#expi1").clone(true).attr("id","expib"+i).appendTo($("#extbody2"));
$(".traveller",$("#expib"+i)).html("Infants "+i);
$("#plastname1",$("#expib"+i)).attr("id","plastname_bn_"+i).val("");
$("#pfirstname1",$("#expib"+i)).attr("id","pfirstname_bn_"+i).val("");
$("#passport1",$("#expib"+i)).attr("id","passport_bn_"+i).val("");
$("#pexpdate1",$("#expib"+i)).attr("id","pexpdate_bn_"+i).val("");
}
}else{$("#expib"+i).remove();}
}
$("#adults,#adults2").html(an); $("#childs,#childs2").html(cn); $("#babys,#babys2").html(bn);
$.ajax({
type: "POST",
url: "reserve-flight-price.asp",
cache: false,
data:"adult="+an+"&child="+cn+"&baby="+bn,
dataType :"xml",
async: false,
success: function(html){
var statu = $(html).find("statu").text();
$("#adults_usd_count").html($(html).find("adultUsd").text());//成人美元价
$("#adults_rmb_count").html($(html).find("adultRmb").text());//成人人民币价
$("#childs_usd_count").html($(html).find("childUsd").text());//儿童美元价
$("#childs_rmb_count").html($(html).find("childRmb").text());//儿童人民币价
$("#babys_usd_count").html($(html).find("babyUsd").text());//婴儿美元价
$("#babys_rmb_count").html($(html).find("babyRmb").text());//婴儿人民币价
$("#adults_usd_count2").html($(html).find("adultUsd2").text());//成人美元价
$("#adults_rmb_count2").html($(html).find("adultRmb2").text());//成人人民币价
$("#childs_usd_count2").html($(html).find("childUsd2").text());//儿童美元价
$("#childs_rmb_count2").html($(html).find("childRmb2").text());//儿童人民币价
$("#babys_usd_count2").html($(html).find("babyUsd2").text());//婴儿美元价
$("#babys_rmb_count2").html($(html).find("babyRmb2").text());//婴儿人民币价
$('#PriceUnit').text( Number($(html).find("adultUsd").text()) + Number( $(html).find("adultUsd2").text() ) );
$("#Taxfee_usd").html($(html).find("TaxFee").text());
$("#servicefee_usd").html($(html).find("SerFee").text());
$("#Bankfee_usd").html($(html).find("BkHFee").text());
$("#TotalUSD").html($(html).find("Total").text());
$("#TotalRMB").html($(html).find("TotalRmb").text());
document.getElementById("totalPrice").value = $(html).find("Total").text();
$("#serverfee").val($(html).find("TaxFee").text()+"|"+$(html).find("SerFee").text()+"|"+$(html).find("BkHFee").text());
}
});
}
function displayPackinfo(o){
o.checked?$("#packinfoTable").show():$("#packinfoTable").hide();
}
$(document).ready(function() {
$("[id^=plastname]").bind('click focusin',function(){ $(this).attr("class","lastname") });
$("[id^=plastname]").bind('focusout',function(){ if($(this).val()==""){$(this).attr("class", "lastname lastNBG")} });
$("[id^=pfirstname]").bind('click focusin',function(){ $(this).attr("class","fullname") });
$("[id^=pfirstname]").bind('focusout',function(){ if($(this).val()==""){$(this).attr("class","fullname firstNBG")} });
$("[id^=passport]").bind('click focusin',function(){ $(this).attr("class","passport") });
$("[id^=passport]").bind('focusout',function(){ if($(this).val()==""){$(this).attr("class", "passport passNBG")} });
$.ajax({
url: "/js/flight/idd-code.xml",
cache: false,
dataType: "xml",
success: function(data){
var list=new Array();
$(data).find("item").each(function(i){
var Country = $(this).children("Country").text();
var TollFree = $(this).children("TollFree").text();
var TmpStr = "<option value=\""+TollFree+"\">"+ TollFree+" ("+Country +")</option>"
if($(this).children("Country").text() != ""){
list.push(TmpStr);
}
});
for(var i=list.length; i>=0; i--){
$("#iddcodephone").append(list[i]);
$("#iddcodemobile").append(list[i]);
}
}
});
});