function init_int_ticket() {
	
	// 初期化は1度のみ
//	if(typeof int_ticket == "object") return false;
	

	int_ticket = new formControll(document.TABLE);

	int_ticket.init = function() {
		
		/***************************************************************************
		// 各プルダウンの読み込み @resouce from int_db.js
		***************************************************************************/		
		
		this.formView.createPulldown("depApo", intArrApo_list["JP"].slice(1));		// 出発空港
		this.formView.createPulldown("arrArea", intArrArea_list);					// 到着地域	
		this.formView.createPulldown("arrApo", allIntArrApo_list);					// 到着空港
				
		var tempList = day_list.slice(0, getDaylength());
		tempList.unshift({value:"", text:"---"});	
		
		this.formView.createPulldown("wayToMonth", month_list);						// 搭乗日時：往路：月
		this.formView.createPulldown("wayToDay", tempList);							//        ：日	
		
		this.formView.createPulldown("wayBackMonth", month_list);					// 搭乗日時：復路：月
		this.formView.createPulldown("wayBackDay", tempList);						//        ：日
		
		this.formView.createPulldown("adultCount", persons_list.slice(1, 10));		// 人数：大人
		this.formView.createPulldown("childCount", persons_list.slice(0, 9));		//   ：子供
		this.formView.createPulldown("babyCount", persons_list.slice(0, 10));		//   ：幼児	
		
		this.formView.createPulldown("seatKind", intSeat_list);						// クラス				
		
			
		/***************************************************************************
		// 各エレメントの初期値のセット
		***************************************************************************/
	
		// いつもの情報設定
		var _depApo1 = (int_depApo1 == "") ? "TYO" : int_depApo1;
		this.formView.setPulldown("depApo", _depApo1);								// 出発空港
		this.formView.setCodeApo("depApoCode", this.formView.getValue("depApo"));   // 出発空港コード
		
		this.formView.setPulldown("arrArea", "");									// 到着地域
		
		// いつもの情報設定
		var _arrApo1 = (int_arrApo1 == "") ? "" : int_arrApo1;
		this.formView.setPulldown("arrApo", _arrApo1);								// 到着空港
		this.formView.setCodeApo("arrApoCode", this.formView.getValue("arrApo"));   // 到着空港コード


		// いつもの情報設定
	    var date  = new Date();
//		var _embMonth = (embMonth == "") ? date.getMonth()+1: embMonth;
		
//		this.formView.setPulldown("wayToMonth", _embMonth*1);						// 搭乗日時：往路：月
		this.formView.setPulldown("wayToMonth", date.getMonth()+1);					// 搭乗日時：往路：月
		this.formView.setPulldown("wayToDay", "");									//        ：日
		this.resetDay("wayToMonth", {value:"", text:"---"});
		//this.formView.addWeekPulldown("wayToDay");

		this.formView.setPulldown("wayBackMonth", date.getMonth()+1);				// 搭乗日時：復路：月
		this.formView.setPulldown("wayBackDay", "");								//        ：日
		//this.resetDay("wayBackMonth");
		//this.formView.addWeekPulldown("wayBackDay");

		this.formView.setPulldown("adultCount", 1);									// 人数：大人
		this.formView.setPulldown("childCount", 0);									//   ：子供
		this.formView.setPulldown("babyCount", 0);									//   ：幼児	
		
		// いつもの情報設定
		var _int_seatKind = (int_seatKind == "") ? "Y" : int_seatKind;
		this.formView.setPulldown("seatKind", _int_seatKind); 						// クラス	
		
		this.formView.setRadioChecked("searchKind", "N");                       	// 検索種類
		
		/***************************************************************************
		// 各エレメントのイベントのセット
		***************************************************************************/
				
		
		// 空港プルダウン変更 => 空港コードを表示
		this.apoListener = function(eventObj) {
					
			var evt = this.getEventTarget(eventObj);
			if(!evt) evt = eventObj;
			var val = this.formView.getValue(evt);
			if(val == "NOP") val = "";
			
			this.formView.setCodeApo(this.formView.nextElement(evt), val);		
		};
		
		
		// 到着地域プルダウン変更 => 到着空港プルダウン生成 => 空港コードを表示
		this.arrArea = function(evt, val, targetElem) {
			
			if(val == "") {
				
				this.formView.createPulldown(targetElem, allIntArrApo_list);
				this.apoListener(targetElem);
				return false;
			}					
			
			var targetList = intArrApo_list[val].slice(1);
			this.formView.createPulldown(targetElem, targetList);
			//this.apoListener(targetElem);
		};		
		
		
		// 到着空港プルダウン変更 => valueが"IDX"の場合その次を表示
		this.arrApo = function(evt, val, targetElem) {
			
			if(val == "NOP") {
			
				this.formView.setSelectedIndex(evt, 0);
				val = this.formView.getValue(evt);
			}
			
			if(val == "IDX") {
				
				this.formView.setSelectedIndex(evt, this.formView.getSelectedIndex(evt)+1);
			}					
			//this.apoListener(evt);
		};		
		
		
		// 搭乗日時：往路：月プルダウン変更 => 往路：日を1日に設定 => 復路：月日を3日後に設定
		this.wayToMonth = function(evt, val, targetElem) {
					
			this.formView.setPulldown(targetElem, 1);
			this.relationListener(targetElem);// 往路：日プルダウンのイベント呼び出し
		};		
		

		// 搭乗日時：往路：日プルダウン変更 => 復路：月日を3日後に設定
		this.wayToDay = function(evt, val, targetElem) {
					
			var toMonth = this.formView.previousElement(evt);			// 往路：月
			var backMonth = targetElem;									// 復路：月
			this.setMonthDay(toMonth, evt, backMonth, 3, {value:"", text:"---"});
            // 日付プルダウンに曜日付加
    		//this.formView.addWeekPulldown(evt);
    		//this.formView.addWeekPulldown("wayBackDay");
		};		
		
		
		// 搭乗日時：復路：月プルダウン変更 => 復路：日を1日に設定
		this.wayBackMonth = function(evt, val, targetElem) {

			this.formView.setPulldown(targetElem, 1);			
        	this.resetDay(evt, {value:"", text:"---"});
            // 日付プルダウンに曜日付加
    		//this.formView.addWeekPulldown("wayBackDay");
		};		
		
		
		// イベントの追加（一度追加したら追加しない）
		if(int_ticket_addEvent_flg == false){
			// 空港プルダウン変更 => 空港コードを表示
			//this.addEvent("depApo", "change", this.delegate(this, this.apoListener));
			//this.addEvent("arrApo", "change", this.delegate(this, this.apoListener));
			// 到着地域プルダウン変更 => 到着空港プルダウン生成 => 空港コードを表示
			this.addEvent("arrArea", "change", this.delegate(this, this.relationListener));
			// 到着空港プルダウン変更 => valueが"IDX"の場合その次を表示
			this.addEvent("arrApo", "change", this.delegate(this, this.relationListener));		
			// 搭乗日時：往路：月プルダウン変更 => 往路：日を1日に設定 => 復路：月日を3日後に設定
			this.addEvent("wayToMonth", "change", this.delegate(this, this.relationListener));
			// 搭乗日時：往路：日プルダウン変更 => 復路：月日を3日後に設定
			this.addEvent("wayToDay", "change", this.delegate(this, this.relationListener));
			// 搭乗日時：復路：月プルダウン変更 => 復路：日を1日に設定
			this.addEvent("wayBackMonth", "change", this.delegate(this, this.relationListener));		
			// フォーム送信イベント
			//this.addEvent(document.getElementById("BtnIntTkHtTk"), "click", this.delegate(this, this.submitForm));

			int_ticket_addEvent_flg = true;
		}
		
		
		// フォーム送信の前処理
		/*
		this.submitBefore = function() {
			
			with (this.form) {
				wayToMonth.options[wayToMonth.selectedIndex].value     = Number(wayToMonth.value);
				wayToDay.options[wayToDay.selectedIndex].value         = Number(wayToDay.value);
				wayBackMonth.options[wayBackMonth.selectedIndex].value = Number(wayBackMonth.value);
				wayBackDay.options[wayBackDay.selectedIndex].value     = Number(wayBackDay.value);
			}
			
		};
		*/
	}
	
	int_ticket.init();

	//履歴をセット
	int_onloadHistoryCookie();

}

