var php_server_path = "http://hochu-eto.ru/"; var php_global_date_from = "23.06.2013"; var php_global_date_to = "24.06.2013"; var php_rulesUrl = "/index.php/ru/pravila-projivania"; var php_cityId = "1"; var php_hotelId = 328; var php_debug_string = ""; var php_show_onload = false; var php_outer_referal = -10; 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/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/js/jquery-1.8.0.min.js",loadJQUI); else { var version = $().jquery; if(version == "1.8.0") { loadXDM(); }else { loadScript("http://hochu-eto.ru/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/js/jquery-ui.min.js",loadXDM); } function loadXDM() { loadScript(php_server_path+"js/xdm/easyXDM.min.js",loadJSON); } function loadJSON() { loadScript(php_server_path+"js/json2.js",loadHelp); } function loadHelp() { loadScript(php_server_path+"js/help.js",loadBase64); } function loadBase64() { loadScript(php_server_path+"js/base64.js",loadMaskedTI); } function loadMaskedTI() { loadScript(php_server_path+"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 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+"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; //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: '<Пред', nextText: 'След>', 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()).toggleClass('hidden').fadeTo('slow', 0.7); } function showBackground() { $('#opaco').remove(); } function goToStep1() { hideBackground(); $('#box_step1').fadeIn('slow'); $('#box_step2').hide(); window.scrollTo(0,0); } //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() < widget_base_date_to.getTime() )&& (global_date_to.getTime() <= widget_base_date_to.getTime() ) ) ) { $(".curent_date_from").html(tmp_date_from); $(".curent_date_to").html(tmp_date_to); if(global_date_to > 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); hotel = array[0]; makeHotelView(); makeTooltips(); } }); }else { showError("Неверные даты"); } }else { showError("Указанные даты не входят в период акции"); } } function onLiversChange() { var livers = $("#input_livers" ).val(); global_livers = parseInt(livers); makeHotelView(); } function sortFunction(category1, category2) { if(category1.room.categoryObject.idcategory2.room.categoryObject.id)//a больше, чем b по некоторому критерию return 1 // Или любое число, большее нуля // в случае а = b вернуть 0 return 0; } function makeHotelView() { $("#wt_categories" ).empty(); 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 < hotel.categories.length;key++) { var category = hotel.categories[key]; categories[categoriesIndex++] = category.category; var cnt if(widgetDiscountCategoryId==-1) { cnt = makeCategoryView(category); if(cnt!=null) { noAnsvers = false; categoryBox.append(cnt); } }else { if(widgetDiscountCategoryId == category.category.id) { cnt = makeCategoryView(category); if(cnt!=null) { noAnsvers = false; categoryBox.append(cnt); } } } } all_categories = categories; if(noAnsvers) { $("#wt_categories" ).html("

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

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

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

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

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

"); } //$('.nyroModal').nyroModal(); afterOnStep2(); imagePreview(); } 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<=maxLivers;i++) { var p = getPriceByPricesPeople(category.prices,i,global_date_from,global_date_to,subcategory); if(!isNaN(p)) { p = priceWithDiscount(p); allPrices.push({livers:i,price:p,subcategory:subcategory}); } } } var prevAllPrices = allPrices; allPrices = new Array(); if(!use_widget_discount) { var previousPrice = null; for(var x=0;x $date_to) { break;//переходим к следующей комнате }else { if( ($date_from>=$rDateFrom) && ($date_to<=$rDateTo) )//если поиск входит в свободный период { minNumberRooms = Math.min(minNumberRooms,range.rooms); } } } if(minNumberRooms == 1000) minNumberRooms = 0; category.number = minNumberRooms; }else { allPrices.push({livers:2,price:widgetDiscountPrice*nights,subcategory:""}); category.number = widgetDiscountNumber; } if(category.number > 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("%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:""}); } 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 "одноместное"; else if(number == 2) return "двухместное"; else if(number == 3) return "трехместное"; else if(number == 4) return "четырехместное"; else if(number == 5) return "пятиместное"; else if(number == 6) return "шестиместное"; else if(number == 7) return "семиместное"; else if(number == 8) return "восьмиместное"; else if(number == 9) return "девятиместное"; else if(number == 10) return "десятиместное"; 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 < category.options.length;key++) { var option = category.options[key]; var str = ""+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; function onChangeRoomsNumber() { selected_category_rooms = new Array(); full_selected_price = 0; full_selected_livers = 0; full_selected_rooms = 0; var categoryBoxes = $(".syCategory"); categoryBoxes.each(function(index) { var maxRemainRooms = parseInt($(this).find(".hidden_remain")[0].value); var categoryId = parseInt($(this).find(".hidden_id")[0].value); var usedRooms = 0; var categoryFullPrice = 0; var remainRooms; 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);//кол-во комнат usedRooms += numberRooms; var fullCategoryBoxPrice = $("#fp_"+categoryId); 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_"+categoryId).html(strNumber); $("#fp_"+categoryId).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<= maxValue;j++) { var elOptNew = document.createElement('option'); elOptNew.text = j + ""; elOptNew.value = j + ""; if(j == currentValue) elOptNew.selected = true; try { jsBox.add(elOptNew, null); // standards compliant; doesn't work in IE }catch(ex) { jsBox.add(elOptNew); // IE only } } }); }); if(full_selected_price > 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() { $('#step3_hotelname').html(hotel.name); $('#step3_address').html(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: 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 = parseInt(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 showBookingHotelForm(value) { removeBookingForm(); var myJSONObject = { partner: value}; 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; 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; } } }); }