//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'] ){ function jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f(param) { jcClWidgetBase.apply(this, arguments); var thisObj = this; //this.content = param.content; this.onopenform = function() { }; this.oncloseform = function() { thisObj.resetAll(); }; this.onCloseCallBack = false; this.host = param.host; this.dtStart = false; this.dtEnd = false; this.curVar = false; this.arrService = []; this.arrOption = []; this.mapAdd = {}; this.total; this.bedType = 2; this.chBedType = false; this.bookingID = 0; this.cntAdt = 2; this.cntChild = 0; this.cntInfants = 0; this.descr = ''; this.prepay = 0; this.hash = '33fdae1928e3a966fa0096cdaf945b9f'; this.varDescr = false; this.initChilds = false; this.tariffId = ''; this.addPrice = 0; //сумма услуг и опций this.sizes = [ {w:1199, cl: 'LG'}, {w:991, cl: 'MD'}, {w:767, cl: 'SM'}, {w:575, cl: 'XS'}, ]; this.childmax = cl_hotel4742.childmax; this.infantmax = cl_hotel4742.infantmax; this.cityrq = cl_hotel4742.cityrq; this.selbed = cl_hotel4742.selbed; this.cntGuests = 4; this.frm = false; this.ispromo = 1; this.promocode = ''; this.cntday = 1; this.SUTKI = 24*3600*1000; this.bookend = ( cl_hotel4742&&cl_hotel4742.bookend ? cl_hotel4742.bookend: ''); this.bookstart = ( cl_hotel4742&&cl_hotel4742.bookstart ? cl_hotel4742.bookstart: ''); this.currency = cl_hotel4742&&cl_hotel4742.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_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert_msg').innerHTML = msg; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert').classList.remove('hide'); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert').style.display = 'block' document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert_close_x').onclick = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert_close').onclick = function() { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert').classList.add('hide'); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert').style.display = 'none' }; }; //пересадим наши окна в боди document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert')) ); //document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step1').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step1')) ); //document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step2').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step2')) ); //document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step3').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step3')) ); //document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step4').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step4')) ); //document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5')) ); document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery')) ); document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist')) ); document.body.appendChild( document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv')) ); //работа с куками 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_hotel4742.maxchd>4) ){ //много через SELECT document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_del').onclick = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_del').onclick = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_add').onclick = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_add').onclick = function(e){ switch (this.id.substr(-10)) { case 'adults_del' : thisObj.cntA.value = Math.max(1, parseInt(thisObj.cntA.value,10)-1 ); break; case 'adults_add' : thisObj.cntA.value = Math.min(cl_hotel4742.maxadt, parseInt(thisObj.cntA.value,10)+1 ); break; case 'childs_del' : thisObj.cntC.value = Math.max(0, parseInt(thisObj.cntC.value,10)-1 ); thisObj.changeChild(); break; case 'childs_add' : thisObj.cntC.value = Math.min(cl_hotel4742.maxchd, parseInt(thisObj.cntC.value,10)+1 ); thisObj.changeChild(); break; } } this.cntA = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults'); this.cntA.onchange = function(obj){ thisObj.freeVars(); } this.cntC = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs'); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_cont').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_cont').style.display = 'none'; } else{ //мало "человечки" this.cntA = new clMans({ input: document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults') , elem : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_span') , del : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_del') , add : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_add') , container : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_cont') , classOn : 'cl_wdt_i_primary' , classOff : 'cl_wdt_i_primary cl_wdt_i_disabled' , cnt : this.cntAdt , min: 1 , max: cl_hotel4742.maxadt , widget : this , onChange: function(obj){ thisObj.freeVars(); } }); this.cntC = new clMans({ input: document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs') , elem : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_span') , del : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_del') , add : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_add') , container : document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_cont') , classOn : 'cl_wdt_i_primary' , classOff : 'cl_wdt_i_primary cl_wdt_i_disabled' , cnt : (this.cntChild+this.cntInfants) , min: 0 , max: cl_hotel4742.maxchd , widget : this , onChange: function(){ thisObj.cntC.onchange(); } }); //спрячем количества document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs').style.display = 'none'; } //спрячем количества document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_adults_span').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_span').style.display = 'none'; this.cntC.onchange = function(){ //console.log('thisObj.cntC.onchange'); thisObj.changeChild(); }; thisObj.changeChild(); //дети var sChildAges = ''; for(var ca=0; ca<=cl_hotel4742.childmax; ca++) sChildAges += (''); for(var c=1; c<5; c++){ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_sel_'+c).innerHTML = sChildAges; } //ENDдети //END гости 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); }; this.booking_init(); //flags var items = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').querySelectorAll('.clcb-flag-item'); for(var i=0;i57) && (e.keyCode<96)) return false; if((e.keyCode==32) || (e.keyCode>105)) return false; if(e.altKey || e.ctrlKey || e.shiftKey) return false; return true; } if(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())) { setTimeout(function(){thisObj.setPhonePattern(thisElem,e);},10); return true; } if((e.keyCode>57) && (e.keyCode<96)) return false; if((e.keyCode==32) || (e.keyCode>105)) return false; if(e.altKey || e.ctrlKey || e.shiftKey) return false; setTimeout(function(){thisObj.setPhonePattern(thisElem,e);},10); } //date pattern this.dtPatternFunc = function(e) { var thisElem = this; e = e || event; if (e.which!=0 && e.charCode!=0) e.keyCode = event.which; if(/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())) { setTimeout(function(){thisObj.setDatePattern(thisElem,e);},10); return true; } if((e.keyCode>57) && (e.keyCode<96)) return false; if((e.keyCode==32) || (e.keyCode>105)) return false; if(e.altKey || e.ctrlKey || e.shiftKey) return false; setTimeout(function(){thisObj.setDatePattern(thisElem,e);},10); } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_birthday').onkeydown = this.dtPatternFunc; //guest this.guestId = 1; this.guestCnt = 1; this.guestCurrent = ''; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_btn_addguest').onclick = function() { thisObj.addGuest(); } // document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_timein').value = cl_hotel4742.checkin; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_timeout').value = cl_hotel4742.checkout; var tmin = ('0'+cl_hotel4742.checkin).substr(-2,2)+':00'; var tmout = ('0'+cl_hotel4742.checkout).substr(-2,2)+':00'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_time_text').innerHTML = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_time_text').innerHTML.replace('CHECKIN',tmin); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_time_text').innerHTML = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_time_text').innerHTML.replace('CHECKOUT',tmout); // document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step2_promo_start').onclick = function() { var divs = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step2_promo').querySelectorAll('div'); for(d in divs) { if(!divs.hasOwnProperty(d)) continue; divs[d].style.display = 'block'; } this.style.display = 'none'; return false; } if(cl_hotel4742.cityrq == 0) document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_city_lbl').innerHTML = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_city_lbl').innerHTML.replace('*',''); this.mapRoomIcon = { 'widget_icon_bar':'wine_bottle_solid', 'widget_icon_climat':'air_conder', 'widget_icon_safe':'safe', 'widget_icon_sofa':'couch', 'widget_icon_wifi':'wifi', 'widget_icon_pet':'pet_paw', 'widget_icon_bestseller':'medal', 'widget_icon_house':'house', 'widget_icon_shower':'shower', 'widget_icon_bigbed':'bed_king_size', //для животных 'widget_icon_pet_1':'pet_1', 'widget_icon_pet_2':'pet_2', 'widget_icon_pet_3':'pet_3', 'widget_icon_pet_4':'pet_4', 'widget_icon_pet_5':'pet_5', 'widget_icon_pet_6':'pet_6', 'widget_icon_pet_7':'pet_7', 'widget_icon_pet_8':'pet_8', 'widget_icon_pet_9':'pet_9', 'widget_icon_pet_10':'pet_10', 'widget_icon_pet_11':'pet_11', 'widget_icon_pet_12':'pet_12', 'widget_icon_pet_13':'pet_13', 'widget_icon_pet_14':'pet_14', 'widget_icon_pet_15':'pet_15', 'widget_icon_pet_16':'pet_16', 'widget_icon_pet_17':'pet_17', 'widget_icon_pet_18':'pet_18', 'widget_icon_pet_19':'pet_19', 'widget_icon_pet_20':'pet_20', 'widget_icon_pet_21':'pet_21', 'widget_icon_pet_22':'pet_22', 'widget_icon_pet_23':'pet_23' } this.mapRoomIcon['widget_icon_wifi'] = 'wifi'; this.mapRoomIcon['widget_icon_bar'] = 'wine_bottle_solid'; this.mapRoomIcon['widget_icon_sofa'] = 'couch'; this.mapRoomIcon['widget_icon_bigbed'] = 'bed_king_size'; this.mapRoomIcon['widget_icon_pet'] = 'pet_paw'; this.mapRoomIcon['widget_icon_climat'] = 'temp_snow'; this.mapRoomIcon['widget_icon_shower'] = 'shower'; this.mapRoomIcon['widget_icon_wc'] = 'wc'; this.mapRoomIcon['widget_icon_house'] = 'house'; this.mapRoomIcon['widget_icon_safe'] = 'safe'; this.mapRoomIcon['widget_icon_parking'] = 'parking'; this.mapRoomIcon['widget_icon_teapot'] = 'teapot'; this.mapRoomIcon['widget_icon_clotheswashing'] = 'clotheswashing'; this.mapRoomIcon['widget_icon_clothes_dryer'] = 'clothes_dryer'; this.mapRoomIcon['widget_icon_fan'] = 'fan'; this.mapRoomIcon['widget_icon_dishwashing'] = 'dishwashing'; this.mapRoomIcon['widget_icon_water'] = 'water'; this.mapRoomIcon['widget_icon_trees'] = 'trees'; this.mapRoomIcon['widget_icon_bathrobe'] = 'bathrobe'; this.mapRoomIcon['widget_icon_slippers'] = 'slippers'; this.mapRoomIcon['widget_icon_water_ladder'] = 'water_ladder'; this.mapRoomIcon['widget_icon_eatery'] = 'eatery'; //политика if(cl_hotel4742.policydef == 1) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_policy').checked = false; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_offerdoc').checked = false; } if(cl_hotel4742.policyurl != '') document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_policy_url').href = cl_hotel4742.policyurl; this.offerdoc = false; if(cl_hotel4742.offerdocurl != '') { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_offerdoc_url').href = cl_hotel4742.offerdocurl; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_offerdoc').parentNode.classList.remove('hide'); this.offerdoc = true; } this.offeroption = {}; this.offerservice = {}; //скрытие брендирования if(cl_hotel4742.antibrand == 1) { var rd = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_rights').querySelectorAll('div'); rd[0].style.visibility = 'hidden'; rd[1].style.visibility = 'hidden'; rd = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_rights2').querySelectorAll('div'); rd[0].style.visibility = 'hidden'; rd[1].style.visibility = 'hidden'; rd = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_rights3').querySelectorAll('div'); rd[0].style.visibility = 'hidden'; rd[1].style.visibility = 'hidden'; rd = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_rights4').querySelectorAll('div'); rd[0].style.visibility = 'hidden'; rd[1].style.visibility = 'hidden'; rd = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_rights5').querySelectorAll('div'); rd[0].style.visibility = 'hidden'; rd[1].style.visibility = 'hidden'; rd = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_rights6').querySelectorAll('div'); rd[0].style.visibility = 'hidden'; rd[1].style.visibility = 'hidden'; } } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype = Object.create(jcClWidgetBase.prototype); jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.opencnt = 0; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.openform = function( ID_CONTAINER, e ){ if(window.clW_33fdae1928e3a966fa0096cdaf945b9f){ jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.opencnt = 0; clW_33fdae1928e3a966fa0096cdaf945b9f.openform( ID_CONTAINER, e ); } else{ setTimeout( function(){ if(jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.opencnt<10){ jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.opencnt++; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.openform( ID_CONTAINER, e ); } },500); } }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.booking_init = function(){ //проверим если возврат с оплаты прорисуем итог и почистим кукисе var bookingID = parseInt( this.getCookie('bookingID'), 10); if(bookingID>0){ this.bookingID = bookingID; var contact = this.getCookie('bookingDescr').split(','); this.form_email = contact[0]; this.form_fullphone = contact[1]; this.setCookie('bookingID', 0, 1/24/3600); this.setCookie('bookingDescr', '', 1/24/3600); this.toStep6(); } }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.openform = function( ID_CONTAINER, e ) { if(ID_CONTAINER && document.getElementById(ID_CONTAINER) ){ this.formContainer = document.getElementById(ID_CONTAINER); this.formContainer.innerHTML = ''; } else return false; //!!!!! this.formContainer.appendChild( this.formScreen.parentNode.removeChild(this.formScreen) ); this.formScreen.style.display = 'flex'; //убираем крестик document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_close1').style.display = 'none'; /* if(!document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_styleZ')){ var s = document.createElement('STYLE'); s.id = 'cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_styleZ'; document.body.appendChild(s); } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_styleZ').innerHTML = '#cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_wnd_alert, ' +'#cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery, ' +'.cl_wdt_33fdae1928e3a966fa0096cdaf945b9f.cl_calendar { --z-index: '+this.zIndex+'; }'; */ this.resize(); this.dtOnChange(); if(cl_hotel4742.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_hbw_33fdae1928e3a966fa0096cdaf945b9f_lc_button')) document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_lc_button').style.display = 'none'; } },600); } }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.dtOnChange = function(){ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step1_legend').innerHTML = this.getLegend(); }; //сложим легенду jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.getLegend = function(){ return this.dtEnd.getLegend( this.dtStart.dt1, this.dtEnd.dt1, true); }; //дети jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.changeChild = function(){ var cnt = this.cntC.value; if(cnt>0){ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_line').style.display = 'flex'; } else{ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_childs_line').style.display = 'none'; } var chd; for(var c=1; c<5; c++){ chd = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_sel_'+c); if(c<=cnt){ chd.disabled = false; chd.classList.remove('disabled'); } else{ chd.disabled = true; chd.classList.add('disabled'); } } }; //закрытие формы jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.closeform = function(){ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step1').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step2').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step3').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step4').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5').style.display = 'none'; //window.scroll(0,0); setTimeout(function() { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f').parentNode.scrollIntoView(); //var yy = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f').getBoundingClientRect().top + window.pageYOffset; //window.scroll(0,yy); },100); if(this.onCloseCallBack) this.onCloseCallBack(); } //END closeform //если форма - то надо при ресайзе "подкручивать" класс jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.resize = function(){ var contW = this.formContainer.clientWidth; var className = 'XL'; for(var k in this.sizes){ if( this.sizes[k].w>=contW ){ className = this.sizes[k].cl; } } if(!this.staticForm){ className += ' clh_window' } this.formScreen.className = 'clh_widget '+className; }; //загрузка вариантов jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.loadVars = function() { var msg = ''; //сообщение об ошибке //собираем / проверяем даты var dts = this.dtStart.toCLStr(); if(!dts){ msg += ( msg==''?'':'
'); msg += 'Выберите дату заезда.'; } var dte = this.dtEnd.toCLStr(); if(!dte){ msg += ( msg==''?'':'
'); msg += 'Выберите дату отъезда.'; } if(this.bookend != '') { var bookend = new Date( Date.parse(this.bookend) ); if(bookend'); msg += 'Бронирование доступно только до '+this.toGermanString(bookend); } } var hds = new Date( this.bookstart ); var cds = new Date( this.toJapanString(this.dtStart.dt1) ); if(hds>cds){ msg += ( msg==''?'':'
'); msg += 'Бронирование доступно только с '+this.toGermanString(hds); } this.cntday = Math.ceil((this.dtEnd.dt1-this.dtStart.dt1)/this.SUTKI); if(dts>=dte){ msg += ( msg==''?'':'
'); msg += 'Период бронирования выбран не корректно.'; } else { if(cl_hotel4742.mind>this.cntday){ msg += ( msg==''?'':'
'); msg += 'Минимальный период бронирования составляет '+cl_hotel4742.mind+' '+this.jscCntRus(cl_hotel4742.mind, 'сутки', 'суток', 'суток'); } if(cl_hotel4742.maxd'); msg += 'Максимальный период бронирования составляет '+cl_hotel4742.maxd+' '+this.jscCntRus(cl_hotel4742.maxd, 'сутки', 'суток', 'суток'); } } //END собираем / проверяем даты var adt = this.cntA.value; //дети var ch = this.cntC.value; if(ch<0){ msg += ( msg==''?'':'
'); msg += 'Количество детей введено не верно.'; } if(!ch) ch=0; var childs = 0; //детей var infants = 0; //младенцев var achilds = ''; if(ch < 5){ //возраст детей проверяем только если их мало for(k=1; k<=ch; k++){ var age = parseInt(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_sel_'+k).value,10); if(age<0){ msg += ( msg==''?'':'
'); msg += 'Введите возраст '; switch(k){ case 1 : msg += 'первого'; break; case 2 : msg += 'второго'; break; case 3 : msg += 'третьего'; break; case 4 : msg += 'четвёртого'; break; case 5 : msg += 'пятого'; break; default : msg += (''+k+'го'); break; } msg += ' ребёнка.\n'; } else{ if((age>this.infantmax) || ((cl_hotel4742.infantcount>0) && (infants>=cl_hotel4742.infantcount))) { childs++ } else{ infants++; } achilds += ('&arrch['+k+']='+age); } } } //END дети //Если ошибка выводим и выходим! if(msg!=''){ this.alert(msg); return; } this.cntAdt = parseInt(adt,10); this.cntChild = parseInt(childs,10); this.cntInfants = parseInt(infants,10); var thisObj = this; //формируем данные var spost = 'wv=2&dts='+dts+'&dte='+dte+'&cntadlt='+adt+'&ssid='+this.ssid; if(ch>0) spost += ('&cntinfant='+infants+'&cntchild='+childs+achilds); //промо this.promocode = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step2_promo_input').value; spost += ('&promocode='+this.promocode); this.store_spost = 'dts='+dts+'&dte='+dte+'&promocode='+this.promocode; //отправляем на сервер this.callajax( thisObj.host+'/widget/booking.start.rs.php?aj=1', spost, function(param){ //console.log('33fdae1928e3a966fa0096cdaf945b9f', param); if(parseInt(param.errcode,10)>0){ if(parseInt(param.errcode,10) == 777) { thisObj.alert('Минимальный период бронирования '+cl_hotel4742.mind+' суток'); return; } if(param.errmsg){ thisObj.alert(param.errmsg); return; } } //есть ли варианты if(param.arrvariant.length==0){ thisObj.alert(cl_hotel4742.novariant); return; } thisObj.arrVars = param.arrvariant; thisObj.arrService = param.arrservice; thisObj.arrOption = param.arroption; thisObj.mapExt = param.arrext; thisObj.mapAdd = {}; thisObj.mapAdd['service']= {}; thisObj.mapAdd['option']= {}; for(var k in thisObj.arrService){ thisObj.mapAdd['service'][thisObj.arrService[k].id] = thisObj.arrService[k]; } /* for(k in thisObj.arrOption){ thisObj.mapAdd['option'][thisObj.arrOption[k].id] = thisObj.arrOption[k]; } */ thisObj.arrTypes = param.arrtypes; thisObj.arrImgs = (param.arrimgs ? param.arrimgs: []); if(param.ssid) { var date = new Date((new Date()).getTime()+30*60*1000); thisObj.ssid = param.ssid; thisObj.setcookie('cl_ssid', param.ssid, {expires : date.toUTCString()}); } thisObj.toStep2(); }, true); } //Открываем окно с вариантами заселения jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.toStep2 = function(){ this.closeform(); var thisObj = this; //рисуем варианты //console.log('thisObj.arrVars', this.arrVars); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step2_variants').innerHTML = ''; for(var k=0; k0){ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_servicelist').appendChild( this.getServiceItem(this.arrService[s],'service') ); cnt++; cntSrv++; } } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_servicelist_currency').innerHTML = this.currency.descr; if(!cntSrv) //нету услуг document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_servicediv').style.display = 'none'; //options cntSrv = 0; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_optionlist').innerHTML = ''; var tp = 0; if(this.curVar.arrRooms.length == 1) tp = this.curVar.arrRooms[0].typeid; for(var op=0; op'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_optionlist').appendChild(div); tp = this.arrOption[op].roomtype; } if(this.arrOption[op].maxcnt>0){ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_optionlist').appendChild( this.getServiceItem(this.arrOption[op],'option') ); cnt++; cntSrv++; } } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_optionlist_currency').innerHTML = this.currency.descr; if(!cntSrv) //нету опций document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_optiondiv').style.display = 'none'; if(!cnt) //нет ни опций ни услуг, проходим экран мимо return this.toStep4(); this.recalcDop(); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step3_currency').innerHTML = this.currency.descr; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step3').style.display = 'flex'; }; //Открываем окно с контактной информацией jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.toStep4 = function() { this.closeform(); var thisObj = this; this.drawLegendDay(4); function getPosition(e){ var left = 0 var top = 0 while (e.offsetParent){ left += e.offsetLeft - e.scrollLeft top += e.offsetTop - e.scrollTop e = e.offsetParent } left += e.offsetLeft - e.scrollLeft top += e.offsetTop - e.scrollTop return {x:left, y:top} } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone_flag').onclick = function(e) { var inp = this.parentNode; var scrollFunc = function() { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').style.top = (getPosition(inp).y + 28) + 'px'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').style.left = (getPosition(inp).x + 0) + 'px'; }; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').style.display='block'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').style.display = 'block'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').onclick = function() { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').style.display='none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').style.display = 'none'; window.removeEventListener('scroll', scrollFunc); } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').style.top = (getPosition(this.parentNode).y + 28) + 'px'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').style.left = (getPosition(this.parentNode).x + 0) + 'px'; window.addEventListener('scroll', scrollFunc); } this.citizenListFunc = function(e) { var inp = this; var scrollFunc = function() { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').style.top = (getPosition(inp).y + 33) + 'px'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').style.left = (getPosition(inp).x - 0) + 'px'; }; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').style.display='block'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').style.display = 'block'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').onclick = function() { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').style.display='none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').style.display = 'none'; window.removeEventListener('scroll', scrollFunc); } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').style.top = (getPosition(this).y + 33) + 'px'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').style.left = (getPosition(this).x - 0) + 'px'; thisObj.guestCurrent = this.id.replace('_div',''); window.addEventListener('scroll', scrollFunc); }; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_citizen_div').onclick = this.citizenListFunc; if((this.cntAdt+this.cntChild+this.cntInfants) == 1) document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_btn_addguest').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step4').style.display = 'flex'; }; //Открываем окно с общим чеком jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.toStep5 = function() { this.closeform(); //legend document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_step5').innerHTML = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_short').innerHTML //tpl document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_check_div').innerHTML = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_check_tpl').innerHTML.replace(/check_tpl/g,'step5'); //rooms var roomtpl = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_room').querySelector('li'); if(this.curVar.arrRooms.length > 1) { for(var i=1;i 0) && (this.curVar.objTariff.overprice != this.curVar.objTariff.amount)) tarifdiscount = '-' + this.curVar.objTariff.discount + '%'; tarif.innerHTML = tarif.innerHTML.replace('TEXT2',tarifdiscount); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_room').appendChild(tarif); roomtpl.innerHTML = roomtpl.innerHTML.replace('TEXT1',this.curVar.arrRooms[0].name); roomtpl.innerHTML = roomtpl.innerHTML.replace('TEXT2',this.curVar.arrRooms[0].cnt+' номер(-а)'); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_room_total').innerHTML = 'Итого за размещение: '+this.curVar.amount+' '+this.currency.descr; //service var srvtpl = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_srv').querySelector('li'); var cnt = 0; var sum = 0; for(var s in this.mapAdd['service']) { if(!this.mapAdd['service'].hasOwnProperty(s)) continue; if(this.mapAdd['service'][s].selected) { cnt++; var srv = srvtpl.cloneNode(true); srv.innerHTML = srv.innerHTML.replace('TEXT1',this.mapAdd['service'][s].name); srv.innerHTML = srv.innerHTML.replace('TEXT2',this.mapAdd['service'][s].selsumma+this.currency.code); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_srv').appendChild(srv); sum += this.mapAdd['service'][s].selsumma; } } if(cnt > 0) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_srv').removeChild(srvtpl); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_srv_total').innerHTML = 'Итого за услуги: '+sum+' '+this.currency.descr; }else { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_srv_label').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_srv').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_srv_total').style.display = 'none'; } //option var opttpl = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_opt').querySelector('li'); cnt = 0; var sumOpt = 0; for(var tp in this.mapAdd['option']) { if(!this.mapAdd['option'].hasOwnProperty(tp)) continue; for(var op in this.mapAdd['option'][tp]) { if(!this.mapAdd['option'][tp].hasOwnProperty(op)) continue; if(this.mapAdd['option'][tp][op].selected) { cnt++; var opt = opttpl.cloneNode(true); var tpinfo = ' (' + this.curVar.mapRooms[tp].name + ')'; if(this.curVar.arrRooms.length == 1) tpinfo = ''; opt.innerHTML = opt.innerHTML.replace('TEXT1',this.mapAdd['option'][tp][op].name + tpinfo); opt.innerHTML = opt.innerHTML.replace('TEXT2',this.mapAdd['option'][tp][op].selsumma+this.currency.code); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_opt').appendChild(opt); sumOpt += this.mapAdd['option'][tp][op].selsumma; } } } if(cnt > 0) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_opt').removeChild(opttpl); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_opt_total').innerHTML = 'Итого дополнительно: '+sumOpt+' '+this.currency.descr; }else { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_opt_label').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_opt').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_opt_total').style.display = 'none'; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_total').innerHTML = 'Сумма всего: '+(this.curVar.amount + sum + sumOpt) + ' ' + this.currency.descr; this.prepay = this.calcPrepay(); if(this.curVar.isOverbooking > 0) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_prepay').innerHTML = 'Предоплата: не требуется'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_btndone').innerHTML = 'Оставить заявку'; } else if(this.prepay > 0) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_prepay').innerHTML = 'Предоплата: '+ this.prepay + ' ' + this.currency.descr; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_btndone').innerHTML = 'Забронировать' + ((cl_hotel4742.ispay > 0)?' и Оплатить':''); } else { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_prepay').innerHTML = 'Предоплата: не требуется'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_btndone').innerHTML = 'Забронировать'; } if((cl_hotel4742.credit_pay) && ((this.curVar.amount + sum + sumOpt) >= cl_hotel4742.credit_minsum)) { var sc = document.createElement('script'); sc.src = 'https://forma.tinkoff.ru/static/onlineScript.js'; document.head.appendChild(sc); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_divcredit').style.display = ''; var thisObj = this; //кредит document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_btncredit').onclick = function(){ thisObj.send(1); } //рассрочка document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5_btncredit0').onclick = function(){ thisObj.send(2); } } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step5').style.display = 'flex'; } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.selectFlag = function(div) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone_flag').querySelector('.clcb-flag').className = div.querySelector('.clcb-flag').className; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone_flag').parentNode.setAttribute('mycode',div.querySelectorAll('span')[1].innerHTML); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone').value = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone').value.replace(/[^0-9]/g,''); //document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_flaglist').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').onclick(); } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.selectFMS = function(div) { document.getElementById(this.guestCurrent).value = div.querySelectorAll('span')[1].innerHTML; //document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_fmslist').style.display = 'none'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_modaldiv').onclick(); document.getElementById(this.guestCurrent).setAttribute('dataid',div.getAttribute('dataid')); } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.getServiceItem = function(data,type) { var thisObj = this; var srvdiv = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_tpl').cloneNode(true); srvdiv.id = 'cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id; srvdiv.innerHTML = srvdiv.innerHTML.replace(/SRVID/gi, data.id); srvdiv.innerHTML = srvdiv.innerHTML.replace(/RTID/gi, (data.roomtype?data.roomtype:0)); srvdiv.innerHTML = srvdiv.innerHTML.replace(/servicetpl_name/gi, data.name); srvdiv.innerHTML = srvdiv.innerHTML.replace(/servicetpl_sum/gi, data.price); srvdiv.innerHTML = srvdiv.innerHTML.replace(/servicetpl_currency/gi, this.currency.descr); srvdiv.innerHTML = srvdiv.innerHTML.replace(/servicetpl_multy/gi, (data.ispersonal==1?'за чел.':'')+(((type=='service') && (data.isonce==0))?' в день':'')); srvdiv.innerHTML = srvdiv.innerHTML.replace(/servicetpl_descr/gi, data.descr); srvdiv.style.display = ''; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_tmp').appendChild(srvdiv); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_btnplus').onclick = (function (srv) { return function() { var inp = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+srv.id+'_'+(srv.roomtype?srv.roomtype:0)+'_cnt'); inp.value = parseInt(inp.value,10) + 1; inp.onchange(); }})(data); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_btnminus').onclick = (function (srv) { return function() { var inp = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+srv.id+'_'+(srv.roomtype?srv.roomtype:0)+'_cnt'); inp.value = parseInt(inp.value,10) - 1; inp.onchange(); }})(data); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_cnt').onchange = (function (objsrv) { return function() { if(parseInt(this.value,10) > parseInt(objsrv.maxcnt,10)) { thisObj.alert('Максимально возможное количество равно '+objsrv.maxcnt); this.value = objsrv.maxcnt; } if(parseInt(this.value,10) < 0) this.value = 0; if(objsrv.isrequired && (parseInt(this.value,10) < parseInt(objsrv.isrequired,10))) { this.value = objsrv.isrequired; thisObj.alert('Услуга является обязательной для выбранного варианта проживания.'); } if(type == 'option') var obj = thisObj.mapAdd[type][objsrv.roomtype][objsrv.id]; else var obj = thisObj.mapAdd[type][objsrv.id]; obj.selected = parseInt(this.value,10); obj.selsumma = parseInt(this.value,10) * (type=='service'?thisObj.calcSrvSum(objsrv):thisObj.calcOptSum(objsrv)); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+objsrv.id+'_'+(objsrv.roomtype?objsrv.roomtype:0)+'_chb').checked = (this.value > 0); if(this.value == 0) document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+objsrv.id+'_'+(objsrv.roomtype?objsrv.roomtype:0)+'_total').innerHTML = '-'; else document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+objsrv.id+'_'+(objsrv.roomtype?objsrv.roomtype:0)+'_total').innerHTML = obj.selsumma+thisObj.currency.code; thisObj.recalcDop(); }})(data); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_chb').onclick = (function (srv) { return function() { var inp = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+srv.id+'_'+(srv.roomtype?srv.roomtype:0)+'_cnt'); if(this.checked) inp.value = 1; else inp.value = 0; inp.onchange(); }})(data); if(type == 'option') var obj = thisObj.mapAdd[type][data.roomtype][data.id]; else var obj = thisObj.mapAdd[type][data.id]; if(obj.selected) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_cnt').value = obj.selected; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_cnt').onchange(); } else if(data.isrequired) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_cnt').value = data.isrequired; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_service_'+data.id+'_'+(data.roomtype?data.roomtype:0)+'_cnt').onchange(); } return srvdiv.parentNode.removeChild(srvdiv); }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.recalcDop = function() { var sum = 0; for(var s in this.mapAdd['service']) { if(!this.mapAdd['service'].hasOwnProperty(s)) continue; if(this.mapAdd['service'][s].selected > 0) sum += this.mapAdd['service'][s].selsumma; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_servicelist_total').innerHTML = sum; this.curVar.srvSum = sum; var sumOp = 0; for(var tp in this.mapAdd['option']) { if(!this.mapAdd['option'].hasOwnProperty(tp)) continue; for(var opt in this.mapAdd['option'][tp]) { if(!this.mapAdd['option'][tp].hasOwnProperty(opt)) continue; if(this.mapAdd['option'][tp][opt].selected > 0) sumOp += this.mapAdd['option'][tp][opt].selsumma; } } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_optionlist_total').innerHTML = sumOp; this.curVar.optSum = sumOp; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step3_total').innerHTML = sumOp + sum + this.curVar.amount; this.recalcTotal(); }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.recalcTotal = function() { var sum = 0; if(this.curVar) { sum = this.curVar.amount; if(this.curVar.srvSum) sum += this.curVar.srvSum; if(this.curVar.optSum) sum += this.curVar.optSum; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_total_sum').innerHTML = sum; this.total = sum; } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.calcSrvSum = function(srv) { var sum = srv.price; if(srv.isonce == 0) sum = sum * this.cntday; if(srv.ispersonal == 1) sum = sum * (this.cntAdt + this.cntChild); return sum; }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.calcOptSum = function(opt) { var sum = opt.price; if(opt.ispersonal == 1) { if(this.curVar.arrRooms.length > 1) //для каждого типа номера отдельные опции sum = sum * this.curVar.mapRooms[opt.roomtype].guest; else sum = sum * (this.cntAdt + this.cntChild); } return sum; }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.drawLegendDay = function(step) { if(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step'+step+'_legeng_after')) { var legend = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend').parentNode.removeChild(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend')); var div = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step'+step+'_legeng_after'); div.parentNode.insertBefore(legend, div); } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_from').innerHTML = this.dtStart.getDate().toGermanStr(); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_to').innerHTML = this.dtEnd.getDate().toGermanStr(); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_days').innerHTML = 1 + this.cntday; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_nights').innerHTML = this.cntday; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_adult').innerHTML = this.cntAdt; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_child').innerHTML = this.cntChild + this.cntInfants; if(this.bedType == 1) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_bedicon').setAttribute("xlink:href", "#bed_double"); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_bedname').innerHTML = 'Совместная'; } else { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_bedicon').setAttribute("xlink:href", "#bed_two"); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_bedname').innerHTML = 'Раздельная'; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_total_currency').innerHTML = this.currency.descr; if(step < 3) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_total').style.display = 'none'; } else { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_daylegend_total').style.display = 'flex'; } this.recalcTotal(); }; jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.getVarItem = function(data){ var vardiv = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_tpl').cloneNode(true); vardiv.id = 'cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid; vardiv.innerHTML = vardiv.innerHTML.replace(/VARID/gi, data.vid); vardiv.style.display = ''; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_tmp').appendChild(vardiv); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_cnt').innerHTML = data.nums + ' номер(-а)'; //document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_prepay').innerHTML = '???'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_arrow').onclick = function() { if(!this.dir) this.dir = 'down'; if(this.dir == 'down') { var div = document.getElementById(this.id.replace('_arrow','')); var rooms = div.querySelectorAll('[tplroot="1"]'); for(var i=0;i 0) addstr = 'и '+data.arrRooms[r].addbads+' человек(-а) на дополнительных местах.'; room.innerHTML = room.innerHTML.replace(/roomtpl_addbeds/gi, addstr); var infantstr = ''; if(cl_hotel4742.infantmax > 0) infantstr = 'Дети до '+cl_hotel4742.infantmax+' лет (включительно) размещаются бесплатно.'; room.innerHTML = room.innerHTML.replace(/roomtpl_infants/gi, infantstr); var descr = ''; if(this.mapExt[data.arrRooms[r].typeid] && this.mapExt[data.arrRooms[r].typeid]['widget_descr']) descr = this.mapExt[data.arrRooms[r].typeid]['widget_descr'] room.innerHTML = room.innerHTML.replace(/roomtpl_description/, descr); room.style.display = 'block'; vardiv.appendChild(room); //иконки наполнения номера var icondiv = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_room_'+data.arrRooms[r].typeid+'_icon'); icondiv.innerHTML = ''; var icondescr = ''; if(this.mapExt[data.arrRooms[r].typeid]) { for(var ext in this.mapExt[data.arrRooms[r].typeid]){ if(!this.mapExt[data.arrRooms[r].typeid].hasOwnProperty(ext)) continue; if(ext.substr(0,11) != 'widget_icon') continue; if(ext.substr(0,16) == 'widget_icon_pet_') var icon = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_roompeticon_tpl').cloneNode(true); else var icon = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_roomicon_tpl').cloneNode(true); icon.removeAttribute('id'); icon.title = this.mapExt[data.arrRooms[r].typeid][ext]; icon.innerHTML = icon.innerHTML.replace(/icontpl_href/, this.mapRoomIcon[ext]); icon.style.display = ''; icondiv.appendChild(icon); if(icondescr != '') icondescr += ', '; icondescr += '
'+this.mapExt[data.arrRooms[r].typeid][ext]+'
'; } } if(icondescr != '') icondescr = 'Вам доступны: ' + icondescr; room.innerHTML = room.innerHTML.replace(/roomtpl_icondescr/,icondescr); //человечки var guestdiv = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_room_'+data.arrRooms[r].typeid+'_guest'); var yesguest = guestdiv.querySelectorAll('svg')[0]; var noguest = guestdiv.querySelectorAll('svg')[1]; var plusguest = guestdiv.querySelectorAll('div')[0]; guestdiv.removeChild(yesguest); guestdiv.removeChild(noguest); guestdiv.removeChild(plusguest); guestdiv.innerHTML = ''; var guests = data.arrRooms[r].guest; for(var g=1;g<=data.arrRooms[r].bads;g++) { if( guests<=0 ) guestdiv.appendChild(noguest.cloneNode(true)); else { guests--; guestdiv.appendChild(yesguest.cloneNode(true)); } } if(data.arrRooms[r].addbads > 0) { guestdiv.appendChild(plusguest); for(g=1;g<=data.arrRooms[r].addbads;g++) { if( guests<=0 ) guestdiv.appendChild(noguest.cloneNode(true)); else { guests--; guestdiv.appendChild(yesguest.cloneNode(true)); } } } //фото pic_min pic_mid pic_max if( cl_hotel4742.gallery>0 ) { var imgdiv = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_room_'+data.arrRooms[r].typeid+'_img'); if( this.arrImgs && this.arrImgs[data.arrRooms[r].typeid] && this.arrImgs[data.arrRooms[r].typeid].length ) { var img0 = this.arrImgs[data.arrRooms[r].typeid][0]; if(cl_hotel4742.gallery==2) { imgdiv.classList.remove('pic_max'); imgdiv.classList.add('pic_mid'); } else { imgdiv.classList.add('pic_max'); imgdiv.classList.remove('pic_mid'); } imgdiv.style.display = 'flex'; imgdiv.style.backgroundImage = 'url(\''+this.host+'/getimg.php?f='+img0.storageid+'&p='+img0.md+'&pt=1\')'; imgdiv.arrImg = this.arrImgs[data.arrRooms[r].typeid]; imgdiv.room_descr = data.arrRooms[r].descr; imgdiv.onclick = function(){ thisObj.playGallery(this.arrImg, this.room_descr); } } /*else imgdiv.style.display = 'none';*/ } } //теперь все тарифы for(var t=0; t 0) { tariff.innerHTML = tariff.innerHTML.replace(/tariftpl_fullsum/, data.arrTariffs[t].overprice); var discount = Math.floor(100-100*data.arrTariffs[t].amount/data.arrTariffs[t].overprice); tariff.innerHTML = tariff.innerHTML.replace(/tariftpl_discount/, discount); data.arrTariffs[t].discount = discount; } else { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_tarif_'+data.arrTariffs[t].id+'_fullsum').style.visibility = 'hidden'; tariff.innerHTML = tariff.innerHTML.replace(/tariftpl_fullsum/, data.arrTariffs[t].amount); tariff.innerHTML = tariff.innerHTML.replace(/tariftpl_discount/, 0); } if(data.isOverbooking > 0) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_tarif_'+data.arrTariffs[t].id+'_btn').classList.add('cl_wdt_outline'); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_tarif_'+data.arrTariffs[t].id+'_btn').innerHTML = cl_hotel4742.btoverbooking; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_var_'+data.vid+'_tarif_'+data.arrTariffs[t].id+'_btn').onclick = (function (objtarif,objvar) { return function() { thisObj.curVar = objvar; thisObj.curVar.amount = objtarif.amount; //пропишем стоимость из выбранного тарифа thisObj.tariffId = objtarif.id; thisObj.curVar.objTariff = objtarif; thisObj.curVar.mapRooms = {}; for(var r=0;r1) { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_description').style.display = 'flex'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_description').innerHTML = room_descr; } else { document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_description').style.display = 'none'; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery').style.display = 'flex'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_close').onclick = function(){ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_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_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_next').style.visibility = 'visible'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_prev').style.visibility = 'visible'; } else{ document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_next').style.visibility = 'hidden'; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_prev').style.visibility = 'hidden'; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_next').onclick = function(){ jfNextImg(); }; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_gallery_photo_prev').onclick = function(){ jfPrevImg(); }; } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.setPhonePattern = function(inp,e) { //console.log(e.keyCode); var digs=inp.value.replace(new RegExp("[^0-9]",'g'),''); if(digs.length>10) digs=digs.substr(0,10); var pos=inp.selectionStart; var digsFull=digs+'__________'; var res='('+digsFull.substr(0,3)+')'+digsFull.substr(3,3)+'-'+digsFull.substr(6,2)+'-'+digsFull.substr(8,2); switch (e.keyCode) { case 8: //backspace switch (pos) { case 0: pos=1; break; case 5:case 9:case 12: pos--; break; } break; case 46: //delete break; case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105: //цифры case 229: //mobile samsung keypad!!! all of keys if(pos>res.replace(/[\_]/g,'').length) switch (digs.length) { case 0:case 1:case 2: pos=digs.length+1; break; case 3:case 4:case 5: pos=digs.length+2; break; case 6:case 7: pos=digs.length+3; break; case 8:case 9: pos=digs.length+4; break; } else switch (pos) { case 1:case 4:case 8:case 11: case 5:case 9:case 12: pos++; break; } break; } inp.value=res; if (inp.createTextRange) { var r = inp.createTextRange(); r.collapse(true); r.moveEnd('character', pos); r.moveStart('character', pos); r.select(); } else inp.setSelectionRange(pos,pos); return true; } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.setDatePattern = function(inp,e) { //console.log(e.keyCode); var digs=inp.value.replace(new RegExp("[^0-9]",'g'),''); if(digs.length>8) digs=digs.substr(0,8); var pos=inp.selectionStart; var digsFull=digs+'__________'; var res=digsFull.substr(0,2)+'.'+digsFull.substr(2,2)+'.'+digsFull.substr(4,4); var skip = false; if(parseInt(digs.substr(0,1),10)>3) { res = '_'+digsFull.substr(1,1)+'.'+digsFull.substr(2,2)+'.'+digsFull.substr(4,4); pos = 0; skip = true; } if(!skip && (parseInt(digs.substr(0,2),10)>31)) { res = '3_.'+digsFull.substr(2,2)+'.'+digsFull.substr(4,4); pos = 1; skip = true; } if(!skip && parseInt(digs.substr(2,1),10)>1){ res = digsFull.substr(0,2)+'._'+digsFull.substr(3,1)+'.'+digsFull.substr(4,4); pos = 3; skip = true; } if(!skip && parseInt(digs.substr(2,2),10)>12){ res = digsFull.substr(0,2)+'.'+digsFull.substr(2,1)+'_.'+digsFull.substr(4,4); pos = 4; skip = true; } if(!skip) switch (e.keyCode) { case 8: //backspace switch (pos) { case 3:case 6: pos--; break; } break; case 46: //delete break; case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: case 96:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105: //цифры case 229: //mobile samsung keypad!!! all of keys if(pos>res.replace(/[\_]/g,'').length) switch (digs.length) { case 0:case 2: pos=digs.length+1; break; case 1:case 3: pos=digs.length+2; break; case 4:case 5:case 6:case 7: pos=digs.length+3; break; } else switch (pos) { case 2:case 5:case 3:case 6: pos++; break; } break; } inp.value=res; if (inp.createTextRange) { var r = inp.createTextRange(); r.collapse(true); r.moveEnd('character', pos); r.moveStart('character', pos); r.select(); } else inp.setSelectionRange(pos,pos); return true; } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.addGuest = function() { var thisObj = this; this.guestId++; this.guestCnt++; var guestdiv = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_tpl').cloneNode(true); guestdiv.id = 'cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+this.guestId; guestdiv.innerHTML = guestdiv.innerHTML.replace(/GUESTID/gi, this.guestId); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guestdiv').parentNode.insertBefore(guestdiv,document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guestdiv')); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+this.guestId+'_btndel').onclick = function() { var div = document.getElementById(this.id.replace('_btndel','')); div.parentNode.removeChild(div); thisObj.guestCnt--; if(thisObj.guestCnt < (thisObj.cntAdt+thisObj.cntChild+thisObj.cntInfants)) document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_btn_addguest').style.display = ''; } document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+this.guestId+'_birthday').onkeydown = this.dtPatternFunc; document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+this.guestId+'_citizen_div').onclick = this.citizenListFunc; if(this.guestCnt >= (this.cntAdt+this.cntChild+this.cntInfants)) document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_btn_addguest').style.display = 'none'; guestdiv.style.display = ''; } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.calcPrepay = function() { //if(cl_hotel4742.ispay == 0) //касса не подключена // return 0; var fullsum = this.curVar.amount + (this.curVar.srvSum?this.curVar.srvSum:0) + (this.curVar.optSum?this.curVar.optSum:0); if(cl_hotel4742.paysum == 2) //полная стоимость брони return fullsum; if((cl_hotel4742.paysum == 1) || (cl_hotel4742.ispay == 0)) {//частичная предоплата var total = 0; switch(cl_hotel4742.prepaytype) { case 1: //сумма for(var i=0;i= 0) sum = this.arrTypes[this.curVar.arrRooms[i].typeid].val; total += sum; } break; case 2: //процент - берем максимальный из всех типов номеров var arrproc = []; for(var i=0;i= 0) arrproc.push(this.arrTypes[this.curVar.arrRooms[i].typeid].val); else arrproc.push(cl_hotel4742.prepayval); } var proc = Math.max.apply( Math, arrproc ); total += Math.ceil(proc*(fullsum))/100; break; case 3: //дни for(var i=0;i= 0) day = this.arrTypes[this.curVar.arrRooms[i].typeid].val; total += Math.ceil( 100 * this.curVar.amount/this.cntday * day )/100; } break; } return total; } } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.checkEmail = function(str) { var emailPattern = /^[a-zA-Z0-9._\+]+[a-zA-Z0-9\.\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/; return emailPattern.test(str); }; //проверим введенные контактные данные jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.formCheck = function() { //phone var phone = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone').value.replace(/[^\d]/g,''); var code = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone').parentNode.getAttribute('mycode').replace('+',''); if(code == '7') { if( ! (/^[\d]{10}$/).test(phone) ) { this.alert('Укажите корректный номер телефона. Номер должен состоять из 10 цифр.'); return false; } else this.form_phone = '8'+phone; } else { if( ! (/^[\d]{6,}$/).test(phone) ) { this.alert('Укажите корректный номер телефона. Номер должен состоять не менее чем из 6-ти цифр.'); return false; } else this.form_phone = '810'+code+phone; } this.form_fullphone = '+'+code+document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_phone').value; //email var email = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_email').value; if( !this.checkEmail(email) ) { this.alert('Введите корректный адрес электронной почты (E-mail).'); return false; } this.form_email = email; //city this.form_city = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_city').value; if((cl_hotel4742.cityrq == 1) && (this.form_city == '')) { this.alert('Укажите город своего проживания.'); return false; } // this.form_guest = []; //main guest this.form_lastname = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_lastname').value; if(this.form_lastname == '') { this.alert('Укажите Фамилию.'); return false; } this.form_name = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_name').value; if(this.form_name == '') { this.alert('Укажите Имя.'); return false; } var g1={}; g1.lastname = this.form_lastname; g1.name = this.form_name; g1.midname = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_midname').value; g1.bday = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_birthday').value; g1.citizen = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_citizen').getAttribute('dataid'); this.form_guest.push(g1); //other guests if(this.guestCnt > 1) { for(var i=2;i<=this.guestCnt;i++) { if(document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+i)) { var g={}; g.lastname = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+i+'_lastname').value; g.name = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+i+'_name').value; g.midname = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+i+'_midname').value; g.bday = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+i+'_birthday').value; g.citizen = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_guest_'+i+'_citizen').getAttribute('dataid'); if(g.lastname == '') { this.alert('Укажите Фамилию гостя.'); return false; } if(g.name == '') { this.alert('Укажите Имя гостя.'); return false; } this.form_guest.push(g); } } } //in out this.form_checkin = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_timein').value; this.form_checkout = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_timeout').value; this.form_checkin = ('0'+this.form_checkin).substr(-2,2)+':00'; this.form_checkout = ('0'+this.form_checkout).substr(-2,2)+':00'; this.form_comment = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_comment').value; if(!document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_policy').checked) { this.alert('Для продолжения поставьте Согласие с условиями политики обработки персональных данных.'); return false; } if(this.offerdoc && !document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_offerdoc').checked) { this.alert('Для продолжения поставьте Согласие с условиями Договора оферты.'); return false; } return true; } //отправляем на бронирование jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.send = function(credit) { //service asrv = ''; for(var ks in this.mapAdd['service']) { if(!this.mapAdd['service'].hasOwnProperty(ks)) continue; if(this.mapAdd['service'][ks].selected) asrv += ((asrv==''?'':',')+this.mapAdd['service'][ks].id+';'+this.mapAdd['service'][ks].selected+';'+this.mapAdd['service'][ks].selsumma); } //option aopt = ''; for(var tp in this.mapAdd['option']) { if(!this.mapAdd['option'].hasOwnProperty(tp)) continue; for(var ko in this.mapAdd['option'][tp]) { if(!this.mapAdd['option'][tp].hasOwnProperty(ko)) continue; if(this.mapAdd['option'][tp][ko].selected) aopt += ((aopt==''?'':',')+this.mapAdd['option'][tp][ko].id+';'+this.mapAdd['option'][tp][ko].price+';'+this.mapAdd['option'][tp][ko].selected+';'+this.mapAdd['option'][tp][ko].selsumma+';'+tp); } } var creditstr = ''; if(credit==1) creditstr = ' По бронированию подана заявка на кредит!'; if(credit==2) creditstr = ' По бронированию подана заявка на рассрочку!'; var spost = 'fname='+this.form_name +'&lname='+this.form_lastname +'&phone='+this.form_phone +'&email='+this.form_email +'&city='+this.form_city +'&comment='+this.form_comment+(creditstr) +'&amount='+(this.total*100) +'&bedtype='+ this.bedType +'&services='+asrv +'&options='+aopt +'&varid='+this.curVar.vid +'&tariffid='+this.curVar.objTariff.id +'&tariffabc='+this.curVar.objTariff.abc +'&prepay='+this.prepay +'&cururl='+(window.isvkwidget? document.referrer :document.location.href) +'&promocode='+this.promocode +'&ssid='+this.ssid; if(this.form_guest.length) spost += '&guest='+JSON.stringify(this.form_guest); spost += '&chkintime='+this.form_checkin +'&chkouttime='+this.form_checkout; if(credit) spost += '&credit='+credit; var thisObj = this; /* this.toStep6(); return true; */ this.toYandex('cloffHotel_booking'); this.toGoogle('cloffHotel_booking'); this.callajax( this.host+'/widget/booking.save.rs.php?aj=1', spost, function(param){ if(param.errcode){ thisObj.alert(param.errmsg); return false; } //если кредит if(credit) { thisObj.bookingID = param.bookingID; thisObj.toStep6(); thisObj.bookingID = 0; tinkoff.create( { sum: thisObj.total, items: [{name: 'Бронирование', price: thisObj.total, quantity: 1}], demoFlow: 'sms', promoCode: (credit==1?'default':cl_hotel4742.credit_promo), shopId: cl_hotel4742.credit_shopid, showcaseId: cl_hotel4742.credit_caseid, values: { contact: { fio: { lastName: thisObj.form_lastname, firstName: thisObj.form_name //middleName: document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_midname').value }, mobilePhone: thisObj.form_phone.substr(1), email: thisObj.form_email } } }, {view: 'modal'} ); return; } //если была оплата! if( cl_hotel4742 && cl_hotel4742.ispay ){ if(param.payURL){ //сохраним в кукисе данные букина thisObj.setCookie('bookingID', param.bookingID, 1); thisObj.setCookie('bookingDescr', thisObj.form_email+','+thisObj.form_fullphone, 1); document.location.href = param.payURL; if(window.isvkwidget || thisObj.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) document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step6_bookname').innerHTML = document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step6_bookname').innerHTML.replace('Номер Вашего бронирования', 'Номер Вашей заявки'); document.getElementById('cl_hbw_33fdae1928e3a966fa0096cdaf945b9f_step6').style.display = 'flex'; } jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.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() //если размещения на доп местах должна быть выбрана соответствующая опция jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f.prototype.checkDopMesto = function() { if(this.curVar.beds < (this.cntAdt + this.cntChild)) { var cnt = 0; for(var tp in this.mapAdd['option']) { if(!this.mapAdd['option'].hasOwnProperty(tp)) continue; for(var op in this.mapAdd['option'][tp]) { if(!this.mapAdd['option'][tp].hasOwnProperty(op)) continue; if((this.mapAdd['option'][tp][op].selected > 0) && (this.mapAdd['option'][tp][op].type == 1)) cnt += this.mapAdd['option'][tp][op].selected; } } if(cnt < (this.cntAdt + this.cntChild - this.curVar.beds)) { this.alert('Выберите дополнительные места. В вашем варианте размещения их должно быть: '+(this.cntAdt + this.cntChild - this.curVar.beds)); return false; } } return true; } function clMans(param){ var thisObj = this; this.min = ( param.min ? param.min: 0 ); this.cnt = ( param.cnt ? param.cnt: this.min ); this.value = this.cnt; //для общности с простым селектом this.max = ( param.max ? param.max: 5 ); this.inpCount = ( param.input ? param.input : { value: thisObj.cnt } ); this.elCount = ( param.elem ? param.elem : { innerHTML: thisObj.cnt } ); this.elDel = ( param.del ? param.del : { } ); this.elAdd = ( param.add ? param.add: { } ); this.container = ( param.container ? param.container: false ); this.classOn = ( param.classOn ? param.classOn: '' ); this.classOff = ( param.classOff ? param.classOff: '' ); this.onChange = ( param.onChange ? param.onChange: false ); this.widget = ( param.widget ? param.widget: false ); if(!this.container){ console.log('clMans :: CONTAINER NOT FOUND'); return false; } this.arrEl = []; //по новым веяниям не добавляем а убираем лишних for(var cnt=0; cnt=thisObj.max) thisObj.elAdd.classList.add('disabled'); else thisObj.elAdd.classList.remove('disabled'); } 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_link = "https://www.cloff.ru/";var cl_hotel4742 = { name:'Hotel Globus' , lat:'0' , lng:'0' , address:'188270, Ленинградская область, Лужский район, д. Заклинье, ул. Новая д.22а' , descr:'' , minnum:1 , maxnum:4 , mind:1 , maxd:90 , maxadt:4 , maxchd:4 , childmax:18 , infantmax:2 , gallery: 2 , btbooking: 'Бронировать' , btoverbooking: 'Оставить заявку' , bookstart: '2018-01-01' , bookend: '' , ispay: 0 , paysum: 0 , prepaytype: 2 , prepayval: 10 , 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: 1 , selbed: 1 , islc:0 , interval:'60' , checkin:14 , checkout:12 , bedview:'1' , policydef: '0' , policyurl: '' , offerdocurl: '' , infantcount: '0' , novariant:'Нет подходящих вариантов на указанные даты' , credit_pay: false , antibrand : '0' }; var sc = document.createElement('script'); sc.type = 'text/javascript'; sc.src = 'https://27493.cloff.ru/js/wdt.js?v=599'; sc.charset = 'UTF-8'; var hd = document.getElementsByTagName("HEAD"); hd.item(0).appendChild(sc); var wdiv33fdae1928e3a966fa0096cdaf945b9f = document.createElement('DIV'); wdiv33fdae1928e3a966fa0096cdaf945b9f.id = 'AAA_33fdae1928e3a966fa0096cdaf945b9f'; if(document.body) document.body.appendChild(wdiv33fdae1928e3a966fa0096cdaf945b9f); else document.head.appendChild(wdiv33fdae1928e3a966fa0096cdaf945b9f); var scontent33fdae1928e3a966fa0096cdaf945b9f = ' calend CLOFF_logo_ext guest bed_double bed_two chevron_left chevron_right chevron_right_w caret_up caret_left caret_down caret_right quest_circle_solid file_sign file_dollar file_template clock quest_circle print_new email_alt dots_reg_h dots_reg_v wifi pet_paw safe couch wine_bottle_solid air_conder medal house shower bed_king_size del_pure delete_outline bars delete_outline_alt attach_money exit_new search_bold check table_round users_friend_alt user_plus_alt square_phone sms_solid_alt temp_snow edit_alt table_bell_solid multiselect_list_new excl_triangle_solid export plus phone_pad flag_checkered shopping_basket_solid shopping_basket suitcase bathrobe clothes_dryer clotheswashing dishwashing eatery fan parking slippers snowflake teapot trees water water_ladder wc '; wdiv33fdae1928e3a966fa0096cdaf945b9f.innerHTML = scontent33fdae1928e3a966fa0096cdaf945b9f; var clW_33fdae1928e3a966fa0096cdaf945b9f; sc.onload = function(){ clW_33fdae1928e3a966fa0096cdaf945b9f = new jcClWidgetBooking33fdae1928e3a966fa0096cdaf945b9f({ hash:'33fdae1928e3a966fa0096cdaf945b9f', wid:4742, content:'', host:'https://27493.cloff.ru/' }); }