// 二度フラグ
ticSubmited = false;


// フォーム送信
function TicOnSubmit() {
	
    with (document.TABLE) {
        wayToMonth.options[wayToMonth.selectedIndex].value     = Number(wayToMonth.value);
        wayToDay.options[wayToDay.selectedIndex].value         = Number(wayToDay.value);
        wayBackMonth.options[wayBackMonth.selectedIndex].value = Number(wayBackMonth.value);
        wayBackDay.options[wayBackDay.selectedIndex].value     = Number(wayBackDay.value);
    }

		var kind = '';
		if (document.getElementsByName("searchKind")[1].checked == true) {
			kind = "add";
		} else {
			kind = "normal";
		}

		//eco_wari
		/*
		if (document.getElementById("eco_wari") != null) {
			document.getElementById("ageLimitFlg_ticket").value = "";
			if (document.getElementById("intSrchDay").checked == true) {
				if (document.getElementById("normalSearch").checked == true) {
					document.getElementById("ageLimitFlg_ticket").value = "true";
				}
			}
		}
		*/

		onChangeSearch(kind);

    if (ticSubmited) return false;
    ticSubmited = true;
    return true;
}


// 検索のラジオボタン切り替え時の処理（飛び先変更）
function onChangeSearch(kind) {

	//eco_wari
	if (document.getElementById("eco_wari") != null) {
			if (kind == "add") {
				document.getElementById("eco_wari").style.display = 'none';
			} else {
				if (document.getElementById("intSrchCal").checked == true) {
					document.getElementById("eco_wari").style.display = 'none';
				} else {
					document.getElementById("eco_wari").style.display = 'inline';
				}
			}
	}

	if (document.getElementById('js_img104s_r') != null) {
		if (document.getElementsByName("intTicketR")[0].checked == true) {
		//運賃カレンダー対応（20090108）
		if (document.getElementsByName("intSrch")[0].checked == true) {
			if (kind == "normal"){
				document.getElementById("TABLE").action = log_url['int_tic_sub'] + randQueryString;    // 選択日のみ
			} else if (kind == "add"){
				document.getElementById("TABLE").action = log_url['int_tic_sub3'] + randQueryString;   // 追加分
			}
		} else {
				document.getElementById("TABLE").action = log_url['int_tic_sub2_2'] + randQueryString;   // 運賃カレンダー
		}
		} else {
		document.getElementById("TABLE").action = log_url['int_oneway_sub'] + randQueryString;    // one way
		}
	} else {

    if (kind == "normal"){
    	document.getElementById("TABLE").action = log_url['int_tic_sub'] + randQueryString;    // 選択日のみ
    }
    else if (kind == "add"){
    	document.getElementById("TABLE").action = log_url['int_tic_sub3'] + randQueryString;   // 追加分
    }
    else {
    	document.getElementById("TABLE").action = log_url['int_tic_sub2'] + randQueryString;   // 運賃カレンダー
    }

	}
}


