//if( !window['jcClWidgetBase'] ){ //открытие по тэгу if( typeof jcClWidgetBaseOk === 'undefined'){ var jcClWidgetBase = function (param) { this.hash = param.hash; this.wid = param.wid; this.host = param.host; this.type = ''; this.content = ''; this.button = ''; this.cssfile = this.host+'/widget/widget.css'; this.parentid = 0; //родительская сделка this.customer = {}; this.init(param); this.referrer = ''; this.setstat(); this.onopenform = ''; this.oncloseform = ''; this.progressDiv = false; this.progress = false; if(!jcClWidgetBase.mapWidgets[this.wid]) jcClWidgetBase.mapWidgets[this.wid] = this; } jcClWidgetBase.prototype = { init: function(param) { var thisObj = this; this.maindiv = document.createElement('div'); this.maindiv.id='cl_widget_'+this.hash; this.maindiv.innerHTML = ''; this.img = document.createElement('img'); this.img.id='cl_widget_'+this.hash+'_img'; this.img.className = 'clwidget_img'; this.maindiv.appendChild(this.img); this.btn = document.createElement('div'); this.btn.id = 'cl_widget_button_'+this.hash; this.btn.className = 'clwidget-btn'; this.btn.onclick = function(e) { thisObj.openform(); } this.maindiv.appendChild(this.btn); this.container = document.createElement('div'); this.container.id='cl_widget_content_'+this.hash; this.container.className='clwidget-content'; this.container.style.display = 'none'; this.maindiv.appendChild(this.container); this.modal = document.createElement('div'); this.modal.id='cl_widget_overlay_'+this.hash; this.modal.className='clwidget-overlay'; this.modal.onclick = function(e) { thisObj.closeform(); } this.maindiv.appendChild(this.modal) document.body.appendChild(this.maindiv); this.modal.style.zIndex = 9990; this.container.style.zIndex = 9999; jcClWidgetBase.mapWidgets[ this.wid ] = this; this.parentid = 0; this.customer = { id:0, fname:'', mname:'', lname:'', phone:'', email:'', city:''}; }, //init openform: function() { this.modal.style.display='block'; this.modal.style.opacity = 0.7; this.container.style.display='block'; if(this.onopenform) this.onopenform(); }, closeform: function() { this.modal.style.display='none'; this.modal.style.opacity = 0; this.container.style.display='none'; if(this.oncloseform) this.oncloseform(); }, getcookie: function(name) { var reg = new RegExp('('+name+'=)([^;]*)','i'); var matches = document.cookie.match(reg); return matches ? decodeURIComponent(matches[2]) : false; }, setcookie: function(name,val,options) { var str=name+'='+val+';path=/;'; if(options && options.expires) str+='expires='+options.expires; document.cookie = str; }, deletecookie: function(name) { this.setcookie(name, "", {expires: -1}) }, setstat: function() { this.referrer = this.getcookie('clwd_ref'); if(this.referrer == false) { this.referrer = document.referrer; var date = new Date; date.setDate(date.getDate() + 7); this.setcookie('clwd_ref',document.referrer,{expires : date.toUTCString()}); } }, toYandex: function(target) { //Yandex metrika var yaID=0; if (typeof Ya !== "undefined") if(Ya && Ya._metrika && Ya._metrika.getCounters && Ya._metrika.getCounters().length && Ya._metrika.getCounters()[0].id) { yaID = Ya._metrika.getCounters()[0].id+''; if(eval('yaCounter'+yaID)) { var yaCNT = eval('yaCounter'+yaID); yaCNT.reachGoal(target); } } }, toGoogle: function(target) { //Google Analytics if (typeof _gaq !== "undefined") if(_gaq && _gaq.push) _gaq.push(['_trackEvent', 'CloffWidget', target]); //Universal Analytics else if (typeof ga !== "undefined") if(ga) ga('send', 'event', 'CloffWidget', target); }, callscript: function(url,data,fcallback) { var t = new Date().getTime(); var str = url+'?_t='+t+'&_w='+this.wid+'&_h='+this.hash+'&_r='+encodeURIComponent(this.referrer); if(data) str+='&'+data; this.img.onload = function() { var nstatus = parseInt(this.naturalHeight,10); if(fcallback) fcallback(nstatus); } this.img.src = str; }, getparams: function(){ var t = new Date().getTime(); return ('_t='+t+'&_w='+this.wid+'&_h='+this.hash+'&_r='+encodeURIComponent(this.referrer)); }, //отправка запроса CORS callajax: function(url, data, fcallback, isprogress, errfunc) { var t = new Date().getTime(); var thisObj = this; var xmlHttp = new XMLHttpRequest(); xmlHttp.withCredentials = true; if(data){ xmlHttp.open( (data?'POST':'GET'), url, true); xmlHttp.setRequestHeader("Method", "POST " + url + " HTTP/1.1"); xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); data += ('&_t='+t+'&_w='+this.wid+'&_h='+this.hash+'&_r='+encodeURIComponent(this.referrer)); } else { url += ( ( (url.indexOf('?')<=0) ? '?' : '&')+'_t='+t+'&_w='+this.wid+'&_h='+this.hash+'&_r='+encodeURIComponent(this.referrer)); xmlHttp.open( (data?'POST':'GET'), url, true); } xmlHttp.onreadystatechange = function(){ var param = false; //console.log('xmlHttp.readyState',xmlHttp.readyState, 'isprogress', isprogress); if(isprogress){ //console.log('xmlHttp.readyState if(isprogress){ ',(25*xmlHttp.readyState)); thisObj.setProgress(25*xmlHttp.readyState); } if(xmlHttp.readyState == 4){ if(isprogress){ thisObj.hideProgress(); } if(xmlHttp.status !=200 ) { if(errfunc) errfunc(); if( xmlHttp.status != 0 ){ alert('ERROR: request error.\nResponce status:'+xmlHttp.status); return false; } else{ xmlHttp.abort(); return false; } } var resp = xmlHttp.responseText; try { param = eval(resp)[0]; } catch (e) { console.log('Ошибка обработки ответа:', resp); console.error(e); if(errfunc) errfunc(); return false; }; if(fcallback) fcallback(param); } }; if(isprogress){ this.showProgress(); } xmlHttp.send(data); var n = 0; var prog = function(){ n++; thisObj.setProgress(4*n); if(n<20) window.setTimeout( prog, 100); }; prog(); }, setProgress: function(v){ this.progress.value = v; }, showProgress: function(){ if(!this.progressDiv){ this.progressDiv = document.createElement("DIV"); this.progressDiv.className = 'clwidget-progress-overlay'; this.progressDiv.style.display = 'none'; this.progress = document.createElement("PROGRESS"); this.progress.className = 'clwidget-progress'; this.progress.max = 100; this.progressDiv.appendChild(this.progress); document.body.appendChild(this.progressDiv); } //получим zIndex this.progress.value = 0; this.progressDiv.style.zIndex = ( this.zIndex ? parseInt(this.zIndex,10)+10000: (this.container?parseInt(this.container.style.zIndex,10):0)+5); this.progressDiv.style.display = 'block'; }, hideProgress: function(){ this.progressDiv.style.display = 'none'; }, //hideProgress setParent: function(pid){ this.parentid = pid; }, //setParent setCustomer: function(oc){ this.customer = Object.assign({}, oc); }, //setCustomer } jcClWidgetBase.mapWidgets = {}; jcClWidgetBase.getWidget = function(wid){ return ( jcClWidgetBase.mapWidgets[wid] ? jcClWidgetBase.mapWidgets[wid]: false ); }; jcClWidgetBase.onHASH = function(e){ console.log('HASH333', location.hash); if(location.hash.substr(0,6)==='#CLWDG'){ let wid = parseInt(location.hash.substr(6),10); if(wid){ let wgd = jcClWidgetBase.getWidget(wid); if(wgd) wgd.openform(); } } } window.addEventListener('DOMContentLoaded', (event) => { window.addEventListener("hashchange" , function(e) { jcClWidgetBase.onHASH(e); } , false); console.log('OK DOMContentLoaded', jcClWidgetBase.mapWidgets); //ну и проверим а вдруг сразу? if( location.hash && location.hash.length) setTimeout( function(){ jcClWidgetBase.onHASH(); },800); }); console.log('SET DOMContentLoaded', jcClWidgetBase.mapWidgets); var jcClWidgetBaseOk = 1; } //END if jcClWidgetBaseOk; //} //if( !window['jcClWidgetBase'] ){ /* .LINE {max-width: 1010px;} .BLOCK_1 {max-width: 880px;} .BLOCK_2 {max-width: 560px;} .COLUMN_1 {max-width: 346px;} .COLUMN_2 {max-width: 226px; */ function jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3(param) { jcClWidgetBase.apply(this, arguments); this.type = 'hour'; var thisObj = this; this.content = param.content; this.onopenform = function() { }; this.oncloseform = function() { thisObj.resetAll(); }; this.host = param.host; this.dtStart = false; this.dtEnd = false; this.curVar = false; this.arrService = []; this.arrOption = []; this.mapAdd = {}; this.total; this.bedType = 1; this.chBedType = false; this.bookingID = 0; this.cntAdt = 2; this.cntChild = 0; this.cntInfants = 0; this.descr = ''; this.prepay = 0; this.staticForm = param.staticForm; this.hash = '588f707ded5756c148a5c943f7c1e3e3'; this.varDescr = false; this.initChilds = false; this.tariffId = ''; this.addPrice = 0; //сумма услуг и опций this.sortByHousing = 0; //сортировать по корпусам this.sizes = [ {w:880, cl: 'BLOCK_1'}, {w:560, cl: 'BLOCK_2'}, {w:390, cl: 'COLUMN_1'}, {w:226, cl: 'COLUMN_2'}, ]; this.childmax = cl_hotel3682.childmax; this.infantmax = cl_hotel3682.infantmax; this.cityrq = cl_hotel3682.cityrq; this.selbed = cl_hotel3682.selbed; this.cntGuests = 4; this.frm = false; this.ispromo = 0; this.promocode = 0; this.cntday = 1; this.SUTKI = 24*3600*1000; this.bookend = ( cl_hotel3682&&cl_hotel3682.bookend ? cl_hotel3682.bookend: ''); this.bookstart = ( cl_hotel3682&&cl_hotel3682.bookstart ? cl_hotel3682.bookstart: ''); this.money = cl_hotel3682&&cl_hotel3682.money; this.ssid = this.getcookie('cl_ssid'); if(!this.ssid) this.ssid = ''; this.addEvent = function(elem, type, handler){ if (elem.addEventListener){elem.addEventListener(type, handler, false)} else { elem.attachEvent("on"+type, handler)} }; this.removeEvent = function(elem, type, handler){ if (elem.removeEventListener){elem.removeEventListener(type, handler, false)} else { elem.detachEvent("on"+type, handler)} }; this.alert = function(msg){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert_msg').innerHTML = msg; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert').style.display = 'block'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert').classList.remove('hide'); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert_close_x').onclick = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert_close').onclick = function(){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert').classList.add('hide'); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert').style.display = 'none' }; }; //пересадим наши окна в боди document.body.appendChild( document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert').parentNode.removeChild(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert')) ); document.body.appendChild( document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2').parentNode.removeChild(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2')) ); document.body.appendChild( document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step3').parentNode.removeChild(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step3')) ); document.body.appendChild( document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step4').parentNode.removeChild(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step4')) ); document.body.appendChild( document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5').parentNode.removeChild(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5')) ); document.body.appendChild( document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery').parentNode.removeChild(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery')) ); //работа с куками this.setCookie = function(cname, cvalue, exdays) { var d = new Date(); d.setTime(d.getTime() + (exdays*24*60*60*1000)); var expires = "expires="+ d.toUTCString(); document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; }; this.getCookie = function(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for(var i = 0; i 4) || (cl_hotel3682.maxchd>4) ){ //много через SELECT var contAdt = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_adults_cont').parentNode; var contChd = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_cont').parentNode; contAdt.innerHTML = ''; contChd.innerHTML = ''; this.cntA = contAdt.firstChild; sAdt = ''; for(var a=1; a<=cl_hotel3682.maxadt; a++) sAdt += (''); this.cntA.innerHTML = sAdt; this.cntA.onchange = function(obj){ thisObj.freeVars(); } this.cntC = contChd.firstChild; sChd = ''; for(a=0; a<=cl_hotel3682.maxchd; a++) sChd += (''); this.cntC.innerHTML = sChd; //спрячем количества document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_adults_span').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_span').style.display = 'none'; } else{ //мало "человечки" this.cntA = new clMans({ input: document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_adults') , elem : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_adults_span') , del : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_adults_del') , add : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_adults_add') , container : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_adults_cont') , classOn : 'clh_widget_svg_icon' , classOff : 'clh_widget_svg_icon clh_widget_inactive' , cnt : this.cntAdt , min: 1 , max: cl_hotel3682.maxadt , widget : this , onChange: function(obj){ thisObj.freeVars(); } }); this.cntC = new clMans({ input: document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs') , elem : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_span') , del : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_del') , add : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_add') , container : document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_cont') , classOn : 'clh_widget_svg_icon' , classOff : 'clh_widget_svg_icon clh_widget_inactive' , cnt : (this.cntChild+this.cntInfants) , min: 0 , max: cl_hotel3682.maxchd , widget : this , onChange: function(){ thisObj.cntC.onchange(); } }); } this.cntC.onchange = function(){ console.log('thisObj.cntC.onchange'); thisObj.changeChild(); }; //дети 89025070899 var sChildAges = ''; for(var ca=0; ca<=cl_hotel3682.childmax; ca++) sChildAges += (''); for(var c=1; c<5; c++){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_sel_'+c).innerHTML = sChildAges; } //ENDдети //END гости 88153350515 */ this.toGermanString = function(t) { return ('0'+t.getDate()).substr(-2)+'.'+('0'+(1+t.getMonth())).substr(-2)+'.'+t.getFullYear(); }; this.toJapanString = function(t) { return t.getFullYear()+'-'+('0'+(1+t.getMonth())).substr(-2)+'-'+('0'+t.getDate()).substr(-2); }; var errPhone = 'Номер надо вводить в формате:\n8XXXXXXXXXX - для России и либо 810 и любое количество цифр для международных номеров\n'; /* САША ЭТО НИХУЯ НЕ РАБОТАЕТ А ПАТТЕРНОМ НЕРАБОТАЕТ СОВСЕМ */ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_phone').addEventListener("change", function (event) { //проверка параметров var phone = this.value; phone = phone.replace(/\+7/gi,'8').replace(/[^+\d]/g,''); //ВОТ так работать будет console.log('phone:',phone); var errMsg = ''; if( !phone.length ) { errMsg += 'Введите телефон! \n'; } else{ var phonePattern = /^\d+$/; if( (!phonePattern.test(phone)) ){ errMsg = errPhone; } else{ if( phone.substr(0,1)!='8' ){ errMsg = errPhone; } else if( (phone.substr(0,3)!='810') ) if(phone.length!=11){ errMsg = errPhone; } } } this.setCustomValidity(errMsg); }); //document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_phone').setCustomValidity('Введите телефон!'); this.booking_init(); //hour document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_start').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_hstart').style.display = ''; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_end').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_time').style.display = ''; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_bed').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_adult').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_person').style.display = ''; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_div_child').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step1_legend').style.display = 'none'; //проинициализируем даты document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_dth').value = wDate.dt2german( ds ); this.dtHour = new wDate( { input: document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_dth') , button: document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_dth_button') , nolegend:true , class: 'cl_wdt_588f707ded5756c148a5c943f7c1e3e3 CL_WDT_HOUR' , onchange: function(){ thisObj.tmHour.reset(); thisObj.disableOccupancy(); } } ); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person_minus').onclick = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person_plus').onclick = function() { var fld = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person'); if(this.id=='cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person_minus') fld.value = parseInt(fld.value,10) - 1; else fld.value = parseInt(fld.value,10) + 1; if(parseInt(fld.value,10) <= 1) { fld.value = 1; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person_minus').classList.add('clh_widget_inactive'); } else { document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person_minus').classList.remove('clh_widget_inactive'); } } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person').onchange = function() { if(parseInt(this.value,10) <= 1) { this.value = 1; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person_minus').classList.add('clh_widget_inactive'); } else { document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person_minus').classList.remove('clh_widget_inactive'); } } this.occupancy = {}; this.tmHour = new wTime( {input: document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_time'), button: document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_time_button'), step: parseInt(cl_hotel3682.interval,10) , pass: parseInt(cl_hotel3682.intpass,10), selonlyone: parseInt(cl_hotel3682.intone,10), starttime: parseInt(cl_hotel3682.tmstart,10), endtime: parseInt(cl_hotel3682.tmend,10), class: 'cl_wdt_588f707ded5756c148a5c943f7c1e3e3', beforeshow: function() { if(!thisObj.occupancy[thisObj.dtHour.getDate().toGermanStr()]) thisObj.loadOccupancy(); else thisObj.disableOccupancy(); } }); this.dtHour.onchange(); this.tmSelect = new wTime( {input: document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_time_select'), button: false, step: parseInt(cl_hotel3682.interval,10), showlegend: true, class: 'cl_wdt_588f707ded5756c148a5c943f7c1e3e3', statusfree: 1, statusdis: 2, statusbusy: 3, statusselect: 4, oncommit: function() { var dtstart = new Date; dtstart.setHours(0,0,0); dtstart.setMinutes(thisObj.tmSelect.start); var dtend = new Date; dtend.setHours(0,0,0); dtend.setMinutes(thisObj.tmSelect.end); thisObj.tmHour.setInterval(dtstart,dtend); thisObj.loadVars(true); } }); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2_promo').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2_promo_button').onclick = function(e){}; //services document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_label').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_list').style.display = 'none'; // this.multyselect = (cl_hotel3682.rentmulty > 1); this.selVars = {}; //скрыть брендирование if(cl_hotel3682.antibrand == 1) { document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_rights').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_rights2').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_rights3').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_rights4').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_rights5').style.display = 'none'; } } jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype = Object.create(jcClWidgetBase.prototype); jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.opencnt = 0; jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.openform = function( ID_CONTAINER, e ){ if(window.clW_588f707ded5756c148a5c943f7c1e3e3){ jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.opencnt = 0; clW_588f707ded5756c148a5c943f7c1e3e3.openform( ID_CONTAINER, e ); } else{ setTimeout( function(){ if(jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.opencnt<10){ jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.opencnt++; jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.openform( ID_CONTAINER, e ); } },500); } }; jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.zIndex = 99998; jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.jscCntRus = function (cnt, one, two, five) { var last = Math.abs(cnt%10); var res = five; if( ( (cnt%100)<10 || (cnt%100)>20) ){ switch(last){ case 1 : res = one; break; case 2 : case 3 : case 4 : res = two; break; } } return res; } // eof jscCntRus() jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.maxZIndex = function() { return Array.from(document.querySelectorAll('body *')) .map(a => parseFloat(window.getComputedStyle(a).zIndex)) .filter(a => !isNaN(a)) .sort() .pop(); } jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.openform = function( ID_CONTAINER, e ){ if(ID_CONTAINER && document.getElementById(ID_CONTAINER) ){ this.add_class = ''; this.formContainer = document.getElementById(ID_CONTAINER); this.formContainer.innerHTML = ''; } else{ this.jscClassAdd( this.firstScreen, 'clh_window' ); this.formContainer = this.wrapper; //посмотреим вдруг нужен if(e && e.target){ var el = e.target; var xIndex = 99998; var cl = ''; var cnt = 0; var x = 0; while( el.parentNode ){ el = el.parentNode; if(el.tagName=='BODY'){ break; } else{ x = parseInt((getComputedStyle ? getComputedStyle(el, null) : el.currentStyle).zIndex,10); if( x && x>0 ) xIndex += x; } cnt++; if(cnt>10000) break; } jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.zIndex = xIndex; } } jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.zIndex = jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.maxZIndex()+1; this.formContainer.appendChild( this.formScreen.parentNode.removeChild(this.formScreen) ); document.body.appendChild( this.wrapper.parentNode.removeChild(this.wrapper)); this.formScreen.style.display = 'block'; if(this.staticForm){ //убираем крестик document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_close1').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2_back').style.display = 'none'; } else{ //модальность document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_close1').style.display = 'block'; this.wrapper.style.display = 'block'; } this.container.style.zIndex = Math.max(99998, jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.zIndex); if(!document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_styleZ')){ var s = document.createElement('STYLE'); s.id = 'cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_styleZ'; document.body.appendChild(s); } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_styleZ').innerHTML = '#cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step1,' +'#cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2,' +'#cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step3,' +'#cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step4,' +'#cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5, ' +'#cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_wnd_alert, ' +'#cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery, ' +'.cl_wdt_588f707ded5756c148a5c943f7c1e3e3.cl_calendar, .clh_widget_wrapper { --z-index: '+this.container.style.zIndex+'; }'; this.resize(); //this.dtOnChange(); if(cl_hotel3682.islc){ window.setTimeout(function(){ //console.log('window.cloff_myaccount_widget',window.cloff_myaccount_widget); if(window.cloff_myaccount_widget){ cloff_myaccount_widget.initLinks(); } else{ if(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_lc_button')) document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_lc_button').style.display = 'none'; } },600); } }; jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.booking_init = function(){ //проверим если возврат с оплаты прорисуем итог и почистим кукисе var bookingID = parseInt( this.getCookie('bookingID'), 10); if(bookingID>0){ this.bookingID = bookingID; this.descr = this.getCookie('bookingDescr'); this.setCookie('bookingID', 0, 1/24/3600); this.setCookie('bookingDescr', '', 1/24/3600); this.toStep5(); } }; /* jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.dtOnChange = function(){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step1_legend').innerHTML = this.getLegend(); }; //сложим легенду jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.getLegend = function(){ return this.dtEnd.getLegend( this.dtStart.dt1, this.dtEnd.dt1, true); } */ //полную легенду jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.getLegendFull = function(){ var pers = parseInt(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person').value,10); var dtobj = this.tmHour.getInterval(this.dtHour.getDate()) return pers + ((pers>1 && pers<5)?' человека, ':' человек, ') + (this.tmHour.afterPM() ?' c ' + dtobj.start + ' по ' + dtobj.end :this.dtHour.getDate().toGermanStr() + ' c ' + this.tmHour.getTimeStart() + ' по ' + this.tmHour.getTimeEnd() ) + (this.curVar?(this.multyselect?', количество: ':', объект: ')+this.curVar.NAME:''); /* var ssN = ''; var roomAmt = 0; if(this.curVar){ if(this.curVar.nums==1){ ssN = 'Номер:'+this.curVar.arrRooms[0].name+' за '+this.curVar.arrRooms[0].amount+this.money.code; roomAmt += this.curVar.arrRooms[0].amount; } else{ ssN = 'Номера:' for(var k=0; k1 ? this.curVar.arrRooms[k].cnt+' по ':'')+this.curVar.arrRooms[k].amount+this.money.code+')'); roomAmt += this.curVar.arrRooms[k].amount; } } } if(roomAmt!=this.curVar.amount){ ssN += ' стоимость по выбранному тарифу '+this.curVar.amount; } var adt = this.cntA.value; var ch = this.cntC.value; var ssVar = adt+' взрослых'+(ch>0?' '+ch+' '+jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.jscCntRus(ch, 'ребёнок', 'ребёнка', 'детей')+' ':''); if(this.addPrice) ssN = (ssN+' дополнительно услуги: '+this.addPrice+this.money.code); return( ssVar+' c '+this.dtStart.dt1.toGermanStr()+' по '+this.dtEnd.dt1.toGermanStr()+'. '+ssN); */ }; //END getLegendFull jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.setLegend2 = function(){ var cnt = 0; var sm = 0; var pers = 0; for(var v in this.selVars) { if(!this.selVars.hasOwnProperty(v)) continue; sm+=this.selVars[v].price; cnt++; pers+=this.selVars[v].occupancy; } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2_legend2').innerHTML = cnt+' объект(-а) на сумму '+sm+' р.'; return {'pers':pers,'cnt':cnt}; } //загрузка вариантов jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.loadVars = function(select){ var thisObj = this; //формируем данные var dtobj = this.tmHour.getInterval(this.dtHour.getDate()); if(!dtobj) { this.alert('Выберите интервал времени.'); return false; } var msg = ''; if(this.bookend != '') { var bookend = new Date( Date.parse(this.bookend) ); if(bookend < this.dtHour.getDate()){ msg += ( msg==''?'':'
'); msg += 'Бронирование доступно только до '+this.toGermanString(bookend); } } var hds = new Date( Date.parse(this.bookstart) ); if(hds > this.dtHour.getDate()){ msg += ( msg==''?'':'
'); msg += 'Бронирование доступно только с '+this.toGermanString(hds); } //Если ошибка выводим и выходим! if(msg!=''){ this.alert(msg); return; } var spost = 'dtfrom=' + dtobj.start + '&dtto='+ dtobj.end + '&person='+document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person').value; //отправляем на сервер var rs = 'start'; if(this.multyselect) rs = 'startmulty'; this.callajax( thisObj.host+'/widget/rent.'+rs+'.rs.php?aj=1', spost, function(param){ console.log('588f707ded5756c148a5c943f7c1e3e3', param); if(parseInt(param.errcode,10)>0){ if(param.errmsg){ thisObj.alert(param.errmsg); return; } } //есть ли варианты if(param.arrvariant.length==0){ thisObj.alert('Нет подходящих вариантов на указанные даты'); return; } if(param.full) thisObj.alert('В указанный период нет свободных мест.
В списке приведены все доступные на указанный день объекты и их свободные и занятые периоды.
'+ 'Попробуйте выбрать другой период, проверив расписание доступности объекта под кнопкой "Подобрать время". ') thisObj.arrVars = param.arrvariant; thisObj.arrOption = param.arroption; thisObj.mapAdd['option']= {}; for(k in thisObj.arrOption){ thisObj.mapAdd['option'][thisObj.arrOption[k].id] = thisObj.arrOption[k]; } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2_list').innerHTML = ''; for(var i=0;i0){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_list').appendChild( this.getServiceItem(this.arrService[s]) ); cnt++; } } */ if(!this.arrOption.length){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_label').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_list').style.display = 'none'; } else{ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_label').style.display = 'flex'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_list').style.display = 'flex'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_list').innerHTML = ''; for(var o=0; o0){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_list').appendChild( this.getSrvOptItem(this.arrOption[o], 'option') ); cnt++; } } } //пересчитаем цену this.reCalc(); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_next3_button').innerHTML = (this.curVar.isOverbooking ? cl_hotel3682.btoverbooking: cl_hotel3682.btbooking); //вкладки на втором экране var thisObj = this; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_label').onclick = function(e){ thisObj.jscClassRemove(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_label'), 'clh_service_list_header_active'); thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_label'), 'clh_service_list_header_active'); thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_list'), 'clh_mob_hide'); thisObj.jscClassRemove(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_list'), 'clh_mob_hide'); } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_label').onclick = function(e){ thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_label'), 'clh_service_list_header_active'); thisObj.jscClassRemove(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_label'), 'clh_service_list_header_active'); thisObj.jscClassRemove(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_option_list'), 'clh_mob_hide'); thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_list'), 'clh_mob_hide'); } //Открываем окно if( cnt>0 ) document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step3').style.display = 'block'; else this.toStep4(); }; //END toStep2 //Форма ввода данных jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.toStep4 = function(){ this.closeform(); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step4_legend').innerHTML = this.getLegendFull(); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_total4').innerHTML = this.total+' '+this.money.code; //this.total = this.curVar.amount; var thisObj = this; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_next4_button').innerHTML = cl_hotel3682.btbooking; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_next4_button').onclick = function(){ return true; }; var old_element = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_next4_button'); var new_element = old_element.cloneNode(true); old_element.parentNode.replaceChild(new_element, old_element); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_order_form').onsubmit = function(){ thisObj.send(); return false; } if(this.customer && this.customer.id){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_name1').value = this.customer.fname; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_name2').value = this.customer.lname; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_name3').value = this.customer.mname; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_email').value = this.customer.email; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_city').value = this.customer.city; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_phone').value = this.customer.phone; } //Открываем окно document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step4').style.display = 'block'; }; //END toStep4 //Форма ввода данных jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.toStep5 = function(){ this.closeform(); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5_bookingid').innerHTML = this.bookingID; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5_booking_descr').innerHTML = this.descr; //Открываем окно document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5').style.display = 'block'; }; //END toStep4 //отправка формы - создание брони и переход к оплате/итогам jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.send = function() { var errMsg = ''; var thisObj = this; var err = 'Номер надо вводить в формате:\n8XXXXXXXXXX - для России и либо 810 и любое количество цифр для международных номеров\n'; var trim = function(s){ return s.replace(/^\s+|\s+$/g, ""); }; //проверяем var phone = trim(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_phone').value); phone = phone.replace(/\+7/gi,'8').replace(/[^+\d]/g,''); var fname = trim(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_name1').value); var lname = trim(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_name2').value); var mname = trim(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_name3').value); var email = trim(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_email').value); var city = trim(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_city').value); var comment = trim(document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_comment').value); var name = lname+fname; //проверка параметров if( !phone.length ) { errMsg += 'Введите телефон!
\n'; } else{ var phonePattern = /^\d+$/; if( (!phonePattern.test(phone)) ){ errMsg += err; } else{ if( phone.substr(0,1)!='8' ){ errMsg += err; } else if( (phone.substr(0,3)!='810') ) if(phone.length!=11){ errMsg += err;} } } if(!email.length){ errMsg += 'Введите EMail!
\n'; } else{ if(!this.checkEMail(email)){ errMsg += 'EMail введён некорректно!!
\n'; } } if( name.length==0 ){ errMsg += 'Введите имя/фамилию!
\n'; } if( this.cityrq && city.length==0 ){ errMsg += 'Введите город!
\n'; } if(errMsg != ''){ this.alert(errMsg); return false; } var options = []; var sOption = ''; for(var o=0; o'+op.name+(cnt>1?' x '+cnt:'')+' = '+op.amount+thisObj.money.code+''); } } this.descr = '

