fsInfoTour = new Array;
fsInfoSubTour0 = new Array('BCD|Bacolod'
       ,'Manila |MNL|bcdmnl_optional_day_tour_result'
); fsInfoTour[0] = fsInfoSubTour0;

fsInfoSubTour1 = new Array('BKK|Bangkok'
       ,'Bohol (Tagbilaran) |TAG|bkkmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|bkkmnlklo_tour_result'
       ,'Cebu |CEB|bkkmnlceb_tour_result'
       ,'Davao |DVO|bkkmnldvo_tour_result'
       ,'Manila |MNL|bkkmnl_optional_tour_result'
       ,'Palawan |PPS|bkkmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|bkkmnlpps_elnido_tour_result'
); fsInfoTour[1] = fsInfoSubTour1;

fsInfoSubTour2 = new Array('PEK|Beijing'
       ,'Bohol (Tagbilaran) |TAG|pekmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|pekmnlklo_kalibo_tour_result'
       ,'Cebu |CEB|pekmnlceb_tour_result'
       ,'Diving |CEB|pekmnlceb_diving_tour_result'
       ,'Manila |MNL|pekmnl_optional_tour_result'
       ,'Palawan |PPS|pekmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|pekmnlpps_elnido_tour_result'
); fsInfoTour[2] = fsInfoSubTour2;

fsInfoSubTour3 = new Array('KLO|Boracay (Kalibo)'
       ,'Manila |MNL|klomnl_optional_day_tour_result'
); fsInfoTour[3] = fsInfoSubTour3;

fsInfoSubTour4 = new Array('BXU|Butuan'
       ,'Manila |MNL|bxumnl_optional_day_tour_result'
); fsInfoTour[4] = fsInfoSubTour4;

fsInfoSubTour5 = new Array('CGY|Cagayan de Oro'
       ,'Manila |MNL|cgymnl_optional_day_tour_result'
); fsInfoTour[5] = fsInfoSubTour5;

fsInfoSubTour6 = new Array('CEB|Cebu'
       ,'Manila |MNL|cebmnl_optional_day_tour_result'
); fsInfoTour[6] = fsInfoSubTour6;

fsInfoSubTour7 = new Array('CBO|Cotabato'
       ,'Manila |MNL|cbomnl_optional_day_tour_result'
); fsInfoTour[7] = fsInfoSubTour7;

fsInfoSubTour8 = new Array('DEL|Delhi'
       ,'Boracay (Kalibo) |KLO|delmnlklo_tour_result'
       ,'Cebu |CEB|delmnlceb_tour_result'
       ,'Manila |MNL|delmnl_optional_tour_result'
       ,'Palawan (El Nido) |MNL|delmnlpps_elnido_tour_result'
); fsInfoTour[8] = fsInfoSubTour8;

fsInfoSubTour9 = new Array('DVO|Davao'
       ,'Manila |MNL|dvomnl_optional_day_tour_result'
); fsInfoTour[9] = fsInfoSubTour9;

fsInfoSubTour10 = new Array('DPL|Dipolog'
       ,'Manila |MNL|dplmnl_optional_day_tour_result'
); fsInfoTour[10] = fsInfoSubTour10;

fsInfoSubTour11 = new Array('GES|General Santos'
       ,'Manila |MNL|gesmnl_optional_day_tour_result'
); fsInfoTour[11] = fsInfoSubTour11;

fsInfoSubTour12 = new Array('GUM|Guam'
       ,'Bangkok |BKK|gumbkk_tour_result'
       ,'Boracay (Kalibo) |KLO|gummnlklo_tour_result'
       ,'Cebu |CEB|gummnlceb_tour_result'
       ,'Ho Chi Minh City |SGN|gumsgn_tour_result'
       ,'Hong Kong |HKG|gumhkg_tour_result'
       ,'Manila |MNL|gummnl_optional_tour_result'
       ,'Singapore |SIN|gumsin_tour_result'
); fsInfoTour[12] = fsInfoSubTour12;

fsInfoSubTour13 = new Array('SGN|Ho Chi Minh City (Saigon)'
       ,'Bohol (Tagbilaran) |TAG|hcmmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|hcmmnlklo_tour_result'
       ,'Cebu |CEB|hcmmnlceb_tour_result'
       ,'Manila |MNL|hcmmnl_optional_tour_result'
       ,'Palawan |PPS|hcmmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|hcmmnlpps_elnido_tour_result'
); fsInfoTour[13] = fsInfoSubTour13;