//検索メニュー表示非表示切り替え
function onChangeSrchMenu(no) {

	var kind = '';

	if (no == '1') {
		document.getElementById('intTicket').style.display = "block";
		document.getElementById('Srch_rt').style.display = "block";
		document.getElementById('Search1').style.display = "block";
		document.getElementById('Search2').style.display = "none";
		if (document.getElementsByName("searchKind")[1].checked == true) {
			kind = "add";
		} else {
			kind = "normal";
		}
		//eco_wari
		if (document.getElementById("eco_wari") != null) {
			if (kind == "add") {
				document.getElementById("eco_wari").style.display = 'none';
			} else {
				document.getElementById("eco_wari").style.display = 'inline';
			}
		}
	} else {
		document.getElementById('intTicket').style.display = "none";
		document.getElementById('Srch_rt').style.display = "none";
		document.getElementById('Search1').style.display = "none";
		document.getElementById('Search2').style.display = "block";
		//eco_wari
		if (document.getElementById("eco_wari") != null) {
			document.getElementById("eco_wari").style.display = 'none';
		}
	}

	init_NumSeat(no);

	onChangeSearch(kind);

}

function init_NumSeat(no) {

	int_ticket2 = new formControll(document.TABLE);

	int_ticket2.init = function() {

		if (no == '1') {
			this.formView.createPulldown("adultCount", persons_list.slice(1, 10));		// 人数：大人
			this.formView.createPulldown("childCount", persons_list.slice(0, 9));		// 　　：子供
			this.formView.createPulldown("babyCount", persons_list.slice(0, 10));		// 　　：幼児
			this.formView.createPulldown("seatKind", intSeat_list);						// クラス
		} else {
			//20090304 tci 人数表示を変更　後々の為にコメントアウトで対応する
			//this.formView.createPulldown("adultCount", persons_list.slice(1, 5));		// 人数：大人
			//this.formView.createPulldown("childCount", persons_list.slice(0, 2));		// 　　：子供
			//this.formView.createPulldown("babyCount", persons_list.slice(0, 2));		// 　　：幼児
			this.formView.createPulldown("adultCount", persons_list.slice(1, 10));		// 人数：大人
			this.formView.createPulldown("childCount", persons_list.slice(0, 9));		// 　　：子供
			this.formView.createPulldown("babyCount", persons_list.slice(0, 10));		// 　　：幼児
			this.formView.createPulldown("seatKind", intSeat_listS);						// クラス

			var date  = new Date();
			this.formView.setPulldown("calMonth", date.getMonth()+2);

			this.formView.setPulldown("durationOfTrip", "06");
		}

		this.formView.setPulldown("adultCount", 1);									// 人数：大人
		this.formView.setPulldown("childCount", 0);									// 　　：子供
		this.formView.setPulldown("babyCount", 0);									// 　　：幼児	
		// いつもの情報設定
		var _int_seatKind = (int_seatKind == "") ? "Y" : int_seatKind;
		this.formView.setPulldown("seatKind", _int_seatKind); 						// クラス

	}

	int_ticket2.init();
}
