  // load jquery
  document.write(unescape("%3Cscript src='https://lib.softvoyage.com/jquery/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));


  var codesPrepopulations = Array();
      codesPrepopulations["ACA"] = "1";
    codesPrepopulations["1"] = "1";
    codesPrepopulations["CUN"] = "2_24";
    codesPrepopulations["2"] = "2_24";
    codesPrepopulations["CYO"] = "3";
    codesPrepopulations["3"] = "3";
    codesPrepopulations["CFG"] = "4";
    codesPrepopulations["4"] = "4";
    codesPrepopulations["ZLO"] = "5";
    codesPrepopulations["5"] = "5";
    codesPrepopulations["HOG"] = "6";
    codesPrepopulations["6"] = "6";
    codesPrepopulations["ZIH"] = "7";
    codesPrepopulations["7"] = "7";
    codesPrepopulations["POP"] = "8_12_13";
    codesPrepopulations["8"] = "8_12_13";
    codesPrepopulations["PVR"] = "9_156";
    codesPrepopulations["9"] = "9_156";
    codesPrepopulations["PUJ"] = "10";
    codesPrepopulations["10"] = "10";
    codesPrepopulations["CTG"] = "11";
    codesPrepopulations["11"] = "11";
    codesPrepopulations["POP"] = "8_12_13";
    codesPrepopulations["12"] = "8_12_13";
    codesPrepopulations["POP"] = "8_12_13";
    codesPrepopulations["13"] = "8_12_13";
    codesPrepopulations["SDQ"] = "73_14";
    codesPrepopulations["14"] = "73_14";
    codesPrepopulations["HEX"] = "73_14";
    codesPrepopulations["14"] = "73_14";
    codesPrepopulations["VRA"] = "15";
    codesPrepopulations["15"] = "15";
    codesPrepopulations["16"] = "16";
    codesPrepopulations["CZM"] = "17";
    codesPrepopulations["17"] = "17";
    codesPrepopulations["MBJ"] = "18";
    codesPrepopulations["18"] = "18";
    codesPrepopulations["FAO"] = "19";
    codesPrepopulations["19"] = "19";
    codesPrepopulations["FMY"] = "20";
    codesPrepopulations["20"] = "20";
    codesPrepopulations["RSW"] = "20";
    codesPrepopulations["20"] = "20";
    codesPrepopulations["SJO"] = "21_64";
    codesPrepopulations["21"] = "21_64";
    codesPrepopulations["SYQ"] = "21_64";
    codesPrepopulations["21"] = "21_64";
    codesPrepopulations["TMU"] = "22";
    codesPrepopulations["22"] = "22";
    codesPrepopulations["AGA"] = "23";
    codesPrepopulations["23"] = "23";
    codesPrepopulations["CUN"] = "2_24";
    codesPrepopulations["24"] = "2_24";
    codesPrepopulations["NAS"] = "25";
    codesPrepopulations["25"] = "25";
    codesPrepopulations["PID"] = "25";
    codesPrepopulations["25"] = "25";
    codesPrepopulations["FPO"] = "26";
    codesPrepopulations["26"] = "26";
    codesPrepopulations["ANU"] = "27";
    codesPrepopulations["27"] = "27";
    codesPrepopulations["PTP"] = "28";
    codesPrepopulations["28"] = "28";
    codesPrepopulations["AUA"] = "29";
    codesPrepopulations["29"] = "29";
    codesPrepopulations["BGI"] = "30";
    codesPrepopulations["30"] = "30";
    codesPrepopulations["FLL"] = "31";
    codesPrepopulations["31"] = "31";
    codesPrepopulations["FXE"] = "31";
    codesPrepopulations["31"] = "31";
    codesPrepopulations["MCO"] = "32";
    codesPrepopulations["32"] = "32";
    codesPrepopulations["ORL"] = "32";
    codesPrepopulations["32"] = "32";
    codesPrepopulations["GCM"] = "33";
    codesPrepopulations["33"] = "33";
    codesPrepopulations["GND"] = "34";
    codesPrepopulations["34"] = "34";
    codesPrepopulations["SKB"] = "35";
    codesPrepopulations["35"] = "35";
    codesPrepopulations["SLU"] = "36";
    codesPrepopulations["36"] = "36";
    codesPrepopulations["UVF"] = "36";
    codesPrepopulations["36"] = "36";
    codesPrepopulations["MZO"] = "37";
    codesPrepopulations["37"] = "37";
    codesPrepopulations["FDF"] = "38";
    codesPrepopulations["38"] = "38";
    codesPrepopulations["SXM"] = "39";
    codesPrepopulations["39"] = "39";
    codesPrepopulations["EPS"] = "40";
    codesPrepopulations["40"] = "40";
    codesPrepopulations["PMV"] = "41";
    codesPrepopulations["41"] = "41";
    codesPrepopulations["TAB"] = "42";
    codesPrepopulations["42"] = "42";
    codesPrepopulations["PIE"] = "43";
    codesPrepopulations["43"] = "43";
    codesPrepopulations["SPG"] = "43";
    codesPrepopulations["43"] = "43";
    codesPrepopulations["HUX"] = "44";
    codesPrepopulations["44"] = "44";
    codesPrepopulations["CIA"] = "45";
    codesPrepopulations["45"] = "45";
    codesPrepopulations["FCO"] = "45";
    codesPrepopulations["45"] = "45";
    codesPrepopulations["ROM"] = "45";
    codesPrepopulations["45"] = "45";
    codesPrepopulations["SJU"] = "46";
    codesPrepopulations["46"] = "46";
    codesPrepopulations["HAV"] = "47";
    codesPrepopulations["47"] = "47";
    codesPrepopulations["UPB"] = "47";
    codesPrepopulations["47"] = "47";
    codesPrepopulations["MGA"] = "48";
    codesPrepopulations["48"] = "48";
    codesPrepopulations["PDL"] = "49";
    codesPrepopulations["49"] = "49";
    codesPrepopulations["STT"] = "50";
    codesPrepopulations["50"] = "50";
    codesPrepopulations["SPB"] = "50";
    codesPrepopulations["50"] = "50";
    codesPrepopulations["MIA"] = "51";
    codesPrepopulations["51"] = "51";
    codesPrepopulations["OPF"] = "51";
    codesPrepopulations["51"] = "51";
    codesPrepopulations["TMB"] = "51";
    codesPrepopulations["51"] = "51";
    codesPrepopulations["TNT"] = "51";
    codesPrepopulations["51"] = "51";
    codesPrepopulations["SCU"] = "52";
    codesPrepopulations["52"] = "52";
    codesPrepopulations["CMW"] = "53";
    codesPrepopulations["53"] = "53";
    codesPrepopulations["COF"] = "54";
    codesPrepopulations["54"] = "54";
    codesPrepopulations["ADZ"] = "55";
    codesPrepopulations["55"] = "55";
    codesPrepopulations["56"] = "56";
    codesPrepopulations["BZE"] = "57";
    codesPrepopulations["57"] = "57";
    codesPrepopulations["TZA"] = "57";
    codesPrepopulations["57"] = "57";
    codesPrepopulations["MAD"] = "58";
    codesPrepopulations["58"] = "58";
    codesPrepopulations["TOJ"] = "58";
    codesPrepopulations["58"] = "58";
    codesPrepopulations["PTY"] = "59";
    codesPrepopulations["59"] = "59";
    codesPrepopulations["PAC"] = "59";
    codesPrepopulations["59"] = "59";
    codesPrepopulations["BDA"] = "60";
    codesPrepopulations["60"] = "60";
    codesPrepopulations["NWU"] = "60";
    codesPrepopulations["60"] = "60";
    codesPrepopulations["BVA"] = "61";
    codesPrepopulations["61"] = "61";
    codesPrepopulations["CDG"] = "61";
    codesPrepopulations["61"] = "61";
    codesPrepopulations["LBG"] = "61";
    codesPrepopulations["61"] = "61";
    codesPrepopulations["ORY"] = "61";
    codesPrepopulations["61"] = "61";
    codesPrepopulations["PLS"] = "62";
    codesPrepopulations["62"] = "62";
    codesPrepopulations["LCE"] = "63";
    codesPrepopulations["63"] = "63";
    codesPrepopulations["SJO"] = "21_64";
    codesPrepopulations["64"] = "21_64";
    codesPrepopulations["DAB"] = "65";
    codesPrepopulations["65"] = "65";
    codesPrepopulations["ATH"] = "66";
    codesPrepopulations["66"] = "66";
    codesPrepopulations["HEW"] = "66";
    codesPrepopulations["66"] = "66";
    codesPrepopulations["SPJ"] = "66";
    codesPrepopulations["66"] = "66";
    codesPrepopulations["67"] = "67";
    codesPrepopulations["NCE"] = "68";
    codesPrepopulations["68"] = "68";
    codesPrepopulations["MZT"] = "69";
    codesPrepopulations["69"] = "69";
    codesPrepopulations["LIR"] = "70_64";
    codesPrepopulations["70"] = "70_64";
    codesPrepopulations["LAS"] = "71";
    codesPrepopulations["71"] = "71";
    codesPrepopulations["VGT"] = "71";
    codesPrepopulations["71"] = "71";
    codesPrepopulations["HSH"] = "71";
    codesPrepopulations["71"] = "71";
    codesPrepopulations["BIX"] = "72";
    codesPrepopulations["72"] = "72";
    codesPrepopulations["LRM"] = "73_14";
    codesPrepopulations["73"] = "73_14";
    codesPrepopulations["LGW"] = "74";
    codesPrepopulations["74"] = "74";
    codesPrepopulations["LHR"] = "74";
    codesPrepopulations["74"] = "74";
    codesPrepopulations["STN"] = "74";
    codesPrepopulations["74"] = "74";
    codesPrepopulations["BQH"] = "74";
    codesPrepopulations["74"] = "74";
    codesPrepopulations["ACE"] = "75";
    codesPrepopulations["75"] = "75";
    codesPrepopulations["CUR"] = "76";
    codesPrepopulations["76"] = "76";
    codesPrepopulations["SJD"] = "77";
    codesPrepopulations["77"] = "77";
    codesPrepopulations["KIN"] = "78";
    codesPrepopulations["78"] = "78";
    codesPrepopulations["KTP"] = "78";
    codesPrepopulations["78"] = "78";
    codesPrepopulations["HNL"] = "79";
    codesPrepopulations["79"] = "79";
    codesPrepopulations["KOA"] = "80";
    codesPrepopulations["80"] = "80";
    codesPrepopulations["OGG"] = "81";
    codesPrepopulations["81"] = "81";
    codesPrepopulations["LIH"] = "82";
    codesPrepopulations["82"] = "82";
    codesPrepopulations["RTB"] = "83";
    codesPrepopulations["83"] = "83";
    codesPrepopulations["LAX"] = "84";
    codesPrepopulations["84"] = "84";
    codesPrepopulations["VNY"] = "84";
    codesPrepopulations["84"] = "84";
    codesPrepopulations["WHP"] = "84";
    codesPrepopulations["84"] = "84";
    codesPrepopulations["PSP"] = "85";
    codesPrepopulations["85"] = "85";
    codesPrepopulations["MID"] = "86";
    codesPrepopulations["86"] = "86";
    codesPrepopulations["SNU"] = "87";
    codesPrepopulations["87"] = "87";
    codesPrepopulations["LTO"] = "88";
    codesPrepopulations["88"] = "88";
    codesPrepopulations["SBH"] = "89";
    codesPrepopulations["89"] = "89";
    codesPrepopulations["POS"] = "90";
    codesPrepopulations["90"] = "90";
    codesPrepopulations["RAR"] = "91";
    codesPrepopulations["91"] = "91";
    codesPrepopulations["CCC"] = "92";
    codesPrepopulations["92"] = "92";
    codesPrepopulations["LIS"] = "93";
    codesPrepopulations["93"] = "93";
    codesPrepopulations["ZYD"] = "93";
    codesPrepopulations["93"] = "93";
    codesPrepopulations["PAP"] = "94";
    codesPrepopulations["94"] = "94";
    codesPrepopulations["SAL"] = "95";
    codesPrepopulations["95"] = "95";
    codesPrepopulations["SRQ"] = "96";
    codesPrepopulations["96"] = "96";
    codesPrepopulations["LNA"] = "97";
    codesPrepopulations["97"] = "97";
    codesPrepopulations["PBI"] = "97";
    codesPrepopulations["97"] = "97";
    codesPrepopulations["TAM"] = "98";
    codesPrepopulations["98"] = "98";
    codesPrepopulations["GEO"] = "99";
    codesPrepopulations["99"] = "99";
    codesPrepopulations["AMS"] = "100";
    codesPrepopulations["100"] = "100";
    codesPrepopulations["BFS"] = "101";
    codesPrepopulations["101"] = "101";
    codesPrepopulations["BHD"] = "101";
    codesPrepopulations["101"] = "101";
    codesPrepopulations["BHX"] = "102";
    codesPrepopulations["102"] = "102";
    codesPrepopulations["BRU"] = "103";
    codesPrepopulations["103"] = "103";
    codesPrepopulations["CRL"] = "103";
    codesPrepopulations["103"] = "103";
    codesPrepopulations["ZYR"] = "103";
    codesPrepopulations["103"] = "103";
    codesPrepopulations["DUB"] = "104";
    codesPrepopulations["104"] = "104";
    codesPrepopulations["EDI"] = "105";
    codesPrepopulations["105"] = "105";
    codesPrepopulations["FRA"] = "106";
    codesPrepopulations["106"] = "106";
    codesPrepopulations["HHN"] = "106";
    codesPrepopulations["106"] = "106";
    codesPrepopulations["QGV"] = "106";
    codesPrepopulations["106"] = "106";
    codesPrepopulations["GLA"] = "107";
    codesPrepopulations["107"] = "107";
    codesPrepopulations["LYN"] = "108";
    codesPrepopulations["108"] = "108";
    codesPrepopulations["LYS"] = "108";
    codesPrepopulations["108"] = "108";
    codesPrepopulations["MAN"] = "109";
    codesPrepopulations["109"] = "109";
    codesPrepopulations["MRS"] = "110";
    codesPrepopulations["110"] = "110";
    codesPrepopulations["AGB"] = "111";
    codesPrepopulations["111"] = "111";
    codesPrepopulations["MUC"] = "111";
    codesPrepopulations["111"] = "111";
    codesPrepopulations["BSL"] = "112";
    codesPrepopulations["112"] = "112";
    codesPrepopulations["NTE"] = "113";
    codesPrepopulations["113"] = "113";
    codesPrepopulations["TLS"] = "114";
    codesPrepopulations["114"] = "114";
    codesPrepopulations["XYT"] = "114";
    codesPrepopulations["114"] = "114";
    codesPrepopulations["CXH"] = "115";
    codesPrepopulations["115"] = "115";
    codesPrepopulations["YVR"] = "115";
    codesPrepopulations["115"] = "115";
    codesPrepopulations["YYC"] = "116";
    codesPrepopulations["116"] = "116";
    codesPrepopulations["BOD"] = "117";
    codesPrepopulations["117"] = "117";
    codesPrepopulations["VCE"] = "118";
    codesPrepopulations["118"] = "118";
    codesPrepopulations["LIN"] = "119";
    codesPrepopulations["119"] = "119";
    codesPrepopulations["MXP"] = "119";
    codesPrepopulations["119"] = "119";
    codesPrepopulations["SWK"] = "119";
    codesPrepopulations["119"] = "119";
    codesPrepopulations["APF"] = "120";
    codesPrepopulations["120"] = "120";
    codesPrepopulations["CMR"] = "121";
    codesPrepopulations["121"] = "121";
    codesPrepopulations["HAM"] = "122";
    codesPrepopulations["122"] = "122";
    codesPrepopulations["KIR"] = "123";
    codesPrepopulations["123"] = "123";
    codesPrepopulations["MLH"] = "124";
    codesPrepopulations["124"] = "124";
    codesPrepopulations["PRG"] = "125";
    codesPrepopulations["125"] = "125";
    codesPrepopulations["QXB"] = "126";
    codesPrepopulations["126"] = "126";
    codesPrepopulations["CCF"] = "127";
    codesPrepopulations["127"] = "127";
    codesPrepopulations["SXB"] = "128";
    codesPrepopulations["128"] = "128";
    codesPrepopulations["AGP"] = "129";
    codesPrepopulations["129"] = "129";
    codesPrepopulations["EAS"] = "130";
    codesPrepopulations["130"] = "130";
    codesPrepopulations["BCN"] = "131";
    codesPrepopulations["131"] = "131";
    codesPrepopulations["BIO"] = "132";
    codesPrepopulations["132"] = "132";
    codesPrepopulations["GRX"] = "133";
    codesPrepopulations["133"] = "133";
    codesPrepopulations["SVQ"] = "134";
    codesPrepopulations["134"] = "134";
    codesPrepopulations["VLC"] = "135";
    codesPrepopulations["135"] = "135";
    codesPrepopulations["ODB"] = "136";
    codesPrepopulations["136"] = "136";
    codesPrepopulations["CDZ"] = "137";
    codesPrepopulations["137"] = "137";
    codesPrepopulations["SCQ"] = "138";
    codesPrepopulations["138"] = "138";
    codesPrepopulations["CEQ"] = "139";
    codesPrepopulations["139"] = "139";
    codesPrepopulations["YED"] = "140";
    codesPrepopulations["140"] = "140";
    codesPrepopulations["YEG"] = "140";
    codesPrepopulations["140"] = "140";
    codesPrepopulations["YXD"] = "140";
    codesPrepopulations["140"] = "140";
    codesPrepopulations["FLR"] = "141";
    codesPrepopulations["141"] = "141";
    codesPrepopulations["SAY"] = "142";
    codesPrepopulations["142"] = "142";
    codesPrepopulations["RRO"] = "143";
    codesPrepopulations["143"] = "143";
    codesPrepopulations["PMO"] = "144";
    codesPrepopulations["144"] = "144";
    codesPrepopulations["ISH"] = "145";
    codesPrepopulations["145"] = "145";
    codesPrepopulations["PRJ"] = "146";
    codesPrepopulations["146"] = "146";
    codesPrepopulations["CLW"] = "147";
    codesPrepopulations["147"] = "147";
    codesPrepopulations["ISM"] = "148";
    codesPrepopulations["148"] = "148";
    codesPrepopulations["JTR"] = "149";
    codesPrepopulations["149"] = "149";
    codesPrepopulations["VIE"] = "150";
    codesPrepopulations["150"] = "150";
    codesPrepopulations["VDD"] = "150";
    codesPrepopulations["150"] = "150";
    codesPrepopulations["KYL"] = "151";
    codesPrepopulations["151"] = "151";
    codesPrepopulations["UTL"] = "152";
    codesPrepopulations["152"] = "152";
    codesPrepopulations["KEF"] = "153";
    codesPrepopulations["153"] = "153";
    codesPrepopulations["RKV"] = "153";
    codesPrepopulations["153"] = "153";
    codesPrepopulations["MYF"] = "154";
    codesPrepopulations["154"] = "154";
    codesPrepopulations["SAN"] = "154";
    codesPrepopulations["154"] = "154";
    codesPrepopulations["SDM"] = "154";
    codesPrepopulations["154"] = "154";
    codesPrepopulations["NKX"] = "154";
    codesPrepopulations["154"] = "154";
    codesPrepopulations["SEE"] = "154";
    codesPrepopulations["154"] = "154";
    codesPrepopulations["SXF"] = "155";
    codesPrepopulations["155"] = "155";
    codesPrepopulations["THF"] = "155";
    codesPrepopulations["155"] = "155";
    codesPrepopulations["TXL"] = "155";
    codesPrepopulations["155"] = "155";
    codesPrepopulations["GWW"] = "155";
    codesPrepopulations["155"] = "155";
    codesPrepopulations["PVR"] = "9_156";
    codesPrepopulations["156"] = "9_156";
    codesPrepopulations["LUX"] = "157";
    codesPrepopulations["157"] = "157";
    codesPrepopulations["LIL"] = "158";
    codesPrepopulations["158"] = "158";
    codesPrepopulations["INN"] = "159";
    codesPrepopulations["159"] = "159";
    codesPrepopulations["SZG"] = "160";
    codesPrepopulations["160"] = "160";
    codesPrepopulations["JMK"] = "161";
    codesPrepopulations["161"] = "161";
    codesPrepopulations["YHZ"] = "162";
    codesPrepopulations["162"] = "162";
    codesPrepopulations["YAW"] = "162";
    codesPrepopulations["162"] = "162";
    codesPrepopulations["YUL"] = "163";
    codesPrepopulations["163"] = "163";
    codesPrepopulations["YKZ"] = "164";
    codesPrepopulations["164"] = "164";
    codesPrepopulations["YTZ"] = "164";
    codesPrepopulations["164"] = "164";
    codesPrepopulations["YYZ"] = "164";
    codesPrepopulations["164"] = "164";
    codesPrepopulations["YDF"] = "165";
    codesPrepopulations["165"] = "165";
    codesPrepopulations["YQX"] = "166";
    codesPrepopulations["166"] = "166";
    codesPrepopulations["YQY"] = "167";
    codesPrepopulations["167"] = "167";
    codesPrepopulations["YYG"] = "168";
    codesPrepopulations["168"] = "168";
    codesPrepopulations["YYT"] = "169";
    codesPrepopulations["169"] = "169";
    codesPrepopulations["YYJ"] = "170";
    codesPrepopulations["170"] = "170";
    codesPrepopulations["ZRH"] = "171";
    codesPrepopulations["171"] = "171";
    codesPrepopulations["GVA"] = "172";
    codesPrepopulations["172"] = "172";
    codesPrepopulations["OPO"] = "173";
    codesPrepopulations["173"] = "173";
    codesPrepopulations["AXA"] = "174";
    codesPrepopulations["174"] = "174";
    codesPrepopulations["YLW"] = "175";
    codesPrepopulations["175"] = "175";
    codesPrepopulations["YQQ"] = "176";
    codesPrepopulations["176"] = "176";
    codesPrepopulations["YWG"] = "177";
    codesPrepopulations["177"] = "177";
    codesPrepopulations["YXE"] = "178";
    codesPrepopulations["178"] = "178";
    codesPrepopulations["PHX"] = "179";
    codesPrepopulations["179"] = "179";
    codesPrepopulations["DVT"] = "179";
    codesPrepopulations["179"] = "179";
    codesPrepopulations["180"] = "180";
    codesPrepopulations["ACY"] = "181";
    codesPrepopulations["181"] = "181";
    codesPrepopulations["AIY"] = "181";
    codesPrepopulations["181"] = "181";
    codesPrepopulations["ZSA"] = "182";
    codesPrepopulations["182"] = "182";
    codesPrepopulations["YHM"] = "183";
    codesPrepopulations["183"] = "183";
    codesPrepopulations["YKA"] = "184";
    codesPrepopulations["184"] = "184";
    codesPrepopulations["YOW"] = "185";
    codesPrepopulations["185"] = "185";
    codesPrepopulations["YQB"] = "186";
    codesPrepopulations["186"] = "186";
    codesPrepopulations["RAK"] = "187";
    codesPrepopulations["187"] = "187";
    codesPrepopulations["GGT"] = "188";
    codesPrepopulations["188"] = "188";
    codesPrepopulations["BOS"] = "189";
    codesPrepopulations["189"] = "189";
    codesPrepopulations["CGX"] = "190";
    codesPrepopulations["190"] = "190";
    codesPrepopulations["MDW"] = "190";
    codesPrepopulations["190"] = "190";
    codesPrepopulations["ORD"] = "190";
    codesPrepopulations["190"] = "190";
    codesPrepopulations["PWK"] = "190";
    codesPrepopulations["190"] = "190";
    codesPrepopulations["DPA"] = "190";
    codesPrepopulations["190"] = "190";
    codesPrepopulations["SFO"] = "191";
    codesPrepopulations["191"] = "191";
    codesPrepopulations["EMB"] = "191";
    codesPrepopulations["191"] = "191";
    codesPrepopulations["EWR"] = "192";
    codesPrepopulations["192"] = "192";
    codesPrepopulations["JFK"] = "192";
    codesPrepopulations["192"] = "192";
    codesPrepopulations["LGA"] = "192";
    codesPrepopulations["192"] = "192";
    codesPrepopulations["WTC"] = "192";
    codesPrepopulations["192"] = "192";
    codesPrepopulations["TUN"] = "193";
    codesPrepopulations["193"] = "193";



  var Gateways = Array();
  function RetreiveGateways(FormEnCours,gateway,dest,hotel,duration)
  {
    // Gateways = Array("Toronto--xx--YYZ","Montreal--xx--YUL");    
    jQuery.getJSON(
      "/cgi-bin/ajax.cgi?action=getPackagesGateways&code_ag=TCY&alias=YUL&tour_to_display=&language=fr",
      function(data){
        Gateways = data[0].gateways;
        InitDropsSuite(FormEnCours,gateway,dest,hotel,duration);
      }
    );
  }

  function InitDrops(FormEnCours,gateway,dest,hotel,duration)
  {

    jQuery.noConflict();

    // Validations
    if (dest != null && dest.indexOf('xxx') > -1) { dest = dest.split('xxx')[1]; }
    if (duration != null && duration.indexOf(':') > -1) { duration = duration.split(':')[1]; }
    if (Gateways.length == 0) { RetreiveGateways(FormEnCours,gateway,dest,hotel,duration); }
    else { InitDropsSuite(FormEnCours,gateway,dest,hotel,duration); }
  }
  
  function InitDropsSuite(FormEnCours,gateway,dest,hotel,duration)  
  {
    var indice = 0;
    FormEnCours.gateway_dep.length = 0;
    for (var compteur = 0; compteur < Gateways.length; compteur++)
    {
      indice = compteur;
      var GatewaysArray = Gateways[compteur].split('--xx--');
      
      FormEnCours.gateway_dep.options[indice] = new Option(GatewaysArray[0]);
      FormEnCours.gateway_dep.options[indice].value = GatewaysArray[1];
      if (gateway != "" && GatewaysArray[1] == gateway) { FormEnCours.gateway_dep.options[indice].selected = true; }
    }

    if (FormEnCours.dest_dep != null && FormEnCours.dest_dep.type && FormEnCours.dest_dep.value != "ALL")
    {
      // c'est pas un last minute
      refreshDest(FormEnCours,dest,hotel,duration);
    }
  }


  
  var Durations = Object();
  var Destinations = Array();
  function RetreiveDestinations(FormEnCours,GateEnCours,dest,hotel,duration)
  {
    // Destinations[GateEnCours] = Array("All Destinations--xx--AllqqqDestinationsxxx1,2,24--xx--3,4,5,6,7,8,13,14,15","","All Mexico--xx--AllqqqMexicoxxx1,2,24--xx--7,14","- Acapulco--xx--1--xx--7,14","- Cancun--xx--Cancunxxx2,24--xx--7,14");
    jQuery.getJSON(
      "/cgi-bin/ajax.cgi?action=getPackagesDestinations&gateway_dep="+GateEnCours+"&code_ag=TCY&alias=YUL&tour_to_display=&language=fr",
      function(data){
        Destinations[GateEnCours] = data[0].destinations;
        refreshDestSuite(FormEnCours,GateEnCours,dest,hotel,duration);
      }
    );
  }


  function refreshDest(FormEnCours,dest,hotel,duration)
  {
    var GateEnCours;
    GateEnCours = FormEnCours.gateway_dep.options[FormEnCours.gateway_dep.selectedIndex].value;
    if (GateEnCours == "") {  FormEnCours.dest_dep.length = 0  }
    else if (FormEnCours.dest_dep != null && FormEnCours.dest_dep.type && FormEnCours.dest_dep.value != "ALL")
    {
      if (Destinations[GateEnCours] == null || Destinations[GateEnCours].length == 0) { RetreiveDestinations(FormEnCours,GateEnCours,dest,hotel,duration); }
      else { refreshDestSuite(FormEnCours,GateEnCours,dest,hotel,duration); }
    }
  }

  function refreshDestSuite(FormEnCours,GateEnCours,dest,hotel,duration)
  {
    var indice = 0;
    FormEnCours.dest_dep.length = 0;
    for (var compteur = 0; compteur < Destinations[GateEnCours].length; compteur++)
    {
      indice = compteur;
      var DestinationsArray = Destinations[GateEnCours][compteur].split('--xx--');
      FormEnCours.dest_dep.options[indice] = new Option(DestinationsArray[0]);
      FormEnCours.dest_dep.options[indice].value = DestinationsArray[1];
      
      // Prepopulation
      if (dest != "")
      {
        if (DestinationsArray[1].indexOf('xxx') > -1) {
          DestinationsArray[1] = DestinationsArray[1].split('xxx')[1];
        }
        if (DestinationsArray[1] == dest || DestinationsArray[1] == codesPrepopulations[dest]) { FormEnCours.dest_dep.options[indice].selected=true; }
      }


      // Consever le duration pour plus tard
      if (Durations[GateEnCours] == null || Durations[GateEnCours].length == 0) { Durations[GateEnCours] = Object(); }
 
      var DestEnCours = DestinationsArray[1];     
      if (DestEnCours.indexOf('xx') > -1)
      {
        var DestEnCoursTemp = DestEnCours.split('xxx');
        DestEnCours = DestEnCoursTemp[1];
      }

      Durations[GateEnCours][DestEnCours] = DestinationsArray[2];
    }
    refreshHotel(FormEnCours,hotel,duration);
  }


  Hotels = Array();
  function RetreiveHotels(FormEnCours,GateEnCours,DestEnCours,hotel,duration)
  {
    // Hotels[GateEnCours][DestEnCours] = Array("All Hotels--xx--","All Melia--xx--1234,5678","","MELIA C. SANTA MARIA--xx--1234","MELIA LAS DUNAS--xx--5678");

    if (Hotels[GateEnCours] == null || Hotels[GateEnCours].length == 0) { Hotels[GateEnCours] = Array(); }

    jQuery.getJSON(
      "/cgi-bin/ajax.cgi?action=getPackagesHotels&gateway_dep="+GateEnCours+"&dest_dep="+DestEnCours+"&code_ag=TCY&alias=YUL&tour_to_display=&language=fr",
      function(data){
        Hotels[GateEnCours][DestEnCours] = data[0].hotels;
        refreshHotelSuite(FormEnCours,GateEnCours,DestEnCours,hotel,duration);
      }
    );
  }

  function refreshHotel(FormEnCours,hotel,duration)
  {
    var GateEnCours;
    GateEnCours = FormEnCours.gateway_dep.options[FormEnCours.gateway_dep.selectedIndex].value;

    var DestEnCours;
    DestEnCours = FormEnCours.dest_dep.options[FormEnCours.dest_dep.selectedIndex].value;
    var DestToKeep = DestEnCours;
    if (DestEnCours.indexOf('xx') > -1)
    {
      var DestEnCoursTemp = DestEnCours.split('xxx');
      DestEnCours = DestEnCoursTemp[1];
    }

    if(FormEnCours.no_hotel != null && FormEnCours.no_hotel.type)
    {
      FormEnCours.no_hotel.length = 1; 
      refreshStars(FormEnCours, '');

      if (Hotels[GateEnCours] == null || Hotels[GateEnCours].length == 0 || Hotels[GateEnCours][DestEnCours] == null || Hotels[GateEnCours][DestEnCours].length == 0) { RetreiveHotels(FormEnCours,GateEnCours,DestEnCours,hotel,duration); }
      else { refreshHotelSuite(FormEnCours,GateEnCours,DestEnCours,hotel,duration); }
    }
    else
    {
      refreshDuration(FormEnCours,GateEnCours,DestEnCours,hotel,duration);
    }
  }
  
  function refreshHotelSuite(FormEnCours,GateEnCours,DestEnCours,hotel,duration)
  {
    var indice = 1;
    FormEnCours.no_hotel.length = indice;
    for (var compteur = 0; compteur < Hotels[GateEnCours][DestEnCours].length; compteur++)
    {
      var HotelsArray = Hotels[GateEnCours][DestEnCours][compteur].split('--xx--');
    
      FormEnCours.no_hotel.options[indice] = new Option(HotelsArray[0]);
      FormEnCours.no_hotel.options[indice].value = HotelsArray[1];

      // Prepopulation
      if (hotel != "" && HotelsArray[1] == hotel) { FormEnCours.no_hotel.options[indice].selected=true; }

      indice++;
    }
    
    refreshDuration(FormEnCours,GateEnCours,DestEnCours,hotel,duration);
  }

  function refreshDuration(FormEnCours,GateEnCours,DestEnCours,hotel,duration)  
  {
    // Refresh durations
    var FlagMoinsDe5Jours = "";
    var Flag5a10jours = "";
    var Flag11a16jours = "";
    var FlagPlusDe16Jours = "";

    var DurationEnCours;
    if (FormEnCours.duration.selectedIndex > -1) { DurationEnCours = FormEnCours.duration.options[FormEnCours.duration.selectedIndex].value; }
    if (DurationEnCours == "") { DurationEnCours = 7; }

    var ListeDurations = Array();
    if (Durations[GateEnCours] == null || Durations[GateEnCours].length == 0 || Durations[GateEnCours][DestEnCours] == null || Durations[GateEnCours][DestEnCours].length == 0) { ListeDurations = Array(3,7,14) }
    else { ListeDurations = Durations[GateEnCours][DestEnCours].split(',') }

    for (var compteur = 0; compteur < ListeDurations.length; compteur++)
    {
      if (ListeDurations[compteur] >= 0 && ListeDurations[compteur] <= 4) { FlagMoinsDe5Jours = "Y"; }
      else if (ListeDurations[compteur] >= 5 && ListeDurations[compteur] <= 10) { Flag5a10jours = "Y"; }
      else if (ListeDurations[compteur] >= 11 && ListeDurations[compteur] <= 16) { Flag11a16jours = "Y"; }
      else if (ListeDurations[compteur] >= 17) { FlagPlusDe16Jours = "Y"; }
    }


    FormEnCours.duration.length = 0;
    indice = 0;
    if (FlagMoinsDe5Jours != "")
    {
      FormEnCours.duration.options[indice] = new Option( "3 ou 4 jours" );
      FormEnCours.duration.options[indice].value = 4;
      indice++;
    }
    if (Flag5a10jours != "")
    {
      FormEnCours.duration.options[indice] = new Option( "5 à 10 jours" );
      FormEnCours.duration.options[indice].value = 7;
      indice++;
    }
    if (Flag11a16jours != "")
    {
      FormEnCours.duration.options[indice] = new Option( "11 à 16 jours" );
      FormEnCours.duration.options[indice].value = 14;
      indice++;
    }
    if (FlagPlusDe16Jours != "")
    {
      FormEnCours.duration.options[indice] = new Option( "17 jours ou plus" );
      FormEnCours.duration.options[indice].value = 21;
      indice++;
    }

    // Ajouter les durations specifiques
    if (ListeDurations.length > 0) 
    {
      // ajouter un espace
      FormEnCours.duration.options[indice] = new Option( "" );
      FormEnCours.duration.options[indice].value = '';
      indice++;
    }
    for (var compteur = 0; compteur < ListeDurations.length; compteur++)
    {
      FormEnCours.duration.options[indice] = new Option( ListeDurations[compteur] + " jours seulement" );
      FormEnCours.duration.options[indice].value = ListeDurations[compteur]+'DAYS';
      indice++;
    }


    compteur1 = "";
    compteur = ""; 
    indice = "";
    
    //Prepopulation
    if (!FormEnCours.duration.options[0])
    {
      FormEnCours.duration.options[0] = new Option( "5 à 10 jours" );
      FormEnCours.duration.options[0].value = 7;
      FormEnCours.duration.options[1] = new Option( "3 ou 4 jours" );
      FormEnCours.duration.options[1].value = 4;
      FormEnCours.duration.options[2] = new Option( "11 à 16 jours" );
      FormEnCours.duration.options[2].value = 14;
    }
    if (duration == null || duration == "") { duration = 7; }
    for (var i = 0; i < FormEnCours.duration.options.length; i++)
    {
      if (FormEnCours.duration.options[i].value == duration) { FormEnCours.duration.options[i].selected=true; }
    }

  }


  function refreshStars(FormEnCours, HotelEnCours)
  {
    if(FormEnCours.no_hotel != null && FormEnCours.no_hotel.type)
    {
      if (HotelEnCours == "0" || HotelEnCours == "" || !HotelEnCours)  { HotelEnCours = FormEnCours.no_hotel.value; }
    }
    else
    {
      HotelEnCours = "";
    }

    if (HotelEnCours == "") 
    {
      if(FormEnCours.star != null && FormEnCours.star.type)
      {
        FormEnCours.star.length = 1;
        FormEnCours.star.options[1] = new Option( "2 étoiles ou mieux" );	FormEnCours.star.options[1].value = "2";
        FormEnCours.star.options[2] = new Option( "3 étoiles ou mieux" );	FormEnCours.star.options[2].value = "3";
        FormEnCours.star.options[3] = new Option( "4 étoiles ou mieux" );	FormEnCours.star.options[3].value = "4";
        FormEnCours.star.options[4] = new Option( "5 étoiles ou mieux" );	FormEnCours.star.options[4].value = "5";
      }

      if(FormEnCours.price_max != null && FormEnCours.price_max.type)
      {
        // c'est un drop down
        FormEnCours.price_max.length = 1;
        FormEnCours.price_max.options[1] = new Option( "À moins de 1000$" );	FormEnCours.price_max.options[1].value = "1000";
        FormEnCours.price_max.options[2] = new Option( "À moins de 1500$" );	FormEnCours.price_max.options[2].value = "1500";
        FormEnCours.price_max.options[3] = new Option( "À moins de 2000$" );	FormEnCours.price_max.options[3].value = "2000";
      }

    }
    else
    {
      if(FormEnCours.star != null && FormEnCours.star.type) { FormEnCours.star.length = 1; }
      if(FormEnCours.price_max != null && FormEnCours.price_max.type) { FormEnCours.price_max.length = 1; }
    }
  }

