fsInfoTour = new Array;
fsInfoSubTour0 = new Array('NGO|Nagoya'
       ,'Bacolod |BCD|ngomnlbcd_tour_result'
       ,'Palawan (El Nido) |MNL|ngomnlpps_elnido_tour_result'
       ,'アモイ (Xiamen) |XMN|ngoxmn_tour_result'
       ,'イロイロ (Iloilo) |ILO|ngomnlilo_tour_result'
       ,'グアム (Guam) |GUM|ngogum_tour_result'
       ,'サンフランシスコ (San Francisco) |SFO|ngosfo_tour_result'
       ,'シドニー (Sydney) |SYD|ngosyd_tour_result'
       ,'シンガポール (Singapore) |SIN|ngosin_tour_result'
       ,'ジャカルタ (Jakarta) |CGK|ngocgk_tour_result'
       ,'セブ (Cebu) |CEB|ngomnlceb_tour_result'
       ,'ダバオ (Davao) |DVO|ngomnldvo_tour_result'
       ,'バンクーバー (Vancouver) |YVR|ngoyvr_tour_result'
       ,'バンコク （Bangkok） |BKK|ngobkk_tour_result'
       ,'パラワン (Palawan) |PPS|ngomnlpps_tour_result'
       ,'パラワン - コロン (Palawan - Coron) |USU|ngomnlpps_coron_tour_result'
       ,'ブラカイ - カリーボ (Boracay - Kalibo) |KLO|ngomnlklo_tour_result'
       ,'ボホール - タグビララン (Bohol - Tagbilaran) |TAG|ngomnltag_tour_result'
       ,'マカオ (Macau) |MFM|ngomfm_tour_result'
       ,'マニラ - バタンガス　ダイビング (Manila - Batangas Diving) |MNL|ngomnl_diving_tour_result'
       ,'マニラ食ツアー (Manila with Food Tour) |MNL|ngomnl_optional_tour_result'
       ,'メルボルン (Melbourne) |MEL|ngomel_tour_result'
       ,'ラスベガス (Las Vegas) |LAS|ngolas_tour_result'
       ,'ラワグ (Laoag) |LAO|ngomnllao_tour_result'
       ,'ロサンジェルス (Los Angeles) |LAX|ngolax_tour_result'
       ,'上海 (Shanghai) |PVG|ngopvg_tour_result'
       ,'北京 (Beijing) |PEK|ngopek_tour_result'
       ,'台北 (Taipei) |TPE|ngotpe_tour_result'
       ,'香港 (Hong Kong) |HKG|ngohkg_tour_result'
); fsInfoTour[0] = fsInfoSubTour0;

fsInfoSubTour1 = new Array('NRT|Tokyo'
       ,'Bacolod |BCD|tyomnlbcd_tour_result'
       ,'Palawan (El Nido) |MNL|tyomnlpps_elnido_tour_result'
       ,'アモイ (Xiamen) |XMN|tyoxmn_tour_result'
       ,'イロイロ (Iloilo) |ILO|tyomnlilo_tour_result'
       ,'グアム (Guam) |GUM|tyogum_tour_result'
       ,'サンフランシスコ (San Francisco) |SFO|tyosfo_tour_result'
       ,'シドニー (Sydney) |SYD|tyosyd_tour_result'
       ,'シンガポール (Singapore) |SIN|tyosin_tour_result'
       ,'ジャカルタ (Jakarta) |CGK|tyocgk_tour_result'
       ,'セブ (Cebu) |CEB|tyomnlceb_tour_result'
       ,'ダバオ (Davao) |DVO|tyomnldvo_tour_result'
       ,'バンクーバー (Vancouver) |YVR|tyoyvr_tour_result'
       ,'バンコク （Bangkok） |BKK|tyobkk_tour_result'
       ,'パラワン (Palawan) |PPS|tyomnlpps_tour_result'
       ,'パラワン - コロン (Palawan - Coron) |USU|tyomnlpps_coron_tour_result'
       ,'ブラカイ - カリーボ (Boracay - Kalibo) |KLO|tyomnlklo_tour_result'
       ,'ボホール - タグビララン (Bohol - Tagbilaran) |TAG|tyomnltag_tour_result'
       ,'マカオ (Macau) |MFM|tyomfm_tour_result'
       ,'マニラ - バタンガス　ダイビング (Manila - Batangas Diving) |MNL|tyomnl_diving_tour_result'
       ,'マニラ食ツアー (Manila with Food Tour) |MNL|tyomnl_optional_tour_result'
       ,'メルボルン (Melbourne) |MEL|tyomel_tour_result'
       ,'ラスベガス (Las Vegas) |LAS|tyolas_tour_result'
       ,'ラワグ (Laoag) |LAO|tyomnllao_tour_result'
       ,'ロサンジェルス (Los Angeles) |LAX|tyolax_tour_result'
       ,'上海 (Shanghai) |PVG|tyopvg_tour_result'
       ,'北京 (Beijing) |PEK|tyopek_tour_result'
       ,'台北 (Taipei) |TPE|tyotpe_tour_result'
       ,'香港 (Hong Kong) |HKG|tyohkg_tour_result'
); fsInfoTour[1] = fsInfoSubTour1;