Детали бронирования: '+this.getLegendFull()+'

'; this.descr += (sOption!=''?'
Дополнительно:'+sOption:''); this.descr += '

Сумма: '+this.total+' '+this.money.code+'

'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5_booking_descr').innerHTML = this.descr; let customer_id = 0; if(this.customer) customer_id = this.customer.id; var sds = this.descr; var spost = 'fname='+fname +'&lname='+lname +'&phone='+phone +'&email='+email +'&city='+city +'&customerid='+customer_id +'&parentid='+this.parentid +'&comment='+comment +'&amount='+(this.total*100) +'&price='+(this.curVar.amount*100) +'&objid='+this.curVar.ID +'&options='+JSON.stringify(options) +'&tariffid='+this.curVar.objTariff.OFFERID +'&cntperson='+document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person').value +'&dtstart='+this.dtHour.getDate().toGermanStr()+' '+this.tmHour.getTimeStart() +'&dtend='+this.dtHour.getDate().toGermanStr()+' '+this.tmHour.getTimeEnd(); if(this.multyselect) spost += '&multy=1'+'&prices='+this.curVar.price; this.toYandex('cloffHotel_booking'); this.toGoogle('cloffHotel_booking'); this.callajax( this.host+'/widget/rent.save.rs.php?aj=1', spost, function(param){ if(param.errcode){ thisObj.alert(param.errmsg); return false; } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5_bookingid').innerHTML = param.bookingID; thisObj.bookingID = param.bookingID; thisObj.toStep5(); thisObj.bookingID = 0; //если была оплата! if( cl_hotel3682.ispay ){ if(param.payURL){ //если не сработает перевод - то вручную! document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5_pay').style.display = ''; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5_pay_lnk').href = param.payURL; //сохраним в кукисе данные букина thisObj.setCookie('bookingID', param.bookingID, 1); thisObj.setCookie('bookingDescr', sds, 1); document.location.href = param.payURL; if(thisObj.isvkwidget || window.isvkwidget || isvkwidget) { var str = param.payURL; var arr = str.split('?'); document.getElementById('CLOFF_HOTEL_WIDGET_URL').action = arr[0]; var params = arr[1].split('&'); var frm = document.getElementById('CLOFF_HOTEL_WIDGET_URL'); for(var i=0;i=0 ){ roompay = this.arrTypes[ this.curVar.arrRooms[r].typeid].val; } this.prepay += (roompay * this.curVar.arrRooms[r].cnt); } } else if(cl_hotel3682.prepaytype == 3){ //стоимость дней проживания //если в типах прописаны "исключения" то берём максимум var ppdays = cl_hotel3682.prepayval; for(var r=0; r=0 && this.arrTypes[ this.curVar.arrRooms[r].typeid].val>ppdays ){ ppdays = this.arrTypes[ this.curVar.arrRooms[r].typeid].val; } } //делим сумму проживания на количество ночей this.prepay = (this.curVar.amount/Math.max(1, this.cntday))*ppdays; } else{ //процент for(var r=0; r=0 ){ roompercent = this.arrTypes[ this.curVar.arrRooms[r].typeid].val/100; } this.prepay += (this.curVar.arrRooms[r].amount * roompercent * this.curVar.arrRooms[r].cnt); } //и для опций/сервисов this.prepay += (cl_hotel3682.prepayval/100 * (aopt+asrv)); } //document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_paysum').innerHTML = this.prepay; } */ //легенда document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step3_legend').innerHTML = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step4_legend').innerHTML = this.getLegendFull(); //document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_total5').innerHTML = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_total4').innerHTML = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_total3').innerHTML = this.total+' '+this.money.code; }; //END reCalc /* //прорисовка услуг/опций jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.getServiceItem = function(s){ return this.getSrvOptItem(s, 'service'); }; jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.getOptionItem = function(s){ return this.getSrvOptItem(s, 'option'); }; */ jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.getSrvOptItem = function(so, name){ var vSEl = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_service_tpl').cloneNode(true); var res = /SRVID/gi; var re = /SONAME/gi; var thisObj = this; vSEl.id = 'cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_'+name+'_'+so.id; vSEl.innerHTML = vSEl.innerHTML.replace(res, so.id).replace(re, name); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_tpl_place').appendChild(vSEl); document.getElementById(vSEl.id+'_chb').isrequired = so.isrequired; document.getElementById(vSEl.id+'_chb').onclick = function(){ if(this.isrequired) { this.checked = true; thisObj.mapAdd[name][so.id].checked = this.checked; return false; } thisObj.mapAdd[name][so.id].checked = this.checked; thisObj.reCalc(); }; document.getElementById(vSEl.id+'_name').innerHTML = so.name; document.getElementById(vSEl.id+'_amount').innerHTML = so.price+' '+this.money.code; if(so.ispersonal == 1) document.getElementById(vSEl.id+'_amount').innerHTML += '/чел.'; document.getElementById(vSEl.id+'_count').value = ( thisObj.mapAdd[name][so.id].cht ? thisObj.mapAdd[name][so.id].cht: 1); document.getElementById(vSEl.id+'_count').onchange = function(){ thisObj.mapAdd[name][so.id].cht = this.value; thisObj.reCalc(); }; /* document.getElementById(vSEl.id+'_count').max = so.maxcnt; if(so.maxcnt == 1){ document.getElementById(vSEl.id+'_count').disabled = true;; this.jscClassAdd(document.getElementById(vSEl.id+'_count'), 'clh_widget_inactive'); } if(so.isrequired){ document.getElementById(vSEl.id+'_chb').checked = 1; document.getElementById(vSEl.id+'_chb').readOnly = true; this.mapAdd[name][so.id].checked = this.checked; } */ document.getElementById(vSEl.id+'_chb').parentNode.title = so.descr; //если было помечено пометим снова if(this.mapAdd[name][so.id].checked){ document.getElementById(vSEl.id+'_chb').checked = 1; } return vSEl; } //END getSrvOptItem //прорисовка варианта заселения jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.getVarItem = function(v,full){ var thisObj = this; var re = /VARID/gi; var rer = /ROOMID/gi; var ret = /TARIFFID/gi; var man = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_man_tpl'); if(v.isPromoCode) this.ispromo = 1; //клонируем шаблон var vEl = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_VAR_TPL').cloneNode(true); vEl.id = 'cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID; vEl.innerHTML = vEl.innerHTML.replace(re, v.ID); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_VAR_TPL').parentNode.appendChild(vEl); //заполним комнаты var vElRoom = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_room_tpl').cloneNode(true); vElRoom.id = 'cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_obj'; vElRoom.innerHTML = vElRoom.innerHTML.replace(re, v.ID).replace(rer, v.ID); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_rooms').appendChild(vElRoom); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_room_'+v.ID+'_info').innerHTML = v.NAME; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_room_'+v.ID+'_amount').innerHTML = -1; //человечки document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_room_'+v.ID+'_bads').innerHTML = (parseInt(v.OCCUPANCY,10)+parseInt(v.ADVOCCUPANCY,10))+' чел'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_room_'+v.ID+'_bads').title = 'Максимальная вместимость'; if(!full) //заполним тарифы for(var t=(v.offers.length-1); t>=0; t--){ var tar = v.offers[t]; var vElTariff = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_tariff_tpl').cloneNode(true); vElTariff.id = 'cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_'+tar.OFFERID; vElTariff.innerHTML = vElTariff.innerHTML.replace(re, v.ID).replace(ret, tar.OFFERID); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariffs').appendChild(vElTariff); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_'+tar.OFFERID+'_name').innerHTML = tar.NAME; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_'+tar.OFFERID+'_total').innerHTML = (tar.PRICE/100)+' '+this.money.code; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_'+tar.OFFERID+'_button').innerHTML = ( (v.isOverbooking)? cl_hotel3682.btoverbooking : cl_hotel3682.btbooking); if(this.multyselect) { document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_'+tar.OFFERID+'_button').innerHTML = 'Выбрать'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2_sum').classList.remove('hide'); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2_book').onclick = function() { var sm = 0; var cnt = 0; var ids = ''; var ofs = ''; var prices = ''; var pers = 0; for(var v in thisObj.selVars) { if(!thisObj.selVars.hasOwnProperty(v)) continue; sm+=thisObj.selVars[v].price; cnt++; if(ids!='') ids+=';'; if(ofs!='') ofs+=';'; if(prices!='') prices+=';'; ids+=v; ofs+=thisObj.selVars[v].offer; prices+=thisObj.selVars[v].price*100; pers+=thisObj.selVars[v].occupancy; } if(!cnt) { thisObj.alert('Выберите объекты для бронирования.'); return false; } if(pers document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_person').value) && (selobj.cnt>1)) thisObj.alert('Вы выбрали больше объектов, чем требуется для размещения всех персон.'); } else { thisObj.curVar = y; thisObj.curVar.amount = x.PRICE/100; //пропишем стоимость из выбранного тарифа thisObj.tariffId = x.OFFERID; thisObj.curVar.objTariff = x; //пересчитаем цену thisObj.toStep3(); } } })(tar, v); }//заполним тарифы else { var vElTariff = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_tariff_tpl').cloneNode(true); vElTariff.id = 'cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_full'; vElTariff.innerHTML = vElTariff.innerHTML.replace(re, v.ID).replace(ret, 0); vElTariff.querySelector('.clh_room_sum').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariffs').appendChild(vElTariff); document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_0_name').innerHTML = ''; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_0_total').innerHTML = ''; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_0_button').innerHTML = 'Подобрать время'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_var_'+v.ID+'_tariff_0_button').onclick = (function (y) { return function() { thisObj.curVar = y; thisObj.curVar.amount = 0; //пропишем стоимость из выбранного тарифа thisObj.tariffId = -1; thisObj.tmSelect.button = this; thisObj.tmSelect.init(y.blocks); thisObj.tmSelect.show(); } })(v); } return vEl.parentNode.removeChild(vEl); }; //END getVarItem /* //Проигрыватель галлереи jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.playGallery = function(arrImgs, room_descr){ var cur = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_current'); cur.innerHTML = ''; var sto = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_storage'); sto.innerHTML = ''; var src = ''; for(var k in arrImgs){ var el = document.createElement('DIV'); if(!arrImgs[k].storageid){ arrImgs.splice(k,1); continue; } el.className = 'clh_gallery_pic'; src =''+this.host+'/getimg.php?f='+arrImgs[k].storageid+'&p='+arrImgs[k].md; el.style.backgroundImage = 'url(\''+src+'\')'; sto.appendChild(el); if(!room_descr) room_descr = arrImgs[k].descr; } if( room_descr && room_descr.length>1){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_description').style.display = 'flex'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_description').innerHTML = room_descr; } else{ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_description').style.display = 'none'; } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery').style.display = 'flex'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_close').onclick = function(){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery').style.display = 'none'; }; var jfNextImg = function(){ var ci = cur.firstChild; if(ci){ cur.removeChild(cur.firstChild); sto.insertBefore(ci,sto.lastChild.nextSibling); } cur.appendChild(sto.removeChild(sto.firstChild)); } var jfPrevImg = function(){ var ci = cur.firstChild; if(ci){ cur.removeChild(cur.firstChild); sto.insertBefore(ci,sto.firstChild); } cur.appendChild(sto.removeChild(sto.lastChild)); } jfNextImg(); if(arrImgs.length>1){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_next').style.visibility = 'visible'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_prev').style.visibility = 'visible'; } else{ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_next').style.visibility = 'hidden'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_prev').style.visibility = 'hidden'; } document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_next').onclick = function(){ jfNextImg(); }; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_gallery_photo_prev').onclick = function(){ jfPrevImg(); }; } //END playGallery //дети jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.changeChild = function(){ var cnt = this.cntC.value; if(cnt>0){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_line').style.display = 'flex'; } else{ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_childs_line').style.display = 'none'; } var chd; for(var c=1; c<5; c++){ chd = document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_sel_'+c); if(c<=cnt){ chd.disabled = false; this.jscClassRemove(chd,'clh_widget_inactive'); } else{ chd.disabled = true; this.jscClassAdd(chd,'clh_widget_inactive'); } } }; */ //закрытие формы jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.closeform = function(){ document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step2').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step3').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step4').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3_step5').style.display = 'none'; if(this.staticForm) return; //статическую форму не закрыть! this.formScreen.style.display = 'none'; this.wrapper.style.display = 'none'; } //END closeform //если форма - то надо при ресайзе "подкручивать" класс jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.resize = function(){ var contW = this.formContainer.clientWidth; var className = 'LINE'; for(var k in this.sizes){ if( this.sizes[k].w>=contW ){ className = this.sizes[k].cl; } } if(!this.staticForm){ className += ' clh_window' } else{ this.jscClassAdd(this.formContainer, 'CL_WDT_HOUR'); } this.formScreen.className = '.CL_WDT_HOUR clh_widget '+className; }; //грузим полную занятость временных интервалов за несколько дней jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3.prototype.loadOccupancy = function() { var thisObj = this; var spost = 'dtfrom=' + this.dtHour.getDate().toGermanStr() + '&tmfrom=' + this.tmHour.tmstart + '&tmto=' + this.tmHour.tmend + '&interval=' + this.tmHour.step+ '&pass='+ parseInt(cl_hotel3682.intpass,10); //отправляем на сервер this.callajax( thisObj.host+'/widget/rent.occupancy.rs.php?aj=1', spost, function(param){ for(var i=0;i=thisObj.max) thisObj.widget.jscClassAdd( thisObj.elAdd, 'clh_widget_inactive'); else thisObj.widget.jscClassRemove( thisObj.elAdd, 'clh_widget_inactive'); } var decrement = function(){ thisObj.cnt = Math.max(thisObj.cnt-1, thisObj.min); thisObj.setCount(); }; var increment = function(){ thisObj.cnt = Math.min(thisObj.cnt+1, thisObj.max); thisObj.setCount(); }; this.elDel.onclick = decrement; this.elAdd.onclick = increment; reButton(); this.setCount(true); } */ var cl_hotel3682 = { name:'Зоогостиница \"Территория заботы\"' , lat:'55.461391' , lng:'37.236889' , address:'поселение Краснопахорское, вблизи д. Поляны' , descr:'' , minnum:2 , maxnum:3 , mind:3 , maxd:90 , maxadt:3 , maxchd:2 , childmax:18 , infantmax:0 , gallery: 1 , btbooking: 'Бронировать' , btoverbooking: 'Оставить заявку' , staticForm: 0 , bookstart: '2021-08-01' , bookend: '' , ispay: 5 , paysum: 1 , prepaytype: 2 , prepayval: 20 , money: {"id":"1","idDict":"307","idGroup":"0","order":"0","name":"\u0420\u0443\u0431\u043b\u044c","code":"\u0440.","descr":"\u0440\u0443\u0431.","isHide":"0","isProtect":"0","flag":"0"} , cityrq: 0 , selbed: 1 , islc:0 , interval:'30' , tmstart:'0' , tmnow: '407' , tmend:'1440' , isnotstep3:0 , bedsdef:3 , rentmulty:1 , isnotchilds:1 , isalterperson:1 , alterpersonstr:'Животных;Животных;Животных' , novariant:'Нет подходящих вариантов на указанные даты' , antibrand: 0 , intpass: 0 , intone: 0}; //document.write(' calend CLOFF_logo_ext guest bed_double bed_two chevron_left chevron_right chevron_right_w caret_up quest_circle_solid clock '); var staticForm588f707ded5756c148a5c943f7c1e3e3 = 0; var sc = document.createElement('script'); sc.type = 'text/javascript'; sc.src = 'https://30589.cloff.ru/js/wdt.js?v=599'; sc.charset = 'UTF-8'; var hd = document.getElementsByTagName("HEAD"); hd.item(0).appendChild(sc); var wdiv588f707ded5756c148a5c943f7c1e3e3 = document.createElement('DIV'); wdiv588f707ded5756c148a5c943f7c1e3e3.id = 'AAA_588f707ded5756c148a5c943f7c1e3e3'; if(document.body) document.body.appendChild(wdiv588f707ded5756c148a5c943f7c1e3e3); else document.head.appendChild(wdiv588f707ded5756c148a5c943f7c1e3e3); var scontent588f707ded5756c148a5c943f7c1e3e3 = ' calend CLOFF_logo_ext guest bed_double bed_two chevron_left chevron_right chevron_right_w caret_up quest_circle_solid clock ';//document.getElementById('cl_hotel_booking_widget_588f707ded5756c148a5c943f7c1e3e3').innerHTML; wdiv588f707ded5756c148a5c943f7c1e3e3.innerHTML = scontent588f707ded5756c148a5c943f7c1e3e3; var clW_588f707ded5756c148a5c943f7c1e3e3; sc.onload = function(){ clW_588f707ded5756c148a5c943f7c1e3e3 = new jcClWidgetBooking588f707ded5756c148a5c943f7c1e3e3({ hash:'588f707ded5756c148a5c943f7c1e3e3', wid:3682, content:scontent588f707ded5756c148a5c943f7c1e3e3, host:'https://30589.cloff.ru/', staticForm: staticForm588f707ded5756c148a5c943f7c1e3e3 }); }