fsInfoSubTour14 = new Array('HKG|Hong Kong'
       ,'Bohol (Tagbilaran) |TAG|hkgmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|hkgmnlklo_tour_result'
       ,'Cebu |CEB|hkgmnlceb_tour_result'
       ,'Davao |DVO|hkgmnldvo_tour_result'
       ,'Guam |GUM|hkggum_tour_result'
       ,'Manila |MNL|hkgmnl_optional_tour_result'
       ,'Palawan |PPS|hkgmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|hkgmnlpps_elnido_tour_result'
); fsInfoTour[14] = fsInfoSubTour14;

fsInfoSubTour15 = new Array('HNL|Honolulu'
       ,'Bangkok |BKK|hnlbkk_tour_result'
       ,'Boracay (Kalibo) |KLO|hnlmnlklo_tour_result'
       ,'Cebu |CEB|hnlmnlceb_tour_result'
       ,'Ho Chi Minh City |SGN|hnlsgn_tour_result'
       ,'Hong Kong |HKG|hnlhkg_tour_result'
       ,'Laoag |LAO|hnlmnllao_tour_result'
       ,'Manila |MNL|hnlmnl_optional_tour_result'
       ,'Palawan |PPS|hnlmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|hnlmnlpps_elnido_tour_result'
       ,'Singapore |SIN|hnlsin_tour_result'
); fsInfoTour[15] = fsInfoSubTour15;

fsInfoSubTour16 = new Array('ILO|Iloilo'
       ,'Manila |MNL|ilomnl_optional_day_tour_result'
); fsInfoTour[16] = fsInfoSubTour16;

fsInfoSubTour17 = new Array('LAS|Las Vegas'
       ,'Bangkok |BKK|lasbkk_tour_result'
       ,'Bohol (Tagbilaran) |TAG|lasmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|lasmnlklo_tour_result'
       ,'Cebu |CEB|lasmnlceb_tour_result'
       ,'Ho Chi Minh City |SGN|lassgn_tour_result'
       ,'Hong Kong |HKG|lashkg_tour_result'
       ,'Manila |MNL|lasmnl_optional_tour_result'
       ,'Palawan |PPS|lasmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|lasmnlpps_elnido_tour_result'
       ,'Singapore |SIN|lassin_tour_result'
); fsInfoTour[17] = fsInfoSubTour17;

fsInfoSubTour18 = new Array('LAX|Los Angeles'
       ,'Bangkok |BKK|laxmnlbkk_tour_result'
       ,'Bohol (Tagbilaran) |TAG|laxmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|laxmnlklo_tour_result'
       ,'Cebu |CEB|laxmnlceb_tour_result'
       ,'Ho Chi Minh City |SGN|laxmnlsgn_tour_result'
       ,'Hong Kong |HKG|laxmnlhkg_tour_result'
       ,'Manila |MNL|laxmnl_optional_tour_result'
       ,'Palawan |PPS|laxmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|laxmnlpps_elnido_tour_result'
       ,'Singapore |SIN|laxmnlsin_tour_result'
); fsInfoTour[18] = fsInfoSubTour18;

fsInfoSubTour19 = new Array('MFM|Macau'
       ,'Bohol (Tagbilaran) |TAG|mfmmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|mfmmnlklo_tour_result'
       ,'Cebu |CEB|mfmmnlceb_tour_result'
       ,'Manila |MNL|mfmmnl_optional_tour_result'
       ,'Palawan |PPS|mfmmnlpps_tour_result'
); fsInfoTour[19] = fsInfoSubTour19;

fsInfoSubTour20 = new Array('MNL|Manila'
       ,'Bacolod |BCD|mnlbcd_tour_result'
       ,'Bangkok |BKK|mnlbkk_tour_result'
       ,'Beijing |PEK|mnlpek_tour_result'
       ,'Bohol (Tagbilaran) |TAG|mnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|mnlklo_tour_result'
       ,'Cagayan De Oro |CGY|mnlcgy_tour_result'
       ,'Cebu |CEB|mnlceb_tour_result'
       ,'Davao |DVO|mnldvo_tour_result'
       ,'Delhi |DEL|mnldel_tour_result'
       ,'Guam |GUM|mnlgum_tour_result'
       ,'Ho Chi Minh City |SGN|mnlsgn_tour_result'
       ,'Hong Kong |HKG|mnlhkg_tour_result'
       ,'Honolulu |HNL|mnlhnl_tour_result'
       ,'Jakarta |CGK|mnlcgk_tour_result'
       ,'Laoag |LAO|mnllao_tour_result'
       ,'Las Vegas |LAS|mnllas_tour_result'
       ,'Los Angeles |LAX|mnllax_tour_result'
       ,'Macau |MFM|mnlmfm_tour_result'
       ,'Puerto Princesa |PPS|mnlpps_tour_result'
       ,'San Francisco |SFO|mnlsfo_tour_result'
       ,'Shanghai |PVG|mnlpvg_tour_result'
       ,'Singapore |SIN|mnlsin_tour_result'
       ,'Taipei |TPE|mnltpe_tour_result'
       ,'Vancouver |YVR|mnlyvr_tour_result'
       ,'Xiamen |XMN|mnlxmn_tour_result'
); fsInfoTour[20] = fsInfoSubTour20;

