Форма онлайн-бронирования
(function(w){
var selectHotel = (function() {
var hotel = '';
switch (window.location.host) {
case 'krasnodar.olympia-hotel.ru': hotel = 'krasnodar'; break;
case 'sochi.olympia-hotel.ru': hotel = 'sochi'; break;
case 'mountain.olympia-hotel.ru': hotel = 'mountain'; break;
case 'red.olympia-hotel.ru': hotel = 'red'; break;
case 'lasarevskoye.olympia-hotel.ru': hotel = 'lasarevskoye'; break;
/* case 'gala.olympia-hotel.ru': hotel = 'plaza'; break;*/
case 'adler-home.olympia-hotel.ru': hotel = 'adler-home'; break;
default:
hotel = '';
break;
}
if (hotel !== '') {
hotel = '.' + hotel;
}
return hotel;
}());
var q=[
['setContext', 'TL-INT-olympia-hotel' + selectHotel, 'ru'],
['embed', 'booking-form', {container: 'tl-booking-form'}]
];
var h=["ru-ibe.tlintegration.ru","ibe.tlintegration.ru","ibe.tlintegration.com"];
var t = w.travelline = (w.travelline || {}),
ti = t.integration = (t.integration || {});
ti.__cq = ti.__cq? ti.__cq.concat(q) : q;
if (!ti.__loader) {
ti.__loader = true;
var d=w.document,c=d.getElementsByTagName("head")[0]||d.getElementsByTagName("body")[0];
function e(s,f) {return function() {w.TL||(c.removeChild(s),f())}}
(function l(h) {
if (0===h.length) return; var s=d.createElement("script");
s.type="text/javascript";s.async=!0;s.src="https://"+h[0]+"/integration/loader.js";
s.onerror=s.onload=e(s,function(){l(h.slice(1,h.length))});c.appendChild(s)
})(h);
}
})(window);
document.addEventListener('DOMContentLoaded', () => {
const header = document.querySelector('.main-header');
const blockMain = document.querySelector('.block-main');
if (!blockMain) return;
const runScroll = () => {
const headerHeight = header
? header.getBoundingClientRect().height
: 0;
const blockTop = blockMain.getBoundingClientRect().top + window.pageYOffset;
const targetTop = blockTop - headerHeight;
smoothScrollTo(targetTop, 1600);
};
requestAnimationFrame(() => {
requestAnimationFrame(runScroll);
});
});
function smoothScrollTo(target, duration = 1600) {
const scroller = document.scrollingElement || document.documentElement;
const start = scroller.scrollTop;
const maxScroll = scroller.scrollHeight - window.innerHeight;
const finalTarget = Math.max(0, Math.min(target, maxScroll));
const distance = finalTarget - start;
const startTime = performance.now();
function easeInOutCubic(t) {
return t < 0.5
? 4 * t * t * t
: 1 - Math.pow(-2 * t + 2, 3) / 2;
}
function animate(currentTime) {
const elapsed = currentTime - startTime;
const progress = Math.min(elapsed / duration, 1);
const eased = easeInOutCubic(progress);
scroller.scrollTop = start + distance * eased;
if (progress < 1) {
requestAnimationFrame(animate);
}
}
requestAnimationFrame(animate);
}