// (c) TURY.ru module script var trr_ar_citydep = new Array(); var trr_citydep_ix = new Array(); var trr_ar_accmd = new Array(); var trr_ar_city = new Array(); var trr_ar_subcity = new Array(); var trr_ar_citys = new Array(); var trr_ar_citym = new Array(); var trr_ar_cityd = new Array(); var trr_ar_cityds = new Array(); var trr_ar_citydp = new Array(); var trr_ar_dep = new Array(); var trr_ar_days = new Array(); var trr_ar_meal = new Array(); var trr_ar_star = new Array(); var trr_ar_hotel = new Array(); var trr_tours = new String(); var sCurCityDep = new String(); var sCityHead = "- Все курорты -"; var bCityDepListLoaded = 0; if (!trr_TourType) { var trr_TourType = ""; } function trrLoadComplete() { document.getElementById("trr_idata"); alert(trr_idata.window.document); } function trr_DepCity() { var dc = document.getElementById("trr_depcity"); if (!dc) { return ""; } else { return dc.options[dc.selectedIndex].value; } } function trr_LoadCitydepList() { var cmb = document.getElementById("trr_depcity"); if (!cmb) { return ""; } else { cmb.options.length = trr_ar_citydep.length+1; cmb.selectedIndex = 0; for (i=0; i 0) { var sAccmd = cmbQ.options[cmbQ.selectedIndex].value; var aAccmd = sAccmd.split("+"); if (aAccmd.length == 1) { var iMans = aAccmd[0]; var iChilds = 0; } else { var iMans = aAccmd[0]; var iChilds = aAccmd[1]; } if (iChilds == 0) { cmbQ.style.width = 150; dvAge.style.display = "none"; } else { cmbQ.style.width = 150-iChilds*20-20; for (i=0; i"; } dvAge.innerHTML = sOut+"лет"; dvAge.style.display = "block"; } } else { cmbQ.style.width = 150; dvAge.style.display = "none"; } } function trr_FilterCity() { var cmb = document.getElementById("trr_city[]"); if (!cmb) { return ""; } else { cmb.options.length = trr_ar_city.length+1; cmb.options[0] = new Option(sCityHead, ""); cmb.selectedIndex = 0; for (i=0; i", ""); cmb.selectedIndex = 0; if (selCity.length > 0) { for (i=0; i -1) { cmb.options.length++; l = cmb.options.length-1; cmb.options[l] = new Option(ar[1], ar[1]); } } } } } function trr_FilterStar() { var cmb = document.getElementById("trr_star[]"); if (!cmb) { return ""; } else { var ar_star = new Array(); if (document.getElementById("trr_city[]").selectedIndex == 0) { /* all stars */ ar_star = trr_ar_star; } else { /* by city */ var sCity = trr_SelectedVals("trr_city[]"); var sStar = new String(";"); for (i=0; i -1 && ar[0].length > 0 && sStar.indexOf(";"+ar[1]+";") == -1) { sStar = sStar+ar[1]+";"; } } ar_star = sStar.split(";"); } ar_star.sort(); cmb.options.length = 1; cmb.options[0] = new Option("- Все категории -", ""); cmb.selectedIndex = 0; for (i=0; i 0) { cmb.options.length++; l = cmb.options.length-1; cmb.options[l] = new Option(ar_star[i], ar_star[i]); } } } } function trr_FilterHotel() { var ar_hotels = new Array(); var sHotels = new String(";"); var cmb = document.getElementById("trr_hotel[]"); if (!cmb) { return ""; } else { if (document.getElementById("trr_city[]").selectedIndex == 0 && document.getElementById("trr_star[]").selectedIndex == 0) { /* all hotels */ for (i=0; i -1 || selCity.length == 0) && (selStar.indexOf("("+ar[2]+")") > -1 || selStar.length == 0) ) { sHotels = sHotels+ar[1]+":"+ar[2]+";"; } } } /* loading list */ ar_hotels = sHotels.split(";"); ar_hotels.sort(); cmb.options.length = 1; cmb.options[0] = new Option("- Все отели -", ""); for (i=2; i 1) { cmb.options.length++; l = cmb.options.length-1; cmb.options[l] = new Option(ar[0]+" "+ar[1]+"*", ar[0]); } } cmb.selectedIndex = 0; } } function trr_FilterMeal() { var cmb = document.getElementById("trr_meal[]"); if (!cmb) { return ""; } else { var ar_meal = new Array(); if (document.getElementById("trr_city[]").selectedIndex == 0 && document.getElementById("trr_hotel[]").selectedIndex == 0) { /* all meals */ ar_meal = trr_ar_meal; } if (document.getElementById("trr_hotel[]").selectedIndex > 0) { /* by hotel */ var selHotels = trr_SelectedVals("trr_hotel[]"); var sMeal = new String(";"); for (i=0; i -1) { ar2 = ar[3].split(";"); for (m=0; m 0 && document.getElementById("trr_hotel[]").selectedIndex == 0) { /* by city */ var sCity = trr_SelectedVals("trr_city[]"); var sMeal = new String(";"); for (i=0; i -1 && ar[0].length > 0 && sMeal.indexOf(";"+ar[1]+";") == -1) { sMeal = sMeal+ar[1]+";"; } } ar_meal = sMeal.split(";"); } ar_meal.sort(); cmb.options.length = 1; cmb.options[0] = new Option("- Питание любое -", ""); cmb.selectedIndex = 0; for (i=0; i 0) { cmb.options.length++; l = cmb.options.length-1; cmb.options[l] = new Option(ar_meal[i], ar_meal[i]); } } } } function trr_FilterDeps() { var cmb = document.getElementById("trr_dep"); if (!cmb) { var cmb = document.getElementById("trr_dep_f"); var cmb2 = document.getElementById("trr_dep_t"); if (!cmb && !cmb2) { return ""; } } if (cmb) { var ar_dep = new Array(); var sDep = new String(); if (document.getElementById("trr_city[]").selectedIndex == 0) { /* all */ ar_dep = trr_ar_dep; } else { /* by city */ var selCity = trr_SelectedVals("trr_city[]"); for (i=0; i -1 && sDep.indexOf(ar[1]) == -1) { sDep = sDep+ar[1]+";"; } } ar_dep = sDep.split(";"); ar_dep.sort(); } cmb.options.length = 1; cmb.options[0] = new Option("- Любая -", ""); cmb.selectedIndex = 0; if (cmb2) { cmb2.options.length = 1; cmb2.options[0] = new Option("- Любая -", ""); cmb2.selectedIndex = 0; } for (i=0; i 0) { ar = ar_dep[i].split("^"); cmb.options.length++; l = cmb.options.length-1; cmb.options[l] = new Option(ar[1], ar[0]); if (cmb2) { cmb2.options.length++; l = cmb2.options.length-1; cmb2.options[l] = new Option(ar[1], ar[0]); } } } } if (cmb.options.length > 0 && cmb.options.selectedIndex == 0) { cmb.selectedIndex = 1; } if (cmb2) { if (cmb2.options.length > 0 && cmb2.options.selectedIndex == 0) { cmb2.selectedIndex = 1; } } } function trr_FilterDays() { var cmb = document.getElementById("trr_days_f"); var cmb2 = document.getElementById("trr_days_t"); if (!cmb || !cmb2) { return ""; } else { var ar_days = new Array(); var sDays = new String(); if (document.getElementById("trr_city[]").selectedIndex == 0) { /* all */ ar_days = trr_ar_days; } else { /* by city */ var selCity = trr_SelectedVals("trr_city[]"); for (i=0; i -1 && sDays.indexOf(ar[1]+";") == -1) { sDays = sDays+ar[1]+";"; } } ar_days = sDays.split(";"); ar_days.sort(); } cmb.options.length = 1; cmb.options[0] = new Option("- Все -", ""); cmb.selectedIndex = 0; cmb2.options.length = 1; cmb2.options[0] = new Option("- Все -", ""); cmb2.selectedIndex = 0; for (i=0; i 0) { cmb.options.length++; cmb2.options.length++; l = cmb.options.length-1; cmb.options[l] = new Option(ar_days[i], ar_days[i]); cmb2.options[l] = new Option(ar_days[i], ar_days[i]); } } } } function trr_Clear() { var cmbs = new Array("trr_city[]", "trr_star[]", "trr_hotel[]", "trr_meal[]", "trr_accmd", "trr_dep", "trr_days_f", "trr_days_t"); for (i=0; i document.getElementById("trr_days_t").selectedIndex) { document.getElementById("trr_days_t").selectedIndex = document.getElementById("trr_days_f").selectedIndex; } } function getURLParam(strParamName){ var strReturn = ""; var strHref = window.location.href; if ( strHref.indexOf("?") > -1 ) { var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase(); var aQueryString = strQueryString.split("&"); for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){ if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){ var aParam = aQueryString[iParam].split("="); strReturn = aParam[1]; break; } } } return strReturn; }