function doContinueTour(){
	fromObj = document.getElementById("flightFromTour");
	toObj = document.getElementById("flightToTour");

               var fromName = "";
               var toURL = "";

	if(fromObj.selectedIndex!=0 && toObj.selectedIndex!=0){
                     document.getElementById("prevToTour").value = toObj[toObj.options.selectedIndex].value;
                     document.getElementById("prevFromTour").value = fromObj[fromObj.options.selectedIndex].value;
                     toURL = "http://jp.philippineairlines.com" + "/tour_packages/" + toObj[toObj.options.selectedIndex].value.split("|")[2] + ".jsp";
                     location = toURL + "?to=" + toObj[toObj.options.selectedIndex].value.split("|")[1];
	}else{
                      alert("希望するフライトスケジュールを選択できます。");
                }
}

// Generating arrival dropdown list
function generateListTour() {
	fromObj = document.getElementById("flightFromTour");
	toObj = document.getElementById("flightToTour");

	//Resetting arrival dropdown
                toObj.options.selectedIndex=0;
                toObj.length=1;
	//alert("to:"+document.getElementById("prevToTour").value);
	if(fromObj.options.selectedIndex!=0){
                                for(var i=0;i<fsInfoTour.length;i++){
                                               if(fsInfoTour[i][0].split("|")[1].indexOf(fromObj[fromObj.options.selectedIndex].value.split("|")[1])==0){
                                                               //Generating new list
				for(var j=1;j<fsInfoTour[i].length;j++) {
                                                                                var newOption = document.createElement("option");
                                                                                newOption.value = fsInfoTour[i][j];
                                                                                newOption.appendChild(document.createTextNode(fsInfoTour[i][j].split("|")[0]));
					toObj.appendChild(newOption);
                                                                                if(document.getElementById("prevToTour").value != ""){
                                                                                          //alert(document.getElementById("prevToTour").value);
                                                                                          if(newOption.value == document.getElementById("prevToTour").value){
                                                                                                         newOption.selected = true;
                                                                                                         document.getElementById("prevToTour").value = "";
                                                                                          }
                                                                                 }
                                                                }
                                               }
                                }
                }
}

function generateFromTour(){
                fromObj = document.getElementById("flightFromTour");
                fromObj.options.selectedIndex=0;
                fromObj.length=1;
                //alert("from:"+document.getElementById("prevFromTour").value);

                fromTourArray = new Array();
                fromTourArray[0] = fsInfoTour[0][0];
                for(var h=1;h<fsInfoTour.length;h++){
                      fromTourArray[h] = fsInfoTour[h][0];
                      for(g=fromTourArray.length-1; g>=1; g--){
                                if(fromTourArray[g].split("|")[1] < fromTourArray[g-1].split("|")[1]){
                                              var tempString = fromTourArray[g];
                                              fromTourArray[g] = fromTourArray[g-1];
                                              fromTourArray[g-1] = tempString;
                                }
                      }//end sort
                }
                for(var i=0;i<fsInfoTour.length;i++){
                                var newOption = document.createElement("option");
                                newOption.value = fromTourArray[i];
                                newOption.appendChild(document.createTextNode(fromTourArray[i].split("|")[1]));
		fromObj.appendChild(newOption);
                                if(document.getElementById("prevFromTour").value != ""){
                                           //alert(document.getElementById("prevFromTour").value);
                                           if(newOption.value == document.getElementById("prevFromTour").value){
                                                    newOption.selected = true;
                                                    document.getElementById("prevFromTour").value = "";
                                            }
                                 }
                 }
}

function checkEnterTour(e){ //e is event object passed from function invocation
var characterCode;  //literal character code will be stored in this variable

        if(e && e.which){ //if which property of event object is supported (NN4)
                  e = e;
                  characterCode = e.which; //character code is contained in NN4's which property
        }
        else{
                  e = e;
                  characterCode = e.keyCode; //character code is contained in IE's keyCode property
        }

        if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
                  doContinueTour();
        }
}


