//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 jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66(param) { //console.log('jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66',param); jcClWidgetBase.apply(this, arguments); var thisObj = this; this.content = param.content; this.onopenform = function() { }; this.oncloseform = function() { thisObj.myinit(); }; this.host = param.host; this.dtStart = false; this.dtEnd = false; this.curVar = false; this.arrService = []; this.arrOption = []; 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 = 'fcf5da3f70c9464490f40cca06917a66'; this.varDescr = false; this.initChilds = false; this.childmax = cl_hotel1526.childmax; this.infantmax = cl_hotel1526.infantmax; this.cityrq = cl_hotel1526.cityrq; this.cntGuests = 4; this.frm = false; this.cntday = 1; var SUTKI = 24*3600*1000; this.bookend = ( cl_hotel1526&&cl_hotel1526.bookend ? cl_hotel1526.bookend: ''); this.bookstart = ( cl_hotel1526&&cl_hotel1526.bookstart ? cl_hotel1526.bookstart: ''); this.money = cl_hotel1526&&cl_hotel1526.money; this.ssid = this.getcookie('cl_ssid'); if(!this.ssid) this.ssid = ''; var addEvent = function(elem, type, handler){ if (elem.addEventListener){elem.addEventListener(type, handler, false)} else { elem.attachEvent("on"+type, handler)} }; var removeEvent = function(elem, type, handler){ if (elem.removeEventListener){elem.removeEventListener(type, handler, false)} else { elem.detachEvent("on"+type, handler)} }; var alertClose = function(){ thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert'), 'hide'); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert').style.display = 'none' //removeEvent(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert').parentNode,'click',alertClose ); }; this.alert = function(msg){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert_msg').innerHTML = msg; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert').style.display = 'block' //thisObj.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert'), 'hide'); /* window.setTimeout( function(){ addEvent(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert').parentNode,'click', alertClose ); }, 200); */ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert_close').onclick = function(){ alertClose(); }; }; //работа с куками 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 ( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dt_legend').offsetHeigh *2 ) ) this.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dt_legend'), 'cl_w_100' ); } if(container_elem.offsetWidth<380){ this.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_bookdates'), 'cl_fx_wrap' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_bookdates'), 'cl_bed_inline' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_beforeBed'), 'cl_hide' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_beforeAge'), 'cl_hide' ); this.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dt_legend'), 'cl_w_100' ); } else{ if(container_elem.offsetWidth>470){ this.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_bookdates'), 'cl_bed_inline' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_bookdates'), 'cl_fx_wrap' ); this.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_beforeBed'), 'cl_hide' ); this.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_beforeAge'), 'cl_hide' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dt_legend'), 'cl_w_100' ); } else{ this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_bookdates'), 'cl_fx_wrap' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_bookdates'), 'cl_bed_inline' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_beforeBed'), 'cl_hide' ); this.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_beforeAge'), 'cl_hide' ); } } } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.init = function() { 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 = 'clBooking-btn clBooking-color-button'; this.btn.onclick = function(e) { thisObj.openform(); } this.btn.style.display = 'none'; this.maindiv.appendChild(this.btn); this.container = document.createElement('div'); this.container.id='cl_widget_content_'+this.hash; this.container.className='clBooking-form-radius 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; //console.log('INIT this.maindiv',this.maindiv); }; jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.showform = function(elparent) { this.jscClassAdd( this.container, 'clBookVK' ); this.container.style.display = 'block'; elparent.appendChild(this.container); } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.myinit =function() { var SUTKI = 24*3600*1000; var thisObj = this; this.container.innerHTML = this.content; if(!this.initChilds) this.initChilds = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_line').innerHTML; this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4'),'hide'); this.varDescr = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_description'); console.log('this.prototype.myinit.varDescr', this.varDescr,'cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_description'); if(this.varDescr) { this.varDescr = this.varDescr.parentNode.removeChild(this.varDescr); document.body.appendChild(this.varDescr); } //this.container.className = this.container.className + ' clWindow'; this.jscClassAdd(this.container,( this.staticForm? 'BuildIn': 'clWindow')); this.next3_button = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button').innerHTML; var btnclose = this.container.querySelectorAll('.booking-widget-close'); for(var i=0;i4) || (cl_hotel1526.maxchd>4) ){ this.cntGuests = (cl_hotel1526.maxadt+cl_hotel1526.maxchd); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_user_form'), 'clBooking-manyguests'); //заполняем селекты var ssel = ''; for(var a=1; a<=cl_hotel1526.maxadt; a++) ssel += (''); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_sel').innerHTML = ssel; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_sel').value = this.cntAdt; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_sel').onchange = function(obj){ thisObj.freeVars(); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults').value = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_sel').value; } ssel = ''; for(var c=0; c<=cl_hotel1526.maxchd; c++) ssel += (''); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_sel').innerHTML = ssel; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_sel').value = this.cntChild; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_sel').onchange = function(obj){ thisObj.freeVars(); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs').value = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_sel').value; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs').onchange(); } } else { this.cntA = new clMans({ input: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults') , elem : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_span') , del : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_del') , add : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_add') , container : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults_cont') , tpl : '
' , classOn : 'clBooking-pers clBooking-pers-on' , classOff : 'clBooking-pers' , cnt : this.cntAdt , min: 1 , max: 4 , widget : this , onChange: function(obj){ thisObj.freeVars(); } }); this.cntC = new clMans({ input: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs') , elem : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_span') , del : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_del') , add : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_add') , container : document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_cont') , tpl : '
' , classOn : 'clBooking-pers clBooking-pers-on' , classOff : 'clBooking-pers' , cnt : (this.cntChild+this.cntInfants) , min: 0 , max: 4 , widget : this , onChange: function(){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs').onchange(); } }); } document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_button').onclick = function(){ var msg = ''; //сообщение об ошибке //собираем данные var dts = thisObj.dtStart.toCLStr(); if(!dts){ msg += ( msg==''?'':'
'); msg += 'Выберите дату заезда.'; } var dte = thisObj.dtEnd.toCLStr(); if(!dte){ msg += ( msg==''?'':'
'); msg += 'Выберите дату отъезда.'; } var toGermanString = function(t) { return ('0'+t.getDate()).substr(-2)+'.'+('0'+(1+t.getMonth())).substr(-2)+'.'+t.getFullYear(); }; var toJapanString = function(t) { return t.getFullYear()+'-'+('0'+(1+t.getMonth())).substr(-2)+'-'+('0'+t.getDate()).substr(-2); }; if(thisObj.bookend != '') { var bookend = new Date( Date.parse(thisObj.bookend) ); if(bookend'); msg += 'Бронирование доступно только до '+toGermanString(bookend); } } var hds = new Date( thisObj.bookstart ); var cds = new Date( toJapanString(thisObj.dtStart.dt1) ); if(hds>cds){ msg += ( msg==''?'':'
'); msg += 'Бронирование доступно только с '+toGermanString(hds); } var dd = Math.ceil((thisObj.dtEnd.dt1-thisObj.dtStart.dt1)/SUTKI); if(dts>=dte){ msg += ( msg==''?'':'
'); msg += 'Период бронирования выбран не корректно.'; } else { /*if(cl_hotel1526.mind>dd){ msg += 'Минимальный период бронирования '+cl_hotel1526.mind+' суток'; } else*/ if(cl_hotel1526.maxd'); msg += 'Максимальный период бронирования '+cl_hotel1526.maxd+' суток'; } } //взрослые var adt = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults').value,10); if(adt<0){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults').value = 0; adt = 0; } if(!adt){ msg += ( msg==''?'':'
'); msg += 'Введите количество гостей.'; } //дети var ch = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs').value,10); 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_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_sel_'+k).value,10); if(!age){ 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{ console.log(parseInt(age,10),'>',thisObj.infantmax,(parseInt(age,10)>thisObj.infantmax)); if(parseInt(age,10)>thisObj.infantmax){ childs++ } else{ infants++; } achilds += ('&arrch['+k+']='+age); } } }//END for(k=1; k<=ch; k++) if(msg!=''){ thisObj.alert(msg); return; } thisObj.cntAdt = adt; thisObj.cntChild = childs; thisObj.cntInfants = infants; var spost = 'dts='+dts+'&dte='+dte+'&cntadlt='+adt+'&ssid='+thisObj.ssid; if(ch>0){ spost += ('&cntinfant='+infants+'&cntchild='+childs+achilds); } console.log('SPOST:',spost); thisObj.callajax( thisObj.host+'/widget/booking.start.rs.php?aj=1', spost, function(param){ console.log('fcf5da3f70c9464490f40cca06917a66', param); if(parseInt(param.errcode,10)>0){ if(parseInt(param.errcode,10) == 777) { thisObj.alert('Минимальный период бронирования '+cl_hotel1526.mind+' суток'); return; } if(param.errmsg){ thisObj.alert(param.errmsg); return; } } //есть ли варианты if(param.arrvariant.length==0){ thisObj.alert('Нет подходящих вариантов на указанные даты'); return; } thisObj.arrVars = param.arrvariant; thisObj.arrService = param.arrservice; thisObj.arrOption = param.arroption; 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); }; this.dtEnd = new wDate( { input: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dtend') , button: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dtend_button') , dtstart: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dtstart') } ); this.dtStart = new wDate( { input: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dtstart') , button: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dtstart_button') , dtend: document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dtend') , endobj: this.dtEnd } ); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_dt_legend').innerHTML = this.dtEnd.getLegend(); this.chBedType = new jcCheckboxWB({input:'cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_bedtype', classOn:'bedtype-check-on', classOff:'bedtype-check-off'}); if(this.bedType==2) this.chBedType.check(); else this.chBedType.uncheck(); if(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1_legend')) document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1_legend').innerHTML = ''; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2_legend').innerHTML = ''; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3_legend').innerHTML = ''; this.initIface(); this.freeVars(); //resetChildsCount(); //проверим если возврат с оплаты прорисуем итог и почистим кукисе 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.openform(); this.toStep4(); } } // END myinit //инициализация настроек дизайна jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.initIface = function(){ if(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery')){ var g = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery').parentNode.removeChild(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery')); if(g) document.body.appendChild(g); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery').style.zIndex = parseInt(this.container.style.zIndex,10)+100; } if( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert_msg').parentNode.tagName!='BODY' ){ //this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert'), 'hide'); var al = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert'); al.style.display = 'none' al.parentNode.removeChild(al); document.body.appendChild(al); } //суммы предоплаты //console.log('cl_hotel1526.ispay',cl_hotel1526.ispay); if( cl_hotel1526 && cl_hotel1526.ispay ){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_paysum').parentNode.style.display = 'inline-block'; } else{ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_paysum').parentNode.style.display = 'none'; } } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.openform = function(container_elem) { var thisObj = this; if(this.staticForm){ this.modal.style.display='none'; this.modal.style.opacity = 0.7; this.container.style.display='none'; this.showStatic(container_elem); /* container_elem.onresize = function(e){ console.log('QQQQQQQQQQQQQQQQQ'); thisObj.resizeContainer(container_elem); }; */ this.resizeContainer(container_elem); return; } this.modal.style.display='block'; this.modal.style.opacity = 0.7; this.container.style.display='block'; if(this.onopenform) this.onopenform(); }, jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.showStatic = function(container_elem){ this.formContainer = container_elem; if(!this.formContainer){ console.error( 'CONTAINER element is not found', container_elem ); return; }; var frm = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_formSTAT'); var frmP = frm.parentNode; var chd = frmP.removeChild( frm ); this.formContainer.appendChild(chd); this.frm = chd; this.content = this.container.innerHTML; } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.resetChildsCount = function(){ var ch = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs').value,10); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_span').innerHTML = ch; console.log('children:', ch); this.freeVars(); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_line').innerHTML = this.initChilds; if(ch<5){ if(ch && ch>0){ for(k=1;k<=ch;k++){ var el = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_sel').cloneNode(true); el.id = 'cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_sel_'+k; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_line').appendChild(el); } this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_line'), 'invisible'); } else{ this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs_line'), 'invisible'); } } } //выбор варианта размещения jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.selVar = function(oVar) { this.curVar = oVar; for(var v in this.arrVars){ if(!this.arrVars[v]) continue; if(this.arrVars[v].vid!=this.curVar.vid){ this.jscClassRemove(this.arrVars[v].el,'selected'); } else { this.jscClassAdd(this.arrVars[v].el,'selected'); } } } // END selVar jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.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() //экран выбора вариантов размещения jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.toStep2 = function() { document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3_legend').innerHTML = ''; var thisObj = this; var re = /VARID/gi; var rer = /ROOMID/gi; var listCont = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2_list'); listCont.innerHTML = ''; var elVar = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var'); var elRoom = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_room'); var cnt = 0; var fBooking = function(){ thisObj.arrOption = []; var spost = 'varid='+thisObj.curVar.vid; thisObj.callajax( thisObj.host+'/widget/booking.option.rs.php?aj=1', spost, function(param){ thisObj.arrOption = param.arroption; thisObj.toStep3(); }, true); }; var isOne = 1; for(var v in this.arrVars){ var va1 = this.arrVars[v]; if(!va1.vid) continue; if(va1.nums>1){ isOne = 0; break; } } for(var v in this.arrVars){ cnt++; var va = this.arrVars[v]; if(!va.vid) continue; var elv = elVar.cloneNode(true); elv.id = 'cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid; elv.innerHTML = elv.innerHTML.replace(re, va.vid); elv.ovar = va; elv.onclick = function(){ //console.log('VAR:',this.ovar); thisObj.selVar(this.ovar); }; va.el = elv; //console.log(v, 'add VAR', va); listCont.appendChild(elv); if(isOne && va.nums==1){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_info').innerHTML = ''+va.amount+' '+thisObj.money.code+''; } else { document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_info').innerHTML = ''+va.nums+' '+jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.jscCntRus(va.nums, 'номер', 'номера', 'номеров')+' за '+va.amount+' '+thisObj.money.code+''; this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid),'severalNum'); } document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_button').onclick = function(){ thisObj.selVar( document.getElementById(this.id.replace('_button','')).ovar ); fBooking(); } if(va.isOverbooking==1){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_button').innerHTML = cl_hotel1526.btoverbooking; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_occupied_'+va.vid+'_txt').innerHTML = 'Занят'; this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_occupied_'+va.vid+'_txt'), 'occupied'); } else{ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_button').innerHTML = cl_hotel1526.btbooking; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_occupied_'+va.vid+'_txt').innerHTML = 'Свободен'; this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_occupied_'+va.vid+'_txt'), 'occupied'); } va.arrTypes = {}; va.arrImgs = []; var isDescr = false; for(var n in va.arrRooms){ var r = va.arrRooms[n]; if(!r.typeid) continue; if(!va.arrTypes[r.typeid]) va.arrTypes[r.typeid] = r.typeid; var elr = elRoom.cloneNode(true); elr.id = 'cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_room_'+r.typeid; elr.innerHTML = elr.innerHTML.replace(re, va.vid).replace(rer, r.typeid); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_nums').appendChild(elr); document.getElementById(elr.id+'_info').innerHTML = r.name; var obj_room = { room: r, vart: va, elem: elr, mousepos: { x:0, y:0 } }; if(this.varDescr && r.descr && r.descr.length>10) { elr.onmousemove = (function (x) { return function(e) { x.mousepos.x = e.pageX+4; x.mousepos.y = e.pageY+4; return true; } })(obj_room); elr.onmouseenter = (function (x) { return function(e) { x.room.mouseIN = true; setTimeout( function(){ //console.log('setTimeout:event:', e); if(!x.room.mouseIN) return; thisObj.varDescr.innerHTML = x.room.descr; thisObj.varDescr.style.display = 'block'; thisObj.varDescr.style.top = x.mousepos.y+'px'; thisObj.varDescr.style.left = x.mousepos.x+'px'; console.log('thisObj.varDescr', thisObj.varDescr); },800); return true; } })(obj_room); elr.onmouseleave = (function (x) { return function(e) { thisObj.varDescr.style.display = 'none'; x.room.mouseIN = false; return true; } })(obj_room); } //Таня решила "человечков" var sBads = ''; for(var k=0; k1) document.getElementById(elr.id+'_amount').innerHTML = r.amount+' '+thisObj.money.code; //если второй тип галлереи то по комнатам if( cl_hotel1526.gallery==2 ){ //поищем фотки типa va.arrRooms[n].arrImgs = []; if(this.arrImgs[r.typeid]){ for(var i in this.arrImgs[r.typeid]){ va.arrRooms[n].arrImgs.push(this.arrImgs[r.typeid][i]); } } //END поищем фотки типa //включим отображение если нашлись if(va.arrRooms[n].arrImgs.length>0){ this.jscClassAdd(va.el, 'roomPhoto'); var img0 = va.arrRooms[n].arrImgs[0]; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_room_'+va.arrRooms[n].typeid+'_img').style.display = 'block'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_room_'+va.arrRooms[n].typeid+'_img').firstChild.style.backgroundImage = 'url(\''+thisObj.host+'/getimg.php?f='+img0.storageid+'&p='+img0.md+'&pt='+cl_hotel1526.gallery+'\')'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_room_'+va.arrRooms[n].typeid+'_img').firstChild.arrImg = va.arrRooms[n].arrImgs; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_room_'+va.arrRooms[n].typeid+'_img').firstChild.room_descr = va.arrRooms[n].descr; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_room_'+va.arrRooms[n].typeid+'_img').firstChild.onclick = function(){ thisObj.playGallery(this.arrImg, this.room_descr); } } } } if( cl_hotel1526.gallery==1 ){ //поищем фотки типa for(var t in va.arrTypes){ if(this.arrImgs[t]){ for(var i in this.arrImgs[t]){ va.arrImgs.push(this.arrImgs[t][i]); } } }//FOR arrTypes if(va.arrImgs.length>0){ var img0 = va.arrImgs[0]; this.jscClassAdd(va.el, 'roomPhoto'); this.jscClassAdd(va.el, 'bigPhoto'); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_imgs').style.display = 'block'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_imgs').firstChild.style.backgroundImage = 'url(\''+thisObj.host+'/getimg.php?f='+img0.storageid+'&p='+img0.md+'&pt='+cl_hotel1526.gallery+'\')'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_imgs').firstChild.arrImg = va.arrImgs; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_imgs').firstChild.room_descr = obj_room.room.descr; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_var_'+va.vid+'_imgs').firstChild.onclick = function(){ thisObj.playGallery(this.arrImg, this.room_descr); } } //console.log('va.arrImgs.length', va.arrImgs.length); } } this.selVar(this.arrVars[0]); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'), 'showBookingList'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_wnd_alert'), 'showBookingList'); //откроем окошко если мы статическая форма if(this.staticForm){ var adt = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults').value,10); var ch = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs').value,10); var ssVar = adt+' взрослых'+(ch>0?' '+ch+' '+jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.jscCntRus(ch, 'ребёнок', 'ребёнка', 'детей')+' ':''); var legend = '
  • '+ssVar+' c '+thisObj.dtStart.dt1.toGermanStr()+' по '+thisObj.dtEnd.dt1.toGermanStr()+'
  • ' document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1_legend').innerHTML = legend; this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'),'hide'); this.modal.style.display='block'; this.modal.style.opacity = 0.7; this.container.style.display='block'; } } // END toStep2 jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.playGallery = function(arrImgs, room_descr){ //console.log('PLAY',arrImgs, room_descr); var cur = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_current'); cur.innerHTML = ''; var sto = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_storage'); sto.innerHTML = ''; for(var k in arrImgs){ var el = document.createElement('IMG'); if(!arrImgs[k].storageid){ arrImgs.splice(k,1); continue; } //el.src = ''+this.host+'/getfile.php?f='+arrImgs[k].filename+'&p=1'; el.src =''+this.host+'/getimg.php?f='+arrImgs[k].storageid+'&p='+arrImgs[k].md; sto.appendChild(el); } if( room_descr && room_descr.length>1){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_description').style.display = 'block'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_description').innerHTML = room_descr; } else{ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_description').style.display = 'none'; } document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery').style.display = 'block'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_close').onclick = function(){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_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_fcf5da3f70c9464490f40cca06917a66_gallery_photo_next').style.display = 'block'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_prev').style.display = 'block'; } else{ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_next').style.display = 'none'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_prev').style.display = 'none'; } document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_next').onclick = function(){ jfNextImg(); }; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_gallery_photo_prev').onclick = function(){ jfPrevImg(); }; } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.activService = function(){ //return; this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_service_label'),'active'); this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_label'),'active'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_list').parentNode,'hide'); this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_service_list').parentNode,'hide'); } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.activOption = function(){ //return; this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_service_label'),'active'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_label'),'active'); this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_list').parentNode,'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_service_list').parentNode,'hide'); } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.reCalc = function(){ var cnt = 1; this.total = this.curVar.amount; //сервисы var asrv = 0; var srv_price = 0; for(var ks in this.arrService){ var srv = this.arrService[ks]; if(!srv.id) continue; if(!srv.maxcnt) continue; cnt = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_service_'+srv.id+'_count').value, 10); if(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_service_'+srv.id+'_chb').checked==1) if(srv.ispersonal){ srv_price = (cnt * srv.price*(this.cntAdt+this.cntChild) * ( srv.isonce? 1: this.cntday) ); asrv += srv_price; } else { srv_price = (cnt * srv.price * (srv.isonce? 1:this.cntday) ); asrv += srv_price; } this.arrService[ks].amount = srv_price; } this.total += asrv; var aopt = 0; for(var o in this.arrOption){ var op = this.arrOption[o]; if(!op.id) continue; if(!op.maxcnt) continue; cnt = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_count').value, 10); if(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_chb').checked==1) if(op.ispersonal){ aopt += (cnt * op.price*(this.cntAdt+this.cntChild)); } else { aopt += (cnt * op.price); } } this.total += aopt; //считаем размер предоплаты если надо this.prepay = 0; if( cl_hotel1526 && cl_hotel1526.ispay ){ if(cl_hotel1526.prepaytype == 1){ //фиксированная сумма //смотрим нет ли чего в типе номера for(var r=0; r=0 ){ roompay = this.arrTypes[ this.curVar.arrRooms[r].typeid].val; } this.prepay += (roompay * this.curVar.arrRooms[r].cnt); } } else if(cl_hotel1526.prepaytype == 3){ //стоимость дней проживания //если в типах прописаны "исключения" то берём максимум var ppdays = cl_hotel1526.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_hotel1526.prepayval/100 * (aopt+asrv)); } document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_paysum').innerHTML = this.prepay; } document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_total').innerHTML = this.total; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_total2').innerHTML = this.total; } jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.toStep3 = function() { var thisObj = this; if(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1_legend')) document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1_legend').innerHTML = ''; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3_legend').innerHTML = ''; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2_legend').innerHTML = ''; var v = this.curVar.el.cloneNode(true); var re = new RegExp(v.id,"gi"); var newid = v.id+'_v'; v.innerHTML = v.innerHTML.replace( re, newid ); v.id = newid; //скрываем кнопу - не нужна this.jscClassAdd( document.getElementById( newid+'_button' ), 'hide'); this.jscClassRemove( document.getElementById( newid+'_bedtype' ), 'hide'); // дополнительный услуги var elSrv = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_service'); var elOpt = document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option'); var re = /SRVID/gi; var rer = /OPTID/gi; var cnt_row = 0; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_list').innerHTML = ''; for(var o in this.arrOption){ var op = this.arrOption[o]; if(!op.id) continue; if(!op.maxcnt) continue; var elv = elOpt.cloneNode(true); elv.id = 'cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id; elv.innerHTML = elv.innerHTML.replace(rer, op.id); elv.oop = op; elv.title = op.descr; cnt_row++; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_list').appendChild(elv); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_name').innerHTML = op.name; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_amount').innerHTML = op.price+' '+thisObj.money.code; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_count').value = 1; thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_count'),'disabled'); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_count').disabled = true; if(op.maxcnt==1){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_count').style.display = 'none'; } else { document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_name').style.maxWidth = '180px'; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_count').max = op.maxcnt; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_option_'+op.id+'_count').onchange = ( function(x){ return function(e){ if(!e.target.value){ e.target.value = 1; } if( (parseInt(e.target.value,10)==NaN) || (parseInt(e.target.value,10)<1) ){ e.target.value = '1'; return false; } if( x.maxcnt1 ? this.curVar.arrRooms[k].cnt+' по ':'')+this.curVar.arrRooms[k].amount+thisObj.money.code+')'); } } var adt = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_adults').value,10); var ch = parseInt(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_childs').value,10); var ssVar = adt+' взрослых'+(ch>0?' '+ch+' '+jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.jscCntRus(ch, 'ребёнок', 'ребёнка', 'детей')+' ':''); var legend = '
  • '+ssVar+' c '+thisObj.dtStart.dt1.toGermanStr()+' по '+thisObj.dtEnd.dt1.toGermanStr()+'. '+ssN+'
  • ' thisObj.descr = ssVar+' c '+thisObj.dtStart.dt1.toGermanStr()+' по '+thisObj.dtEnd.dt1.toGermanStr()+'
    '+ssN; if(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1_legend')) document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1_legend').innerHTML = legend; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2_legend').innerHTML = legend; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3_legend').innerHTML = legend; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_agree').onchange = function(){ if(!document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_agree').checked){ thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button'),'disabled'); } else{ thisObj.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button'),'disabled'); } }; if(thisObj.curVar.isOverbooking==1){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button').innerHTML = cl_hotel1526.btoverbooking; } else{ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button').innerHTML = thisObj.next3_button; } console.log('CNT:',cnt_row); if(!cnt_row){ document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_back3_button').onclick = function(){ thisObj.toStep2(); }; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button').onclick = function(){ if(!document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_agree').checked){ thisObj.alert('Необходимо ваше согласие на обработку персональных данных'); return; } thisObj.send(); }; thisObj.toStep35(); } else{ thisObj.toStep3Show(); } thisObj.activOption(); thisObj.reCalc(); } // END toStep3 jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.toStep3Show = function() { var thisObj = this; this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'),'hide'); this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3'),'hide'); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_back2_button').onclick = function(){ if( !thisObj.staticForm ) thisObj.freeVars(); thisObj.jscClassRemove( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'),'hide'); thisObj.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2'), 'hide'); thisObj.jscClassAdd( document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3'), 'hide'); }; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next2_button').onclick = function(){ console.log('jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.onclick'); thisObj.toStep35(); } document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_back3_button').onclick = function(){ thisObj.toStep3Show(); }; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button').onclick = function(){ console.log('jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66_next3_button.onclick!!!!'); if(!document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_agree').checked){ thisObj.alert('Необходимо ваше согласие на обработку персональных данных'); return; } thisObj.send(); }; }; jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.toStep35 = function() { console.log('!!!!jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.toStep35'); var thisObj = this; this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2'),'hide'); this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4'),'hide'); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_next3_button').onclick = function(){ console.log('jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66_next3_button.onclick!!!! 3333'); if(!document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_agree').checked){ thisObj.alert('Необходимо ваше согласие на обработку персональных данных'); return; } thisObj.send(); }; }; jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.prototype.toStep4 = function() { var thisObj = this; this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2'),'hide'); this.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3'),'hide'); this.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4'),'hide'); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4_bookingid').innerHTML = this.bookingID; document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4_booking_descr').innerHTML = this.descr; var fClear = function(){ thisObj.closeform(); thisObj.myinit(); thisObj.jscClassRemove(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step1'),'hide'); thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step2'),'hide'); thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step3'),'hide'); thisObj.jscClassAdd(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4'),'hide'); }; if(document.getElementById('cl_hotel_booking_button4')) document.getElementById('cl_hotel_booking_button4').onclick = fClear; setTimeout( function() { fClear(); }, 60000 ); } // END toStep4 jcClWidgetBookingfcf5da3f70c9464490f40cca06917a66.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_fcf5da3f70c9464490f40cca06917a66_phone').value); var fname = trim(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_name1').value); var lname = trim(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_name2').value); var email = trim(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_email').value); var city = trim(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_city').value); var comment = trim(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_comment').value); var name = lname+fname; var amount = trim(document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_comment').value); //проверка параметров 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'; } //собираем данные //сервисы asrv = ''; var sService = ''; var cnt = 1; for(var ks=0; ks'+srv.name+(cnt>1?' '+cnt+' X ':'')+' '+srv.price+thisObj.money.code); asrv += ((asrv==''?'':',')+srv.id+';'+cnt+';'+srv.amount); } } aopt = ''; var sOption = ''; var addbed = 0; for(var o=0; o'+op.name+(cnt>1?' '+cnt+' X ':'')+' '+op.price+thisObj.money.code); aopt += ((aopt==''?'':',')+op.id+';'+op.price+';'+cnt); if(op.type==1) addbed = addbed+cnt; } } if( ((this.cntAdt+thisObj.cntChild)>this.curVar.beds+addbed) && (thisObj.cntChild<3) ){ errMsg += 'Выберите дополнительные места\n'; } if(errMsg != ''){ this.alert(errMsg); return false; } this.descr += (sService!=''?'
    Услуги:'+sService:''); this.descr += (sOption!=''?'
    Дополнительно:'+sOption:''); this.descr += ('
    Сумма:'+this.total+this.money.code+''); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4_booking_descr').innerHTML = this.descr; var sds = this.descr; var spost = 'fname='+fname +'&lname='+lname +'&phone='+phone +'&email='+email +'&city='+city +'&comment='+comment +'&amount='+(this.total*100) +'&bedtype='+( this.chBedType.checked ? 2: 1 ) +'&services='+asrv +'&options='+aopt +'&varid='+this.curVar.vid +'&prepay='+this.prepay +'&cururl='+document.location.href +'&ssid='+this.ssid; //console.log('spost',spost);return; this.callajax( this.host+'/widget/booking.save.rs.php?aj=1', spost, function(param){ if(param.errcode){ thisObj.alert(param.errmsg); return false; } //если была оплата! if( cl_hotel1526 && cl_hotel1526.ispay ){ if(param.payURL){ //сохраним в кукисе данные букина thisObj.setCookie('bookingID', param.bookingID, 1); thisObj.setCookie('bookingDescr', sds, 1); document.getElementById('cl_hotel_booking_widget_fcf5da3f70c9464490f40cca06917a66_step4_bookingid').innerHTML = param.bookingID; document.location.href = param.payURL; return; } } thisObj.bookingID = param.bookingID; thisObj.toStep4(); thisObj.bookingID = 0; }, true); } // END send function jcCheckboxWB(param) { this.chb = document.getElementById(param.input); this.label = (param.label ? document.getElementById(param.label) : 0); this.field = param.data || ''; this.stopPropagation = param.stopPropagation; this.noClass = param.noClass || 0; this.isClass = param.isClass || 0; this.oncheck = param.oncheck; this.readOnly = false; this.isEnable = true; this.onchange = param.onchange; this.classOn = param.classOn || 'table-check-on'; this.classOff = param.classOff || 'table-check-off'; this.classLabelOn = param.classLabelOn || 'faxbl-txt-wind'; this.classLabelOff = param.classLabelOff || 'fax-txt-wind'; this.init(); } jcCheckboxWB.prototype = { init: function() { this.checked=false; try{ this.chb.checked=false; } catch(e){ console.trace(); } if(this.isClass) { jscClassRemove(this.chb, this.classOn); jscClassAdd(this.chb, this.classOff); } else this.chb.className = this.classOff; if(this.noClass==0 && this.label) this.label.className = this.classLabelOff; if(this.field!='') document.getElementById(this.field).style.display='none'; var thisObj=this; this.chb.onclick = function(e) { if(thisObj.readOnly) return false; if(!thisObj.isEnable) return false; if(fixEvent) fixEvent(e); if(thisObj.checked) thisObj.uncheck(); else thisObj.check(); if(thisObj.stopPropagation) e.stopPropagation(); if(thisObj.onchange) thisObj.onchange(thisObj); return false; }; if(this.label) this.label.onclick = this.chb.onclick; }, check: function(isSkipEvent) { if(!isSkipEvent) isSkipEvent = 0; this.checked=true; this.chb.checked=true; if (this.field!='') document.getElementById(this.field).style.display=''; if(this.isClass) { jscClassRemove(this.chb, this.classOff); jscClassAdd(this.chb, this.classOn); } else this.chb.className = this.classOn; if(this.noClass==0 && this.label) this.label.className = this.classLabelOn; if(this.oncheck && isSkipEvent==0) this.oncheck(true); }, uncheck: function(isSkipEvent) { if(!isSkipEvent) isSkipEvent = 0; this.checked=false; this.chb.checked=false; if (this.field!='') document.getElementById(this.field).style.display='none'; if(this.isClass) { jscClassRemove(this.chb, this.classOn); jscClassAdd(this.chb, this.classOff); } else this.chb.className = this.classOff; if(this.noClass==0 && this.label) this.label.className = this.classLabelOff; if(this.oncheck && isSkipEvent==0) this.oncheck(false); }, set: function(ischeck){ if(ischeck) this.check(); else this.uncheck(); }, enable: function() { if(this.label) if(this.isClass==0) this.label.className = this.classLabelOn; else this.label.style.color = ''; this.isEnable = true; }, // eof enable() disable: function() { if(this.label) if(this.isClass==0) this.label.className = this.classLabelOff; else this.label.style.color = '#bbbbbb'; this.isEnable = false; } // eof disable() } function fixEvent(event) { event = event || window.event; if ( event.isFixed ) { return event; } event.isFixed = true ; event.preventDefault = event.preventDefault || function(){this.returnValue = false}; event.stopPropagation = event.stopPropagation || function(){this.cancelBubble = true}; if (!event.target) { event.target = event.srcElement; } if (!event.relatedTarget && event.fromElement) { event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; } if ( event.pageX == null && event.clientX != null ) { var html = document.documentElement, body = document.body; event.pageX = event.clientX + (html && html.scrollLeft || body && body.scrollLeft || 0) - (html.clientLeft || 0); event.pageY = event.clientY + (html && html.scrollTop || body && body.scrollTop || 0) - (html.clientTop || 0); } //а вдруг это тач???? if( event.touches && event.touches.length==1 ){ touch = event.touches[0]; event.pointerX = touch.pageX; event.pointerY = touch.pageY; event.which = 999; //leg.innerHTML = 'T:'+event.pointerX+' X '+event.pointerY+' www:'+event.which; } else{ event.pointerX = event.pageX; event.pointerY = event.pageY; } if ( (!event.which) && event.button ) { event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); } //event.keyCode = getKeyCode(event); return event; } function clMans(param){ var thisObj = this; this.min = ( param.min ? param.min: 0 ); this.cnt = ( param.cnt ? param.cnt: this.min ); 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.tpl = ( param.tpl ? param.tpl: 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; } if(!this.container){ console.log('clMans :: TPL NOT FOUND'); return false; } this.container.innerHTML = this.tpl; var el = this.container.firstChild; this.container.innerHTML = ''; this.arrEl = []; for(var cnt=0; cnt=thisObj.max) thisObj.widget.jscClassAdd( thisObj.elAdd, 'clBooking-color-backbtn clBooking-color-backbtn-text'); } 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(); var setCount1 = function(){ thisObj.inpCount.value = thisObj.cnt; thisObj.elCount.innerHTML = thisObj.cnt; for(var cnt=0; cnt