/******************************************************
* コンストラクタ
******************************************************/
function ReserveModule(frm){
this.form = $("#"+frm); //予約モジュールのフォームの参照
this.toAndFromCondition = $("[name='toAndFromCondition']",this.form); //往復・片道ラジオボタン
this.departurePulldown = $("[name='departureCity']",this.form); //出発地プルダウン
this.arrivalPulldown = $("[name='arrivalCity']",this.form); //到着地プルダウン
this.arrivalConteiner = $("#"+ frm + "_arrivalConteiner"); //到着地プルダウンを格納するDIV
this.outwardMonth = $("[name='flightMonth']",this.form); //出発月プルダウン
this.outwardDate = $("[name='flightDay']",this.form); //出発日プルダウン
this.homewardMonth = $("[name='returnFlightMonth']",this.form); //復路月プルダウン
this.homewardDate = $("[name='returnFlightDay']",this.form); //復路日プルダウン
this.homewardContainer = $("#"+ frm + "_homewardDateContainer"); //復路日時プルダウンを格納するDIV
this.nowObject = new Date(); //現在日付
//現在日付をセットする
this.nowObject.setFullYear(
Warning: Use of undefined constant Y - assumed 'Y' (this will throw an Error in a future version of PHP) in /home/users/web05/7/5/0159257/www.info.fujidreamairlines.com/common/js/fda.ReserveModule.php on line 17
2025);
this.nowObject.setMonth(
Warning: Use of undefined constant n - assumed 'n' (this will throw an Error in a future version of PHP) in /home/users/web05/7/5/0159257/www.info.fujidreamairlines.com/common/js/fda.ReserveModule.php on line 18
1);
this.nowObject.setDate(
Warning: Use of undefined constant j - assumed 'j' (this will throw an Error in a future version of PHP) in /home/users/web05/7/5/0159257/www.info.fujidreamairlines.com/common/js/fda.ReserveModule.php on line 19
22);
this.nextYearHolder = null; //プルダウンメニューで翌年またぎになった時に一時的に使用
this.dateRelationFlag = false; //往路日付に連動して復路の日付を設定する際のフラグ変数
//出発日 日付のvalueを都度保持する
this.outwardDateValHolder = "01";
//復路 出発日付のvalueを都度保持する
this.homewardDateValHolder = "01";
//空港の一覧を保持する 路線の組み合わせを示すfrom配列は、接続元の空港を示す。from配列内の位置はairPorts配列内の位置と同じ。1になっている空港より接続を表す
this.airPorts = [
{id:0,name:"札幌(新千歳)",from:[0,0,0,0,0,1,1,0,0,0,0],value:"SPK"},
{id:1,name:"青森",from:[0,0,0,0,0,0,0,1,0,0,0],value:"AOJ"},
{id:2,name:"いわて花巻",from:[0,0,0,0,0,0,0,1,0,0,0],value:"HNA"},
{id:3,name:"いわて花巻",from:[0,0,0,0,0,0,0,1,0,0,0],value:"HNA"},
{id:4,name:"新潟",from:[0,0,0,0,0,0,0,1,1,0,0],value:"KIJ"},
{id:5,name:"松本",from:[1,0,0,0,0,0,0,0,1,0,0],value:"MMJ"},
{id:6,name:"富士山静岡",from:[1,00,,0,0,0,0,0,1,0,1],value:"FSZ"},
{id:7,name:"名古屋小牧",from:[0,1,1,1,1,0,0,0,1,1,0],value:"NKM"},
{id:8,name:"福岡",from:[0,0,0,0,1,1,1,1,0,0,0],value:"FUK"},
{id:9,name:"熊本",from:[0,0,0,0,0,0,0,1,0,0,0],value:"KMJ"},
{id:10,name:"鹿児島",from:[0,0,0,0,0,0,1,0,0,0,0],value:"KOJ"}
];
//初期化開始
this.init();
}
/*************************************************************
//メソッドを定義
*************************************************************/
//初期化 各パーツにイベントを設定
ReserveModule.prototype.init = function(){
//往復、片道設定後
this.toAndFromCondition.bind("change", $.proxy(function(event){
this.onTypeChange();
},this));
//往路空港選択後
this.departurePulldown.bind("change", $.proxy(function(event){
this.updateArrivalPD();
},this));
//出発月の変更イベント
this.outwardMonth.bind("change", $.proxy(function(event){
this.outwardDateValHolder = this.outwardDate.val();
this.homewardDateValHolder = this.homewardDate.val();
this.onArriveMonthChange();
this.setReturnDate();
this.outwardDate.val(this.outwardDateValHolder);
this.homewardDate.val(this.homewardDateValHolder);
},this));
//出発日の変更イベント
this.outwardDate.bind("change", $.proxy(function(event){
this.setReturnDate();
},this));
//復路 出発月の変更イベント
this.homewardMonth.bind("change", $.proxy(function(event){
if(this.dateRelationFlag==false){
this.homewardDateValHolder = this.homewardDate.val();
this.onReturnMonthChange();
this.homewardDate.val(this.homewardDateValHolder);
}
},this));
//往路プルダウン作成→復路プルダウン更新
this.initDeparturePD();
//月プルダウン作成
this.createMonthPullDown();
this.updateDayPullDown(this.nowObject.getFullYear(),this.nowObject.getMonth()+1);
this.updateReturnDayPullDown(this.nowObject.getFullYear(),this.nowObject.getMonth()+1);
this.setNowDatePD();
this.setReturnDate();
}
/*
往復プルダウンを初期作成します
*/
ReserveModule.prototype.initDeparturePD = function(){
this.departurePulldown.html("");
for(i=0; i').attr({ value: this.airPorts[i].value }).text( this.airPorts[i].name ));
this.departurePulldown.width();
}
}
this.updateArrivalPD(true);
}
/*
往路プルダウンが変更された時に復路プルダウンを更新します
*/
ReserveModule.prototype.updateArrivalPD = function(autoChanged){
var departureVal = this.departurePulldown.val();
var selectedID = 0;
this.arrivalPulldown.html("");
for(i=0; i').attr({ value: this.airPorts[j].value }).text( this.airPorts[j].name ));
this.arrivalPulldown.width();
}
}
//項目による連動でなく、ユーザの操作がされた場合はcookieに書き込みを行う
if(!autoChanged){
this.writeCookie("module_departure",this.departurePulldown.val(),365);
}
}
/*
月プルダウンを作成します
*/
ReserveModule.prototype.createMonthPullDown = function(){
var nowMonth = this.nowObject.getMonth();
var tgtMonth = nowMonth;
var monthValue = "00";
for(j=0; j<=1; j++){
tgtMonth = nowMonth;
monthValue = "00";
for(i=0; i<6; i++){
tgtMonth++;
if(tgtMonth > 12){
tgtMonth = 1;
this.nextYearHolder = this.nowObject.getFullYear()+1; //翌年またぎフラグ
}
monthValue = this.addZeroString(tgtMonth);
if(j == 0){
this.outwardMonth.append($('