var _TH_widgetGallery_loading = false;
var ratesWrapper = $("#TH_gallery_626d13ba1aafe3689ee4b1ecb468a2ea");
function _TH_widgetGallery_loadScript(aScript, aSync, aCallback) {
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = aSync;
script.src = aScript;
if (typeof aCallback !== 'undefined') {
script.onload = aCallback;
}
document.body.appendChild(script);
}
if (!window.jQuery) {
_TH_widgetGallery_loadScript("https://partner.tophotels.ru/js/lib/jquery.js", false, _TH_widgetGallery_init);
} else {
_TH_widgetGallery_init();
}
_TH_widgetGallery_loadScript("https://partner.tophotels.ru/js/lib/slick.min.js", true, _TH_widgetGallery_initGallery);
function _TH_widgetGallery_markCurrent(i) {
$('.hotel-profile-photos-desc-i[data-slick-index="'+i+'"]', ratesWrapper).addClass('slick-current').siblings().removeClass('slick-current');
}
function _TH_widgetGallery_initScrollbar() {
if ($('.filter-form-field-dd', ratesWrapper).not('.full-size').length > 0) {
$('.filter-form-field-dd', ratesWrapper).not('.full-size').mCustomScrollbar({
mouseWheel:{scrollAmount: 50},
advanced:{
updateOnContentResize: true
}
});
}
}
function _TH_widgetGallery_initGallery() {
$('.slider-for', ratesWrapper).slick({
dots: false,
lazyLoad: 'ondemand',
infinite: false,
slidesToShow: 1,
slidesToScroll: 1,
asNavFor: '.slider-nav',
focusOnSelect: true
});
$('.slider-nav', ratesWrapper).slick({
dots: false,
lazyLoad: 'ondemand',
infinite: false,
slidesToShow: 5,
slidesToScroll: 1,
slide: 'a',
asNavFor: '.slider-for',
focusOnSelect: true
});
$('.slider-nav', ratesWrapper).on('beforeChange', function(e, slick, currentSlide, nextSlide){
_TH_widgetGallery_markCurrent(nextSlide);
});
$('.hotel-profile-photos-desc-i', ratesWrapper).on('click', function(e){
_TH_widgetGallery_markCurrent($(this).data('slick-index'));
});
$('.slider-for', ratesWrapper).on('beforeChange', function(e, slick, currentSlide, nextSlide){
_TH_widgetGallery_markCurrent(nextSlide);
});
}
function _TH_widgetGallery_loadCss(cssUrl) {
var link = document.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");
link.setAttribute("href", cssUrl);
document.getElementsByTagName("head")[0].appendChild(link);
}
function _TH_widgetGallery_toggleFilter(el) {
var $this = $(el);
$this.toggleClass('ls-chooser-dropdown-button_act');
$this.next().slideToggle();
return false;
}
function _TH_widgetGallery_loadGallery(aMobileForm) {
if (_TH_widgetGallery_loading) {
return;
}
_TH_widgetGallery_loading = true;
$('.hotel-profile-body', ratesWrapper).append('
');
var loader_ml = 0, loadet_mt = 0;
if ($('.hotel-profile-content-cell-filter:visible', ratesWrapper).length) {
loader_ml += -parseInt(($('.hotel-profile-content-cell-filter:visible', ratesWrapper).width()||0)/2);
} else {
loader_ml = 0;
loadet_mt = 35;
}
if ($('.slider-nav:visible', ratesWrapper).length) {
loadet_mt += -parseInt(($('.slider-nav:visible', ratesWrapper).height()||0)/2);
loadet_mt += -$('.hotel-profile-content-cell-filter-mobile:visible', ratesWrapper).height()||0;
}
$('.gallery_loading .loading').css({
"margin-left": loader_ml + 'px',
"margin-top": loadet_mt + 'px'
}).show();
var url = "https://partner.tophotels.ru/widgetsHotel/galleryData?uid=626d13ba1aafe3689ee4b1ecb468a2ea&alId=26818&sec=1&";
if ((typeof aMobileForm !== 'undefined') && aMobileForm) {
url = url + $('.filter-form-mobile', ratesWrapper).serialize();
} else {
url = url + $('.filter-form-desktop', ratesWrapper).serialize();
}
_TH_widgetGallery_loadScript(url, true, _TH_widgetGallery_updateGallery);
}
function _TH_widgetGallery_updateGallery() {
_TH_widgetGallery_initGallery();
_TH_widgetGallery_loading = false;
$('.hotel-profile-body .gallery_loading', ratesWrapper).remove();
}
function _TH_widgetGallery_setVal(elId, val) {
$('#' + elId, ratesWrapper).val(val);
_TH_widgetGallery_loadGallery(true);
}
function _TH_widgetGallery_init() {
ratesWrapper.delegate('.ls-chooser-checkbox-group-photo-type .ls-chooser-radio', 'change', function(){
if ($('.ls-chooser-checkbox-group-photo-type .ls-chooser-radio:checked', ratesWrapper).length) {
if ($('#type_0', ratesWrapper).prop('checked')) {
$('#type_0', ratesWrapper).removeAttr('checked');
}
}
_TH_widgetGallery_loadGallery();
}).delegate('.ls-chooser-checkbox-group-user-type .ls-chooser-radio', 'change', function(){
if ($('.ls-chooser-checkbox-group-user-type .ls-chooser-radio:checked', ratesWrapper).length) {
if ($('#user_type_0', ratesWrapper).prop('checked')) {
$('#user_type_0', ratesWrapper).removeAttr('checked');
}
}
_TH_widgetGallery_loadGallery();
}).delegate('#type_0', 'click', function(){
$('.ls-chooser-checkbox-group-photo-type .ls-chooser-radio', ratesWrapper).removeAttr('checked');
_TH_widgetGallery_loadGallery();
}).delegate('#user_type_0', 'click', function(){
$('.ls-chooser-checkbox-group-user-type .ls-chooser-radio', ratesWrapper).removeAttr('checked');
_TH_widgetGallery_loadGallery();
}).delegate('.filter-form-mobile-btn', 'click', function(){
_TH_widgetGallery_loadGallery(true);
}).delegate('.ls-chooser-select-reset-all', 'click', function(){
$('#type_0, #user_type_0', ratesWrapper).attr('checked', 'checked');
$('.ls-chooser-checkbox-group-photo-type .ls-chooser-radio', ratesWrapper).removeAttr('checked');
$('.ls-chooser-checkbox-group-user-type .ls-chooser-radio', ratesWrapper).removeAttr('checked');
_TH_widgetGallery_loadGallery();
});
}
(function(){
var html = [];
_TH_widgetGallery_loadCss("https://partner.tophotels.ru/css/partners/fonts.css");
_TH_widgetGallery_loadCss("https://partner.tophotels.ru/css/partners/widgetsHotelGallery.css");
_TH_widgetGallery_loadCss("https://partner.tophotels.ru/css/partners/filter-form.mCustomScrollbar.css");
_TH_widgetGallery_loadScript("https://partner.tophotels.ru/js/lib/jquery.mCustomScrollbar.min.js", true, _TH_widgetGallery_initScrollbar);
_TH_widgetGallery_loadScript("https://partner.tophotels.ru/js/partners/gallery.js", true);
html.push(
''
);
(new (function(){var o,i,s,u,l=this,r=[];this.serializePostFields=function(e,n){var t,o,i,s=[];for(t in e)e.hasOwnProperty(t)&&(o=n?n+"["+t+"]":t,i=e[t],s.push(null!==i&&"object"==typeof i?l.serializePostFields(i,o):encodeURIComponent(o)+"="+encodeURIComponent(i)));return s.join("&")},this.sendCounter=(o=function(e){var n=new XMLHttpRequest;n.open("POST","https://netlog.ru/new/counter",!0),n.onload=function(){200!==n.status&&"undefined"!=typeof console&&console.error("Ошибка сбора статистики netlog")},n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(l.serializePostFields({ireqs:r})),r=null,r=[]},i=1e3,function(){var e=this,n=arguments,t=s&&!u;clearTimeout(u),u=setTimeout(function(){u=null,s||o.apply(e,n)},i),t&&o.apply(e,n)}),this.counter=function(e,n,t,o){null==o&&(o={}),"object"!=typeof o&&(o={info:o}),o.ua=navigator.userAgent,o.lng=navigator.language,o.path=location.href,o.session=null,o.uniq=null,r.push({id:e,thu:n,ex:o,type:t,t:Math.round((new Date).getTime()/1e3)}),l.sendCounter()}})()).counter(32152, 0, 'event', {
partnerId: 1016,
allocationId: 26818,
widgetId: '203'
});
ratesWrapper.html(html.join(''));
delete html;
})();