var RuspoSearch_sDomain ;//= "http://ruspo.by:80"; //var RuspoSearch_QueryParam = Ruspo_getQueryVariable(); var RuspoSearch_Theme = "smoothness"; jQuery.noConflict(); if ($ == null) $ = jQuery; var RSPreloadBlock = '



Запрос выполняется




'; var RuspoFirstPageURL; var RuspoSearchTimer; var RuspoLocked = false; var LoadHotelsTimeout = 0; var NewWin = true; var ModuleID = 0; var Ruspo_CurrentCity = 1206; var Ruspo_CurrentCountry = 108; //var BaseURL = "http://ruspo.by:80/"; jQuery(document).ready(function (e) { }); function LoadURL(URL) { var oScript = document.createElement("script"); oScript.src = URL; document.body.appendChild(oScript); } function Init() { jQuery.maxZIndex = jQuery.fn.maxZIndex = function (opt) { /// /// Returns the max zOrder in the document (no parameter) /// Sets max zOrder by passing a non-zero number /// which gets added to the highest zOrder. /// /// /// inc: increment value, /// group: selector for zIndex elements to find max for /// /// var def = { inc: 10, group: "*" }; jQuery.extend(def, opt); var zmax = 0; jQuery(def.group).each(function () { var cur = parseInt(jQuery(this).css('z-index')); zmax = cur > zmax ? cur : zmax; }); if (!this.jquery) return zmax; return this.each(function () { zmax += def.inc; jQuery(this).css("z-index", zmax); }); } /* if (jQuery('.PREFIX_searchBlock a')) jQuery('.PREFIX_searchBlock a').bind('click', function () { jQuery(this).parent().next().find('input:checked').removeAttr('checked'); return false; }); jQuery('#children_list label.PREFIX_RADIO_LABEL').live('click', function (e) { setTimeout(ShowHideAges, 100); }); jQuery('.checkAll').live('click', function (e) { var container = jQuery(this).parent(); var description = container.siblings('.PREFIX_SELECT_HEADER:first'); var cb_list = container.find('input:checkbox'); var cb_length = cb_list.length; if (!cb_length) return false; cb_list.attr('checked', true); description.children(':first').html('Все варианты: ' + cb_length + ' шт.'); return false; }); jQuery('.unCheckAll').live('click', function (e) { var container = jQuery(this).parent(); var description = container.siblings('.PREFIX_SELECT_HEADER:first'); var cb_list = container.find('input:checkbox'); var cb_length = cb_list.length; if (!cb_length) return false; cb_list.attr('checked', false); if (description.attr('default')) description.children(':first').html(description.attr('default')); else description.children(':first').html(' '); return false; }); var selects = jQuery('.PREFIX_SELECT'); selects.each(function () { var sel = jQuery(this); var header = sel.children('.PREFIX_SELECT_HEADER'); var cont = sel.children('.PREFIX_SELECT_CONTENT'); // var labels = cont.children('label'); sel.css({ width: (parseInt(sel.attr('width'))) + 'px' }); cont.css({ width: (parseInt(sel.attr('width')) - (jQuery.browser.msie ? 0 : 12)) + 'px' }); header.bind('click', function () { jQuery('.PREFIX_SELECT_CONTENT.PREFIX_active').removeClass('PREFIX_active'); if (!cont.hasClass('PREFIX_active')) { cont.addClass('PREFIX_active'); jQuery(document).bind('click', closeMe); } return false; }); */ /* IT'S IMPORTANT TO CHANGE bind() TO live() HERE */ /* ?? DOUBLE TRIGGER ?? */ // var labels = cont.children('label.PREFIX_RADIO_LABEL'); /* }); jQuery('.PREFIX_SELECT_CONTENT td input').live('change', function () { var par = jQuery(this).parent().parent().parent().parent(); var tit = par.parent().prev().children('span:first'); if (!tit.length) var tit = par.parent().parent().prev().children('span:first'); var ic = par.find('input:checked'); var rr = []; for (var i = 0; i < ic.length; i++) rr.push(jQuery(ic[i]).next().text()); if (!rr.length) rr.push('Все'); tit.text(rr.join(', ')); }); jQuery('.PREFIX_SELECT .PREFIX_SELECT_CONTENT label.PREFIX_RADIO_LABEL').live('click', function (e) { if (!e || (!e.pageX && !e.pageY)) return; var myText = jQuery(this).text(); var myVal = jQuery(this).val(); jQuery(this) .parent() .removeClass('PREFIX_active') .prev() .children('span:first') .text(myText); jQuery(this).children('input').attr('checked', 'checked'); var myId = jQuery(this).parent().attr('id'); switch (myId) { case 'cities_list': LoadCountries(jQuery(this).children('input').val(), jQuery('#countries_list input:checked').val()); break; case 'countries_list': LoadResorts(); LoadHotels(); LoadOperators(); break; } // return false; }); selects.children('.PREFIX_SELECT_HEADER') .bind('mouseover', function () { jQuery(this).addClass('ui-state-hover'); }) .bind('mouseout', function () { jQuery(this).removeClass('ui-state-hover'); }); jQuery('label.PREFIX_RADIO_LABEL.ui-button') .live('mouseover', function () { jQuery(this).addClass('ui-state-hover'); }) .live('mouseout', function () { jQuery(this).removeClass('ui-state-hover'); }) .live('click', function () { var tmp = jQuery(this).parent().children('label.ui-state-active'); // tmp.children('input').removeAttr('checked'); var tmp_ = tmp.children('input'); for (var i = 0; i < tmp_.length; i++) tmp_[i].checked = false; tmp.removeClass('ui-state-active'); jQuery(this).addClass('ui-state-active'); this.getElementsByTagName('input')[0].checked = true; return false; }); try { jQuery("#ruspo_search_form").corner("round"); } catch (ex) { } var tmp1 = ''; var tmp2 = ''; if (document.getElementById("nights_from") != null) { for (var i = 1; i <= 30; i++) { tmp1 += ''; tmp2 += ''; } document.getElementById('nights_from').innerHTML = tmp1; document.getElementById('nights_to').innerHTML = tmp2; } tmp1 = ''; tmp2 = ''; var tmp3 = ''; for (var i = 0; i <= 14; i++) { tmp1 += ''; tmp2 += ''; tmp3 += ''; } var tmp4 = null; if ((tmp4 = document.getElementById('first_child')) != null) tmp4.innerHTML = tmp1; if ((tmp4 = document.getElementById('second_child')) != null) tmp4.innerHTML = tmp2; if ((tmp4 = document.getElementById('third_child')) != null) tmp4.innerHTML = tmp3; var dDate = new Date(); if (document.getElementById('DateFrom') != null) { dDate.setDate(dDate.getDate() + 1); document.getElementById('DateFrom').value = (dDate.getUTCDate() < 10 ? "0" : "") + dDate.getUTCDate() + "." + ((dDate.getUTCMonth() < 9 ? "0" : "") + (dDate.getUTCMonth() * 1 + 1)) + "." + dDate.getUTCFullYear(); } if (document.getElementById('DateTo') != null) { dDate.setDate(dDate.getDate() + 4); document.getElementById('DateTo').value = (dDate.getUTCDate() < 10 ? "0" : "") + dDate.getUTCDate() + "." + ((dDate.getUTCMonth() < 9 ? "0" : "") + (dDate.getUTCMonth() * 1 + 1)) + "." + dDate.getUTCFullYear(); } LoadURL(BaseURL + "XML/SEARCH/GetDictionary.aspx?nojquery=1&nojquery=1&TYPE=FOODS&html=1"); LoadURL(BaseURL + "XML/SEARCH/GetDictionary.aspx?nojquery=1&nojquery=1&TYPE=STARS&html=1"); LoadURL(BaseURL + "XML/SEARCH/GetDictionary.aspx?nojquery=1&nojquery=1&TYPE=CITIES&SELECTED=" + Ruspo_CurrentCity + "&html=1" + "&ModuleID=" + ModuleID); LoadCountries(Ruspo_CurrentCity, Ruspo_CurrentCountry); ShowHideAges(); jQuery(function () { jQuery.datepicker.setDefaults( jQuery.extend(jQuery.datepicker.regional["ru"]) ); }); jQuery(function () { jQuery("#DateFrom").datepicker( { beforeShow: function () { jQuery('#ui-datepicker-div').maxZIndex(); }, onSelect: function (dateText, inst) { var DateTxt = document.getElementById('DateFrom').value.replace(/\./g, '/').replace(/^(\d+\/)(\d+\/)/, function ($0, $1, $2) { return $2 + $1; }); var dDate = new Date(DateTxt); dDate.setDate(dDate.getDate() + 4); document.getElementById('DateTo').value = (dDate.getUTCDate() < 10 ? "0" : "") + dDate.getUTCDate() + "." + ((dDate.getUTCMonth() < 9 ? "0" : "") + (dDate.getUTCMonth() * 1 + 1)) + "." + dDate.getUTCFullYear(); } }); }); jQuery(function () { jQuery("#DateTo").datepicker({ beforeShow: function () { jQuery('#ui-datepicker-div').maxZIndex(); } }); }); //jQuery('#ui-datepicker-div').maxZIndex(); }, //jQuery('#ui-datepicker-div').css({ clip: 'auto', 'z-index': '9999999' }); */ } /* function LoadCountries(CityFrom, Selected) { Ruspo_CurrentCity = CityFrom; Ruspo_CurrentCountry = Selected; LoadURL(BaseURL + "XML/SEARCH/GetDictionary.aspx?nojquery=1&TYPE=COUNTRIES&html=1&SELECTED=" + Selected + "&CITY=" + CityFrom + "&ModuleID=" + ModuleID); } function LoadResorts() { Ruspo_CurrentCity = jQuery('#cities_list input:checked').val(); Ruspo_CurrentCountry = jQuery('#countries_list input:checked').val(); jQuery('#resorts_list').html("
Загрузка...
"); LoadURL(BaseURL + "XML/SEARCH/GetDictionary.aspx?nojquery=1&nojquery=1&TYPE=RESORTS&html=1&COUNTRY=" + Ruspo_CurrentCountry + "&ModuleID=" + ModuleID); } function LoadOperators() { if (document.getElementById("oper_list") != null) { Ruspo_CurrentCity = jQuery('#cities_list input:checked').val(); if (Ruspo_CurrentCity == undefined) Ruspo_CurrentCity = 1206; Ruspo_CurrentCountry = jQuery('#countries_list input:checked').val(); jQuery('#oper_list').html("
Загрузка...
"); LoadURL(BaseURL + "XML/SEARCH/GetDictionary.aspx?nojquery=1&TYPE=OPERATORS&html=1&COUNTRY=" + Ruspo_CurrentCountry + "&CITY=" + Ruspo_CurrentCity + "&ModuleID=" + ModuleID); } } function RunHotels(Filter) { if (Filter == CollectRestr()) { jQuery('#hotels_list').html("
Загрузка...
"); LoadURL(Filter); } } function LoadHotels() { setTimeout("RunHotels(\"" + CollectRestr() + "\")", 1200); } function CollectRestr() { var sURL = BaseURL + "XML/SEARCH/GetDictionary.aspx?nojquery=1&nojquery=1&TYPE=HOTELS&html=1&COUNTRY=" + jQuery('#countries_list input:checked').val(); var sStars = ""; var sResorts = ""; var i = 1; while (document.getElementById('st' + i) != null) { if (document.getElementById('st' + i).checked) sStars += document.getElementById('st' + i).value + ","; i++; } if (sStars.length > 0) { sStars = sStars.substring(0, sStars.length - 1); sURL += "&STARS=" + sStars; } i = 1; while (document.getElementById('rst' + i) != null) { if (document.getElementById('rst' + i).checked) sResorts += document.getElementById('rst' + i).value + ","; i++; } if (sResorts.length > 0) { sResorts = sResorts.substring(0, sResorts.length - 1); sURL += "&RESORT=" + sResorts; } if (document.getElementById('NamePart') != null) { if (document.getElementById('NamePart').value.length > 0) { sURL += "&NAME=" + document.getElementById('NamePart').value; } } return sURL; } */ function ShowHideAges() { /* if (!jQuery('#children_list input:checked').length || jQuery('#children_list input:checked').val() == "0") document.getElementById('children_ages').style.display = "none"; else { document.getElementById('children_ages').style.display = "block"; document.getElementById('second_child_').style.visibility = jQuery('#children_list input:checked').val() > 1 ? "visible" : "hidden"; document.getElementById('third_child_').style.visibility = jQuery('#children_list input:checked').val() > 2 ? "visible" : "hidden"; } */ } function GetSelectListValues(prefix, paramName) { var i = 1; var sValues = ""; while (document.getElementById(prefix + i) != null) { if (document.getElementById(prefix + i).checked) sValues += document.getElementById(prefix + i).value + ","; i++; } if (sValues.length > 0) { sValues = sValues.substring(0, sValues.length - 1); sValues = paramName + "=" + sValues + "&"; } return sValues; } function RefreshOperators(Session) { LoadURL("RefreshOperStatus.aspx?session=" + Session); } function BlockUI() { if (ModuleID == 0) jQuery.blockUI({ message: "

Запрос выполняется

" , centerY: false, centerX: true, css: { top: '600px', border: 'none', backgroundColor: 'transparent' }, overlayCSS: { backgroundColor: '#eeeeee', opacity: '0.6' } }); /* else jQuery.blockUI({ message: "


Запрос выполняется




" , centerY: false, css: { top: '100px', border: 'none', backgroundColor: 'transparent' }, overlayCSS: { backgroundColor: '#eeeeee', opacity: '0.6' } });*/ } function closeMe(e) { if (!e || (!e.pageX && !e.pageY)) return; var act = jQuery('.PREFIX_SELECT_CONTENT.PREFIX_active'); if (act.length && e.pageX > act.offset().left && e.pageX < act.offset().left + act.outerWidth() && e.pageY > act.offset().top && e.pageY < act.offset().top + act.outerHeight()) return; act.removeClass('PREFIX_active'); jQuery(document).unbind('click', closeMe); } function ShowReloadDialog() { $('#enddialog').html("
Поиск завершен

Обновить результаты поиска для показа всех найденных туров?<\/center>").dialog({ modal: true, buttons: { "ДА": function () { LoadFirstPage(RuspoFirstPageURL); $(this).dialog("close"); }, "HET": function () { $(this).dialog("close"); } } }); } function equalizeWidth() { if (jQuery('#users').length > 0) { if (jQuery('#progressDiv').length > 0) jQuery('#progressDiv').width(jQuery('#users').outerWidth(true)); if (jQuery('#resultList').length > 0) { jQuery('#resultList').width(jQuery('#users').outerWidth(true)); jQuery('#resultList > div').width(jQuery('#users').outerWidth(true)); //jQuery('#resultList').height(jQuery('#users').outerHeight(true)); //jQuery('#resultList > div').height(jQuery('#users').outerHeight(true)); } } } function ReloadProgress(URL) { if (jQuery("#progressDiv > div#progressDivText").length == 0) { var NewContent = "
<\/div>"; NewContent += "
<\/div><\/div><\/div><\/div>"; jQuery("#progressDiv").html(NewContent); } equalizeWidth(); var oScript = document.createElement("script"); oScript.src = URL + "&cross-domain=1&rnd=" + Math.round(Math.random() * 1000000000); document.body.appendChild(oScript); } function LoadFirstPage(URL) { if (!isDocumentBlocked) BlockUI(); else isDocumentBlocked = false; RuspoFirstPageURL = URL; var oScript = document.createElement("script"); oScript.src = URL + "&rnd=" + Math.round(Math.random() * 1000000000); document.body.appendChild(oScript); } /* function GetNextPage1(URL) { RuspoLocked = true; jQuery.blockUI({ message: RSPreloadBlock, centerY: false, centerX: true, css: { top: '100px', border: 'none', backgroundColor: 'transparent', left: '30%' }, overlayCSS: { backgroundColor: '#eeeeee', opacity: '0.6'} }); jQuery("#resultList").load(URL + "&rnd=" + Math.round(Math.random() * 1000000000), function () { equalizeWidth(); if (ModuleID == 0) jQuery.unblockUI(); RuspoLocked = false; window.scroll(0, 1050); }); } */ function GetNextPage(URL) { BlockUI(); var oScript = document.createElement("script"); oScript.src = URL + "&rnd=" + Math.round(Math.random() * 1000000000); document.body.appendChild(oScript); } function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } } /* function replurl() { var links = $("iframe").contents().find("a.buy"); $("iframe").contents().find("a.buy").css("background-color","#FF00FF"); for (var i = 0; i < links.length; i++) { if(links[i].innerHTML == 'Заказ'){ var newHref = GetText(links[i].href, "poisk1/mailsender/order.php"); links[i].setAttribute('href',newHref ); } } } function GetText(AInputText, AReplaceText) { //var VRegExp = new RegExp(/ruspo.ru\/BookAgency.aspx/);//http://ruspo.ru/v2/forTourists/TuristOrder.aspx? var VRegExp = new RegExp(/ruspo.by:80\/BookAgencyV2.aspx/); var VResult = AInputText.replace(VRegExp, AReplaceText); return VResult; } */ function Ruspo_getQueryVariable() { var scriptList = document.getElementsByTagName("script"); var script_link; for (var i = 0; i < scriptList.length; i++) { if (scriptList[i].src.indexOf("module-loader.js") != -1) script_link = scriptList[i].src; } RuspoSearch_sDomain = script_link.substring(0, script_link.indexOf("?")).replace("scripts/module-loader.js", ""); var vars = script_link.substring(script_link.indexOf("?") + 1).split("&"); var arr = new Array(); for (i = 0; i < vars.length; i++) { var pair = vars[i].split("="); arr[pair[0]] = pair[1]; } return arr; }ScriptLoaded = "../../GetSearchAPI.aspx?module=8765&wide=1&newwin=1&city=1206&country=108&nojquery=1&resultto=div&theme=smoothness&template=ruspo";