var php_server_path = "http://hochu-eto.ru/"; var php_global_date_from = "16.10.2016"; var php_global_date_to = "17.10.2016"; var php_rulesUrl = "http://hochu-eto.ru/personaldata.php"; var php_cityId = "2"; var php_hotelId = "542"; var php_debug_string = ""; var php_show_onload = false; var php_outer_referal = -10; var php_use_simplechannel = false; var php_simplechannel_server_path = "http://simplechannel.ru/"; var php_use_auto_search = false; var php_book_one_room = false; function loadScript(sScriptSrc, oCallback) { var oHead = document.getElementsByTagName('head')[0]; var oScript = document.createElement('script'); oScript.type = 'text/javascript'; oScript.src = sScriptSrc; // most browsers oScript.onload = oCallback; // IE 6 & 7 oScript.onreadystatechange = function() { if ((this.readyState == 'complete')||(this.readyState == 'loaded')) { oCallback(); } } oHead.appendChild(oScript); } function loadJS(value) { var js = document.createElement('script'); js.src = value; var head = document.getElementsByTagName('head')[0]; head.appendChild(js); } function loadCSS(value) { var h = document.getElementsByTagName('head')[0]; var link = document.createElement('link'); link.href = value; link.type = 'text/css'; link.rel = 'stylesheet'; h.appendChild(link); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } //loadCSS("http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/ui.all.css"); loadCSS("http://hochu-eto.ru/hochucontent/css/themes/smoothness/jquery-ui-1.7.3.custom.css"); loadCSS("http://hochu-eto.ru/widget/widget.css"); function loadJQ() { //loadScript("http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js",loadJQUI); if(typeof jQuery == 'undefined') loadScript("http://hochu-eto.ru/hochucontent/js/jquery-1.8.0.min.js",loadJQUI); else { var version = jQuery.fn.jquery; if(version == "1.8.0") { loadXDM(); }else { loadScript("http://hochu-eto.ru/hochucontent/js/jquery-1.8.0.min.js",loadJQUI); } } } function loadJQUI() { //loadScript("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js",loadXDM); loadScript("http://hochu-eto.ru/hochucontent/js/jquery-ui.min.js",loadXDM); } function loadXDM() { loadScript(php_server_path+"hochucontent/js/xdm/easyXDM.min.js",loadJSON); } function loadJSON() { loadScript(php_server_path+"hochucontent/js/json2.js",loadHelp); } function loadHelp() { loadScript(php_server_path+"hochucontent/js/help.js",loadBase64); } function loadBase64() { loadScript(php_server_path+"hochucontent/js/base64.js",loadMaskedTI); } function loadMaskedTI() { loadScript(php_server_path+"hochucontent/js/jquery.maskedinput-1.2.2.js",onAllLoaded); } function onAllLoaded() { actionsOnLoad(); } loadJQ(); var global_date_from; var global_date_to; var global_livers; var global_category; var global_room_id; var global_nights_description; var global_nights_number; var global_price_one; var global_price_full; var setverUrl; var corsUrl; var widgetHTMLUrl; var seachPageUrl; var partnersUrl; var captchaUrl; var makeRequestUrl; var confirmSMSUrl; //var rulesUrl; var cityId; var hotelId; var hotel; var all_categories; var xhr; var numberHotels=0; var alreadyLoaded = false; function actionsOnLoad() { if(!alreadyLoaded) { alreadyLoaded = true; global_date_from = strToDate(php_global_date_from); global_date_to = strToDate(php_global_date_to); global_livers = 2; global_category = -1; global_room_id = -1; setverUrl = php_server_path; corsUrl = setverUrl+"hochucontent/js/xdm/cors/index.html"; widgetHTMLUrl = setverUrl+"widget/widgetcontent.php?rules="+php_rulesUrl; seachPageUrl = setverUrl+"widget/find.php"; partnersUrl = setverUrl+"widget/partner.php"; captchaUrl = setverUrl+"captcha.php"; makeRequestUrl = setverUrl+"widget/widgetrequest.php"+php_debug_string; confirmSMSUrl = setverUrl+"widget/smsconfirm.php"+php_debug_string; if(php_use_simplechannel) { seachPageUrl = php_simplechannel_server_path+"widget/find.php"; } //rulesUrl = php_rulesUrl; cityId = php_cityId; hotelId = php_hotelId; if(typeof php_outer_referal != 'undefined') { widgetReferalId = php_outer_referal; }else { widgetReferalId = -10; } jQuery(function($){ $.datepicker.regional['ru'] = { closeText: 'Закрыть', prevText: '', currentText: 'Сегодня', monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь', 'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'], monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн', 'Июл','Авг','Сен','Окт','Ноя','Дек'], dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'], dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'], dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'], weekHeader: 'Не', dateFormat: 'dd.mm.yy', firstDay: 1, isRTL: false, showMonthAfterYear: false, yearSuffix: ''}; $.datepicker.setDefaults($.datepicker.regional['ru']); }); xhr = new easyXDM.Rpc({ remote: corsUrl }, { remote: { request: {} // request is exposed by /cors/ } }); addHTMLComponents(); } } function addHTMLComponents() { xhr.request({ url: widgetHTMLUrl, method: "GET", data: {} }, function(response) { var text = response.data+""; $('body').append(text); startMakeChanges(); }); } function startMakeChanges() { $('#wt_booking_box').hide(); $('.date_from').datepicker({ dateFormat: 'dd.mm.yy', onSelect: function(date_from) { var split = date_from.split("."); var date = new Date(split[2],split[1]-1,split[0]); $('.date_from').val(to24HourTimeString(date)); date.setDate(date.getDate() + 1); $(".date_to").val(to24HourTimeString(date)); } }); $('.date_to').datepicker({ dateFormat: 'dd.mm.yy' }); $('.date_from').val(to24HourTimeString(global_date_from)); $('.date_to').val(to24HourTimeString(global_date_to)); $('#input_livers').val(global_livers); if(php_show_onload) showBookingForm(); if( typeof hochuBookingWidgetComplete != "undefined") { hochuBookingWidgetComplete(); } } function showBookingForm() { removeBookingForm(); $('#wt_booking_box').fadeIn('slow'); goToStep1(); } function removeBookingForm() { $('#wt_booking_box').hide(); $('#box_step1').show(); $('#box_step2').hide(); $('#box_step3').hide(); $('#box_step4').hide(); use_widget_discount = false; widgetDiscountID = ""; showBackground(); } function hideBackground() { $('body').append('
'); $('#opaco').height($(document).height()).fadeTo('slow', 0.7); } function showBackground() { $('#opaco').remove(); } var widget_first_enter = true; function goToStep1() { hideBackground(); $('#box_step1').fadeIn('slow'); $('#box_step2').hide(); window.scrollTo(0,0); /* var date_from_param = getUrlParameters("date_from", "", true); var date_to_param = getUrlParameters("date_to", "", true); if(widget_first_enter&&(date_from_param != false)&&(date_to_param!=false) ) { $('#input_date_from').val(date_from_param); $('#input_date_to').val(date_to_param); goToStep2(); widget_first_enter = false; }else if(widget_first_enter && php_use_auto_search) { goToStep2(); widget_first_enter = false; }*/ } //widget_base_date_from = null; //var widget_base_date_to function goToStep2() { //hideBackground(); $("#wt_booking_box").css("position","absolute"); $("#p_full_livers").html(""); $("#p_full_price").html(""); $("#button_book").hide(); var tmp_date_from = $('#input_date_from').val(); var tmp_date_to = $('#input_date_to').val(); global_date_from = strToDate(tmp_date_from); global_date_to = strToDate(tmp_date_to); if( !use_widget_discount|| ( (global_date_from.getTime() >= widget_base_date_from.getTime() )&& (global_date_from.getTime() global_date_from) { $('#box_step1').hide(); $('#box_step3').hide(); $('#box_step2').fadeIn('slow'); var myJSONObject = { hotel: hotelId, date_from: tmp_date_from, date_to: tmp_date_to, "mainRequestUrl":seachPageUrl}; xhr.request({ url: seachPageUrl, method: "POST", data: myJSONObject }, function(response) { var text = response.data+""; if(text.length > 0) { text = text.split('\r').join(''); text = text.split('\n').join(''); //var array = JSON.parse(text);//eval('('+text+')');//JSON.parse(data); var array = eval(text); $("#wt_categories" ).empty(); numberHotels = array.length; for(var k=0;kcategory2.room.categoryObject.id)//a больше, чем b по некоторому критерию return 1 // Или любое число, большее нуля // в случае а = b вернуть 0 return 0; } function makeHotelView(hotel) { if(numberHotels>1) { $("#wt_categories" ).append($("

"+hotel.name+"

")); } if(hotel.categories!=null) { var categoriesNumber = hotel.categories.length; var categoryBox = $("
"); oneRoomSelected = false; if(categoriesNumber > 0) { //сначала отсортируем //hotel.rooms.sort(sortFunction); //группируем по категориям var categories = new Array(); var categoriesIndex = 0; var lastCategory; var noAnsvers = true; for (var key=0;key К сожалению, на эти даты свободных номеров нет"); $("#wt_categories" ).append($("

К сожалению, на эти даты свободных номеров нет

")); }else { $("#wt_categories" ).append(categoryBox); } }else { //$("#wt_categories" ).html("

К сожалению, на эти даты свободных номеров нет

"); $("#wt_categories" ).append($("

К сожалению, на эти даты свободных номеров нет

")); } }else { //$("#wt_categories" ).html("

К сожалению, на эти даты свободных номеров нет

"); $("#wt_categories" ).append($("

К сожалению, на эти даты свободных номеров нет

")); } //$('.nyroModal').nyroModal(); } function afterOnStep2() { if(use_widget_discount) { $(".numberLivers").hide(); $(".syCategoryLivers").hide(); //$("#p_full_livers").hide(); $(".syCategoryAverageBox").css("width","170px"); $("p.syCategoryPrice").css("width","170px"); }else { $(".numberLivers").show(); $(".syCategoryLivers").show(); $("#p_full_livers").show(); $("#p_full_livers").hide(); } //onChangeRoomsNumber(); } var oneRoomSelected = false; function makeCategoryView(categoryObject) { var category = categoryObject.category; var categoryDiv = $("#categoryTemplate" ); var categorytext= categoryDiv.html(); var nights = getSearchDays(global_date_from,global_date_to); var nightsDescription = declOfNum(nights,["ночь","ночи","ночей"]); var header_p = $("#p_header_price"); header_p.html("Цена за "+nights+" "+ nightsDescription); var subcategories = getSubcategories(category); var fullPrice = getPriceByPricesPeople(category.prices,0,global_date_from,global_date_to,subcategories[0]);//без указания кол-ва человек fullPrice = priceWithDiscount(fullPrice); var onePrice= fullPrice/nights; var allPrices = new Array(); var maxLivers = category.maxlivers; if(maxLivers == null) maxLivers = 3; for(var j=0;j=$rDateFrom) && ($date_to 0) { global_nights_description = nightsDescription; global_nights_number = nights; var strNumber = declOfNum(category.number,["остался %% номер","осталось %% номера","осталось %% номеров"]); strNumber = strNumber.replace(new RegExp("%%",'g'),category.number); categorytext = categorytext.replace(new RegExp("%categoryId%",'g'),category.id); categorytext = categorytext.replace(new RegExp("%hotelId%",'g'),categoryObject.hotel.id); categorytext = categorytext.replace(new RegExp("%hotelName%",'g'),categoryObject.hotel.name); categorytext = categorytext.replace(new RegExp("%hotelAddress%",'g'),categoryObject.hotel.address); categorytext = categorytext.replace(new RegExp("%categoryDescriptionId%",'g'),"roombox"+category.id); categorytext = categorytext.replace(new RegExp("%categoryName%",'g'),category.name); categorytext = categorytext.replace(new RegExp("%categoryPrice%",'g'),fullPrice); categorytext = categorytext.replace(new RegExp("%categoryPriceOne%",'g'),onePrice); categorytext = categorytext.replace(new RegExp("%categoryPriceDescription%",'g'),nights +" "+nightsDescription); categorytext = categorytext.replace(new RegExp("%categoryRemain%",'g'),strNumber); categorytext = categorytext.replace(new RegExp("%categoryRemainNumber%",'g'),category.number); objectCategory = $(categorytext); var categoryPricesBox = objectCategory.find(".onePriceBox"); if(allPrices.length==0)//нет цен для кол-ва людей { allPrices.push({livers:"1",price:fullPrice,subcategory:""}); } var showselector = ""; if(php_book_one_room) { showselector = 'style="display: none;"'; } for(var k=0;k

'; ciclText += '

'+currentPrice+' руб.

'; ciclText += ''; //if(currentSubtype.length>0) // ciclText += '

'+currentSubtype+'

'; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; var ciclPriceDiv = $(ciclText); categoryPricesBox.append(ciclPriceDiv); } var categoryDescriptionBox = objectCategory.find(".syCategoryDescriptionBox"); var descriptionObject = makeCategoryDescription(category); categoryDescriptionBox.append(descriptionObject); return objectCategory; }else { return null; } } function liversAsString(number) { if(number == 1) return "1-местн"; else if(number == 2) return "2-местн"; else if(number == 3) return "3-местн"; else if(number == 4) return "4-местн"; else if(number == 5) return "5-местн"; else if(number == 6) return "6-местн"; else if(number == 7) return "7-местн"; else if(number == 8) return "8-местн"; else if(number == 9) return "9-местн"; else if(number == 10) return "10-местн"; else if(number == 0) return "без типа"; else return ""; } function getSubcategories(category) { var response = new Array(); if(category.prices != undefined) { for (var i=0;i 0)) { var isUsed = false; for(var j=0;j 3) str+="style='display: none;'"; str+="/> "; var photoObject = $(str); photosDiv.append(photoObject); } var optionsDiv = objectRoom.find(".syRoomPropertiesBox"); for (var key=0;key "+option.name+""; var optionObject = $(str); optionsDiv.append(optionObject); } return objectRoom; } var selected_category_rooms; var full_selected_price; var full_selected_livers; var full_selected_rooms; var used_different_hotels = false; var central_selected_hotel_id; var central_selected_hotel_name; var central_selected_hotel_address; function onChangeRoomsNumber() { used_different_hotels = false; selected_category_rooms = new Array(); full_selected_price = 0; full_selected_livers = 0; full_selected_rooms = 0; var categoryBoxes = $(".syCategory"); var selectedHotel = ""; categoryBoxes.each(function(index) { var canContinue = true; var maxRemainRooms = parseInt($(this).find(".hidden_remain")[0].value); var categoryId = String($(this).find(".hidden_id")[0].value); var hotelId = String($(this).find(".hidden_hotel_id")[0].value); var hotelName = String($(this).find(".hidden_hotel_name")[0].value); var hotelAddress = String($(this).find(".hidden_hotel_address")[0].value); var usedRooms = 0; var categoryFullPrice = 0; var remainRooms; var categoryAndHotelIds = categoryId+"_"+hotelId; var selectorBoxes = $(this).find(".syRoomCategorySelectorBox"); selectorBoxes.each(function(index) { var checkBox = $(this).find(".syCategoryLiversNumber")[0]; //var categoryId = $(this).find(".sb_category")[0].value; var numberRooms = parseInt(checkBox.value);//кол-во комнат if(numberRooms > 0) { if(selectedHotel.length==0) { selectedHotel = hotelId; central_selected_hotel_id = hotelId; central_selected_hotel_name = hotelName; central_selected_hotel_address = hotelAddress; }else { if(hotelId != selectedHotel) { used_different_hotels = true; alert("Нельзя одновременно забронировать номера в разных отелях"); $(this).find(".syCategoryLiversNumber").val(0); numberRooms = 0; } } } usedRooms += numberRooms; var fullCategoryBoxPrice = $("#fp_"+categoryAndHotelIds); if(numberRooms > 0) { var price = $(this).find(".sb_price")[0].value; var liversOne = $(this).find(".sb_livers")[0].value; var categoryName = $(this).find(".sb_category_name")[0].value; var subtype = $(this).find(".sb_subtype")[0].value; var livers = liversOne;//*numberRooms; var categoryPrice = price*numberRooms; selected_category_rooms.push({ category:categoryId, categoryName:categoryName, subtype:subtype, rooms:numberRooms, livers:parseInt(livers), price:price, fullPrice:categoryPrice, days:global_nights_number, date_from: dateToStr(global_date_from), date_to: dateToStr(global_date_to)}); full_selected_livers+=liversOne*numberRooms; full_selected_rooms +=numberRooms; full_selected_price +=categoryPrice; categoryFullPrice +=categoryPrice; } }); remainRooms = maxRemainRooms - usedRooms; //var strNumber = declOfNum(remainRooms,["остался %% номер","осталось %% номера","осталось %% номеров"]); //strNumber = strNumber.replace(new RegExp("%%",'g'),remainRooms); var strNumber = declOfNum(maxRemainRooms,["остался %% номер","осталось %% номера","осталось %% номеров"]); strNumber = strNumber.replace(new RegExp("%%",'g'),maxRemainRooms); $("#cr_"+categoryAndHotelIds).html(strNumber); $("#fp_"+categoryAndHotelIds).html(categoryFullPrice + " руб."); $("#current_rooms_"+categoryId).val(remainRooms); }); //--------Остаток в комбиках categoryBoxes = $(".syCategory"); categoryBoxes.each(function(index) { var categoryId = $(this).find(".hidden_id")[0].value; var remainRooms = parseInt($("#current_rooms_"+categoryId)[0].value); var selectorBoxes = $(this).find(".syRoomCategorySelectorBox"); selectorBoxes.each(function(index) { var box = $(this).find(".syCategoryLiversNumber")[0]; var boxId = box.id; var jsBox = document.getElementById(boxId); var currentValue = 0; for (var i = 0; i 0) { $("#p_full_livers").html(full_selected_livers); $("#p_full_price").html(full_selected_price+" руб."); $("#button_book").show(); }else { $("#p_full_livers").html(""); $("#p_full_price").html(""); $("#button_book").hide(); } } function makeBookingSelection() { window.scrollTo(0,0); $('#step3_hotelname').html(central_selected_hotel_name); $('#step3_address').html(central_selected_hotel_address); $('#step3_rooms').html(full_selected_rooms); $('#step3_livers').html(full_selected_livers); $('#step3_cost_full_description').html("Стоимость за "+global_nights_number + " "+global_nights_description); $('#step3_cost_full').html(full_selected_price); $('#box_step2').hide(); $('#box_step3').fadeIn('slow'); $('#div_submit').show(); $("#input_phone").mask("+9 (999) 999-99-99"); //regetCaptcha(); } function makeRequest() { var checkBox = document.getElementById('personaldata'); if(checkBox.checked) { //var captcha = $('#input_captcha').val(); var fio = $('#input_fio').val(); var phone = $('#input_phone').val(); var mail = $('#input_mail').val(); var comments= $('#input_comments').val(); var selected_rooms = selected_category_rooms; var json_selected_rooms = JSON.stringify(selected_rooms); var base_selected_rooms = Base64.encode(json_selected_rooms); var price_one = Math.round(full_selected_price/global_nights_number); var myJSONObject = { fio: fio, mail: mail, phone: phone, date_from: dateToStr(global_date_from), date_to: dateToStr(global_date_to), price: price_one, price_full: full_selected_price, hotel: central_selected_hotel_id, categories: base_selected_rooms, comment: comments, city: cityId, referal: widgetReferalId, discount: widgetDiscountNumberValue, discountId: widgetDiscountID, //captcha:captcha, "mainRequestUrl":makeRequestUrl}; xhr.request({ url: makeRequestUrl, method: "POST", data: myJSONObject }, function(response) { var data = response.data+""; $('#loader').fadeOut('slow'); if(data.indexOf("WRANGCAPTCHA") > -1) { showError("Неверный код с картинки"); regetCaptcha(); }else if(data.indexOf("ERROR")>-1) { data = data.replace("ERROR:", ""); showError(data); document.getElementById('captcha').src=captchaUrl+'?'+Math.random(); document.getElementById('captcha-form').focus(); }else { makeConfirmationShow(); widget_client_code = data; } }); }else { alert("Необходимо ознакомиться и согласиться с правилами отеля"); } } var widget_client_code = ""; function makeConfirmationShow() { $("#wt_booking_box").append('
'); $('#opacowidget').toggleClass('hidden').fadeTo('slow', 0.7); var text = '
' +'

На указанный телефон должен прийти код, введите его в поле ниже:

' +' ' +' ' +' ' +'
' var object = $(text); $("body").append(object); } function confirmationButtonBack() { $('#opacowidget').remove(); $('#sms_confirmation').remove(); } function confirmationButtonSMS() { var code = $('#input_confirm_sms_input').val(); var myJSONObject = { code: code, userid: widget_client_code }; xhr.request({ url: confirmSMSUrl, method: "POST", data: myJSONObject }, function(response) { var data = response.data+""; if(data.indexOf("ERROR")>-1) { data = data.replace("ERROR:", ""); showError(data); }else { confirmationButtonBack(); $("#wt_booking_box").css("position","fixed"); $('#box_step3').hide(); $('#box_step4').fadeIn('slow'); if(window.fullBookingComplete) { fullBookingComplete(); } } }); } function selectCategory(value) { var categoryId = String(value); $("#roombox"+categoryId).slideToggle('slow'); } function enableSubmitButton() { var checkBox = document.getElementById('personaldata'); if(checkBox.checked) { $("#button_submit").removeClass("button_make_request_disabled").addClass("button_make_request"); }else { $("#button_submit").removeClass("button_make_request").addClass("button_make_request_disabled"); } } function regetCaptcha() { document.getElementById('captcha').src=captchaUrl+'?'+Math.random(); if(document.getElementById('captcha-form')!=null) document.getElementById('captcha-form').value = ""; } function showError(value) { alert(value); } function getUrlParameters(parameter, staticURL, decode) { var currLocation = (staticURL.length)? staticURL : window.location.search, parArr = currLocation.split("?")[1].split("&"), returnBool = true; for(var i = 0; i 0) { text = text.split('\r').join(''); text = text.split('\n').join(''); var object = JSON.parse(text); cityId = object.city; hotelId = object.id; showBookingForm(); } }); } function priceWithDiscount(value) { return (1-widgetDiscountNumberValue/100)*value; } var widgetDiscountNumberValue = 0; var widgetReferalId = -10;//сам отель var widgetDiscountCategoryId = -1;//сам отель var widget_base_date_from = null; var widget_base_date_to = null;; var use_widget_discount = false; var widgetDiscountPrice = 0; var widgetDiscountNumber = 0; var widgetDiscountID = ""; function showDiscountBookingForm(discount, date_from_str,//дата заеза в виде строки date_to_str ) { discountValue = discount.discount; categoryId = discount.category; base_from_date_str = discount.date_from; base_to_date_str = discount.date_to; _widgetDiscountPrice= discount.price; _widgetDiscountNumber=discount.number; widget_base_date_from = strToDate(base_from_date_str); widget_base_date_to = strToDate(base_to_date_str); removeBookingForm(); var myJSONObject = { partner: discount.partner.login}; xhr.request({ url: partnersUrl, method: "POST", data: myJSONObject }, function(response) { var text = response.data+""; if(text.length > 0) { text = text.split('\r').join(''); text = text.split('\n').join(''); var object = JSON.parse(text); cityId = object.city; hotelId = object.id; use_widget_discount = true; widgetDiscountNumberValue = discountValue; $('.percentContainer').html(discountValue+'%'); $('.stepBox2Discount').show(); widgetReferalId = 0;//хочу-это widgetDiscountCategoryId = categoryId; widgetDiscountPrice = _widgetDiscountPrice; widgetDiscountNumber= _widgetDiscountNumber; removeBookingForm(); $('#wt_booking_box').fadeIn('slow'); window.scrollTo(0,0); if((date_from_str!=null)&&(date_to_str!=null)) { //widget_base_date_from = null; //widget_base_date_to = null; $('#input_date_from').val(date_from_str); $('#input_date_to').val(date_to_str); goToStep2(); use_widget_discount = true; widgetDiscountID = discount.id; }else { //widget_base_date_from = strToDate(base_from_date_str); //widget_base_date_to = strToDate(base_to_date_str); $('.stepBox2Discount').show(); goToStep1(); use_widget_discount = true; widgetDiscountID = discount.id; } } }); } function makeSimpleChannelHotelView(hotel) { if(numberHotels>1) { $("#wt_categories" ).append($("

"+hotel.name+"

")); } if(hotel.categories!=null) { var categoriesNumber = hotel.categories.length; var categoryBox = $("
"); oneRoomSelected = false; if(categoriesNumber > 0) { var categories = new Array(); var categoriesIndex = 0; var lastCategory; var noAnsvers = true; for (var key=0;key К сожалению, на эти даты свободных номеров нет")); }else { $("#wt_categories" ).append(categoryBox); } }else { $("#wt_categories" ).append($("

К сожалению, на эти даты свободных номеров нет

")); } }else { //$("#wt_categories" ).html("

К сожалению, на эти даты свободных номеров нет

"); $("#wt_categories" ).append($("

К сожалению, на эти даты свободных номеров нет

")); } } function fullCategoryClick(value) { if(php_book_one_room) { var categoryId = String(value); var selectorId = "s_"+categoryId; var currentVal = $("#"+selectorId).val(); $('.syCategoryLiversNumber').val('0'); if(currentVal == '1') { }else { $("#"+selectorId).val('1'); } onChangeRoomsNumber(); } } function makeSimpleChannelCategoryView(categoryObject) { var category = categoryObject; var categoryDiv = $("#categoryTemplate" ); var categorytext= categoryDiv.html(); var nights = getSearchDays(global_date_from,global_date_to); var nightsDescription = declOfNum(nights,["ночь","ночи","ночей"]); var header_p = $("#p_header_price"); header_p.html("Цена за "+nights+" "+ nightsDescription); var fullPrice = 0; var minNumberRooms = 1000; var allPrices = new Array(); for(var j=0;j 0) { global_nights_description = nightsDescription; global_nights_number = nights; var strNumber = declOfNum(category.number,["остался %% номер","осталось %% номера","осталось %% номеров"]); strNumber = strNumber.replace(new RegExp("%%",'g'),category.number); categorytext = categorytext.replace(new RegExp("%categoryId%",'g'),category.id); categorytext = categorytext.replace(new RegExp("%hotelId%",'g'),categoryObject.id); categorytext = categorytext.replace(new RegExp("%hotelName%",'g'),categoryObject.name); categorytext = categorytext.replace(new RegExp("%hotelAddress%",'g'),categoryObject.address); categorytext = categorytext.replace(new RegExp("%categoryDescriptionId%",'g'),"roombox"+category.id); categorytext = categorytext.replace(new RegExp("%categoryName%",'g'),category.name); categorytext = categorytext.replace(new RegExp("%categoryPrice%",'g'),fullPrice); categorytext = categorytext.replace(new RegExp("%categoryPriceOne%",'g'),onePrice); categorytext = categorytext.replace(new RegExp("%categoryPriceDescription%",'g'),nights +" "+nightsDescription); categorytext = categorytext.replace(new RegExp("%categoryRemain%",'g'),strNumber); categorytext = categorytext.replace(new RegExp("%categoryRemainNumber%",'g'),category.number); objectCategory = $(categorytext); var categoryPricesBox = objectCategory.find(".onePriceBox"); if(allPrices.length==0)//нет цен для кол-ва людей { allPrices.push({livers:"1",price:fullPrice,subcategory:""}); } var showselector = ""; if(php_book_one_room) { showselector = 'style="display: none;"'; } for(var k=0;k

'; ciclText += '

'+currentPrice+' руб.

'; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; ciclText += ''; var ciclPriceDiv = $(ciclText); categoryPricesBox.append(ciclPriceDiv); } var categoryDescriptionBox = objectCategory.find(".syCategoryDescriptionBox"); var descriptionObject = makeSimpleChannelCategoryDescription(category); categoryDescriptionBox.append(descriptionObject); return objectCategory; }else { return null; } } function makeSimpleChannelCategoryDescription(category) { var descriptionDiv = $("#categoryDescriptionTemplate" ); var roomtext= descriptionDiv.html(); roomtext = roomtext.replace(new RegExp("%roomDescription%",'g'),category.description); var objectRoom = $(roomtext); var photosDiv = objectRoom.find(".syRoomPhotosBox"); var array = category.photos.split(';'); var i = 0; for (var key=0;key 0) { var str = " 3) str+="style='display: none;'"; str+="/> "; var photoObject = $(str); photosDiv.append(photoObject); } } var arraya = category.additional.split(','); var optionsDiv = objectRoom.find(".syRoomPropertiesBox"); for (var key=0;key "+option+""; var optionObject = $(str); optionsDiv.append(optionObject); } return objectRoom; }