fsInfoSubTour21 = new Array('SFO|San Francisco'
       ,'Bangkok |BKK|sfobkk_tour_result'
       ,'Bohol (Tagbilaran) |TAG|sfomnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|sfomnlklo_tour_result'
       ,'Cebu |CEB|sfomnlceb_tour_result'
       ,'Ho Chi Minh City |SGN|sfosgn_tour_result'
       ,'Hong Kong |HKG|sfohkg_tour_result'
       ,'Manila |MNL|sfomnl_optional_tour_result'
       ,'Palawan |PPS|sfomnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|sfomnlpps_elnido_tour_result'
       ,'Singapore |SIN|sfosin_tour_result'
); fsInfoTour[21] = fsInfoSubTour21;

fsInfoSubTour22 = new Array('PVG|Shanghai'
       ,'Bohol (Tagbilaran) |TAG|pvgmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|pvgmnlklo_tour_result'
       ,'Cebu |CEB|pvgmnlceb_tour_result'
       ,'Diving |CEB|pvgmnlceb_diving_tour_result'
       ,'Manila |MNL|pvgmnl_optional_tour_result'
       ,'Palawan |PPS|pvgmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|pvgmnlpps_elnido_tour_result'
); fsInfoTour[22] = fsInfoSubTour22;

fsInfoSubTour23 = new Array('SIN|Singapore'
       ,'Boracay (Kalibo) |KLO|sinmnlklo_tour_result'
       ,'Cebu |CEB|sinmnlceb_tour_result'
       ,'Davao |DVO|sinmnldvo_tour_result'
       ,'Manila |MNL|sinmnl_optional_tour_result'
       ,'Palawan |PPS|sinmnlpps_tour_result'
       ,'The Farm at San Benito (Batangas) |MNL|sinmnl_thefarm_tour_result'
); fsInfoTour[23] = fsInfoSubTour23;

fsInfoSubTour24 = new Array('YVR|Vancouver'
       ,'Bohol (Tagbilaran) |TAG|yvrmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|yvrmnlklo_tour_result'
       ,'Cebu |CEB|yvrmnlceb_tour_result'
       ,'Davao |DVO|yvrmnldvo_tour_result'
       ,'Laoag |LAO|yvrmnllao_tour_result'
       ,'Manila |MNL|yvrmnl_optional_tour_result'
       ,'Palawan |PPS|yvrmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|yvrmnlpps_elnido_tour_result'
); fsInfoTour[24] = fsInfoSubTour24;

fsInfoSubTour25 = new Array('XMN|Xiamen'
       ,'Bohol (Tagbilaran) |TAG|xmnmnltag_tour_result'
       ,'Boracay (Kalibo) |KLO|xmnmnlklo_tour_result'
       ,'Cebu |CEB|xmnmnlceb_tour_result'
       ,'Diving |CEB|xmnmnlceb_diving_tour_result'
       ,'Manila |MNL|xmnmnl_optional_tour_result'
       ,'Palawan |PPS|xmnmnlpps_tour_result'
       ,'Palawan (El Nido) |MNL|xmnmnlpps_elnido_tour_result'
); fsInfoTour[25] = fsInfoSubTour25;

fsInfoSubTour26 = new Array('ZAM|Zamboanga'
       ,'Manila |MNL|zammnl_optional_day_tour_result'
); fsInfoTour[26] = fsInfoSubTour26;



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://www.philippineairlines.com" + "/tour_packages/" + toObj[toObj.options.selectedIndex].value.split("|")[2] + ".jsp";
                     location = toURL + "?to=" + toObj[toObj.options.selectedIndex].value.split("|")[1];
	}else{
                      alert("You need to select your desired flight schedule.");
                }
}

// 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();
        }
}


