{"next_vers_features":{"process_daily_autocasts":true,"process_lead_activity":true,"save_lead_form":true,"process_lead_page_load":true,"widgets":true,"add_to_cart":true,"tick":true,"lead_state":true,"initialize":true},"counter_checked":true,"order_code_checked":true,"lh_vars":{"user_script":"var orderSelectors = [];\nvar disabledSelectors = ['form'];\n\n\n\nfunction addInputToForm(inputname, formlink, inputvalue) {\n    var input = document.createElement('input');\n    input.type = \"hidden\";\n    input.name = inputname;\n    input.id = \"id_\"+inputname;\n    input.value = inputvalue;\n    formlink.appendChild(input);}\n\n\n//проверка почты\nfunction isValidEmail(email) {\n    var re = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/;\n    return re.test(email);\n}\n//проверка телефона\nfunction isValidPhone(phone) {\n    var re = /^[\\s()+-]*([0-9][\\s()+-]*){10,11}$/;\n    return re.test(phone);\n}\n\n//Вишлист\nLeadhit.clientCheckOfferPageAndCount({\n    type: 'selector',\n    operator: 'exist',\n    value: '.book-detail .buy-button'\n})\n\n\n//кнопка на карточке товара\nvar productBuyBtn = '.book-detail .buy-button'; \n\n// добавление товара с карточки\nLeadhit.addEventLive(productBuyBtn, 'click', function() {\n  try {\n    Leadhit.addToCart();\n  } catch (e) {}\n});\n\n\n//добавление товара из каталога и избранного\nvar catalogBuyBtn = '.grid-container .book-card .buy-button'; // кнопка в каталоге\nvar catalogItemUrl = '.grid-container .book-card .book-card__title'; // url товара в каталоге\nvar getCatalogItemUrl = function(el) {\n  return Leadhit.nearest(el, catalogItemUrl).href;\n}; // поиск url выбранного товара\n\nLeadhit.addEventLive(catalogBuyBtn, 'click', function() {\n  var item_url = getCatalogItemUrl(this);\n  Leadhit.addToCart(item_url);\n});\n\n\n//слайдер на главной\nvar mainSliderBuyBtn = '.slick-slide .book-tile .buy-button'; \nvar mainSliderItemUrl = '.slick-slide .book-tile__title'; \nvar getmainSliderItemUrl = function(el) {\n  return Leadhit.nearest(el, mainSliderItemUrl).href;\n}; // поиск url выбранного товара\n\n\nLeadhit.addEventLive(mainSliderBuyBtn, 'click', function() {\n  var item_url = getmainSliderItemUrl(this);\n  Leadhit.addToCart(item_url);\n});\n\n\n//категории на главной\nvar mainCategoriesBuyBtn = '.slick-list .book-card .buy-button'; \nvar mainCategoriesItemUrl = '.slick-list .book-card .book-card__title'; \nvar getmainCategoriesItemUrl = function(el) {\n  return Leadhit.nearest(el, mainCategoriesItemUrl).href;\n}; // поиск url выбранного товара\n\n\nLeadhit.addEventLive(mainCategoriesBuyBtn, 'click', function() {\n  var item_url = getmainCategoriesItemUrl(this);\n  Leadhit.addToCart(item_url);\n});\n\n\n//Подписка\nvar lhSubForm = document.createElement(\"form\");\naddInputToForm('lhSubFormEmail', lhSubForm, '');\n\njQuery('.js-sub-form .button').on(\"click\", function() {\n  if (isValidEmail(jQuery('.js-sub-form input[name=\"email\"]').val())) {\n    lhSubForm.id_lhSubFormEmail.value = jQuery('.js-sub-form input[name=\"email\"]').val();\n  }\n  lh_sf(lhSubForm);\n});\n\n//Остались вопросы?\nvar lhQuestionsForm = document.createElement(\"form\");\naddInputToForm('lhQuestionsFormPhone', lhQuestionsForm, '');\naddInputToForm('lhQuestionsFormEmail', lhQuestionsForm, '');\naddInputToForm('lhQuestionsFormName', lhQuestionsForm, '');\n\njQuery('.melt__rel .button_expanded').on(\"click\", function() {\n  if (isValidEmail(jQuery('#mainFeedback_email').val())) {\n    lhQuestionsForm.id_lhQuestionsFormEmail.value = jQuery('#mainFeedback_email').val();\n  }\n  lhQuestionsForm.id_lhQuestionsFormName.value = jQuery('#mainFeedback_name').val();\n  lhQuestionsForm.id_lhQuestionsFormPhone.value = jQuery('#mainFeedback_phone').val();\n  lh_sf(lhQuestionsForm);\n});\n\njQuery('form[action=\"/contacts/\"] .button_expanded').on(\"click\", function() {\n  if (isValidEmail(jQuery('#mainFeedback_email').val())) {\n    lhQuestionsForm.id_lhQuestionsFormEmail.value = jQuery('#mainFeedback_email').val();\n  }\n  lhQuestionsForm.id_lhQuestionsFormName.value = jQuery('#mainFeedback_name').val();\n  lhQuestionsForm.id_lhQuestionsFormPhone.value = jQuery('#mainFeedback_phone').val();\n  lh_sf(lhQuestionsForm);\n});\n\n\n//Вход в учетную запись\nvar lhAuthForm = document.createElement(\"form\");\naddInputToForm('lhAuthFormPhone', lhAuthForm, '');\naddInputToForm('lhAuthFormEmail', lhAuthForm, '');\n\njQuery('#auth .button_expanded').on(\"click\", function() {\nif (isValidEmail(jQuery('#auth .js-auth-login').val())) {\n    lhAuthForm.id_lhAuthFormEmail.value = jQuery('#auth .js-auth-login').val();\n    lh_sf(lhAuthForm);\n  }\nelse if (isValidPhone(jQuery('#auth .js-auth-login').val())) {\n  \t\tlhAuthForm.id_lhAuthFormPhone.value = jQuery('#auth .js-auth-login').val();\n  \t\tlh_sf(lhAuthForm);\n  }\n});\n\n\n//Регистрация\nvar lhRegForm = document.createElement(\"form\");\naddInputToForm('lhRegFormLName', lhRegForm, '');\naddInputToForm('lhRegFormEmail', lhRegForm, '');\naddInputToForm('lhRegFormName', lhRegForm, '');\n\njQuery('#registry .button_expanded').on(\"click\", function() {\n  if (isValidEmail(jQuery('#registry input[name=\"email\"]').val())) {\n    lhRegForm.id_lhRegFormEmail.value = jQuery('#registry input[name=\"email\"]').val();\n  }\n  lhRegForm.id_lhRegFormName.value = jQuery('#registry input[name=\"name\"]').val();\n  lhRegForm.id_lhRegFormLName.value = jQuery('#registry input[name=\"last_name\"]').val();\n  lh_sf(lhRegForm);\n});\n\n\n\n//Восстановление пароля\nvar lhPassRestoreForm = document.createElement(\"form\");\naddInputToForm('lhPassRestoreFormEmail', lhPassRestoreForm, '');\n\njQuery('#recovery .button_expanded').on(\"click\", function() {\n  if (isValidEmail(jQuery('#recovery .js-recovery-email').val())) {\n    lhPassRestoreForm.id_lhPassRestoreFormEmail.value = jQuery('#recovery .js-recovery-email').val();\n  }\n  lh_sf(lhPassRestoreForm);\n});\n\n\n//Корзина (по отправке)\nvar lhCartSendedForm = document.createElement(\"form\");\naddInputToForm('lhCartSendedFormPhone', lhCartSendedForm, '');\naddInputToForm('lhCartSendedFormEmail', lhCartSendedForm, '');\naddInputToForm('lhCartSendedFormName', lhCartSendedForm, '');\naddInputToForm('lhCartSendedFormCity', lhCartSendedForm, '');\n\njQuery('form[name=\"ORDER_FORM\"] .button.expanded').on(\"click\", function() {\n  if (isValidEmail(jQuery('.order_detail input[name=\"ORDER_PROP_2\"]').val())) {\n    lhCartSendedForm.id_lhCartSendedFormEmail.value = jQuery('.order_detail input[name=\"ORDER_PROP_2\"]').val();\n  }\n  lhCartSendedForm.id_lhCartSendedFormName.value = jQuery('.order_detail input[name=\"ORDER_PROP_1\"]').val();\n  lhCartSendedForm.id_lhCartSendedFormPhone.value = jQuery('.order_detail input[name=\"ORDER_PROP_3\"]').val();\n    if (jQuery('.order_detail .input[name=\"ORDER_PROP_6\"]').val() !== undefined) {\n  lhCartSendedForm.id_lhCartSendedFormCity.value = jQuery('.order_detail .input[name=\"ORDER_PROP_6\"]').val();\n    }\n  lh_sf(lhCartSendedForm);\n});\n\n\n/*\n//Create form Cart\nvar formCart = document.createElement(\"form\");\naddInputToForm('name_cart', formCart, '');\naddInputToForm('email_cart', formCart, '');\naddInputToForm('phone_cart', formCart, '');\naddInputToForm('s_name_cart', formCart, '');\naddInputToForm('city_cart', formCart, '');\n\n//checkInput_cart\nfunction checkInput_cart(event) {\n    if (isValidEmail2(this.value)) {\n        formCart.id_email_cart.value = this.value;\n        window.lh_sf(formCart);\n    }\n    if (isValidPhone(this.value)) {\n        formCart.id_phone_cart.value = this.value;\n        window.lh_sf(formCart);\n    }\n}\n//checkName_cart\nfunction checkName_cart(event) {\n    formCart.id_name_cart.value = this.value;\n    window.lh_sf(formCart);\n}\n\n//checksName_cart\nfunction checksName_cart(event) {\n    formCart.id_s_name_cart.value = this.value;\n    window.lh_sf(formCart);\n}\n\n//checksCity_cart\nfunction checksCity_cart(event) {\n    formCart.id_city_cart.value = this.value;\n    window.lh_sf(formCart);\n}\n\n\ntry {\n    document.querySelector('#delivery_address #fname').addEventListener('keyup', checkName_cart);\n    document.querySelector('#delivery_address #fname').addEventListener('blur', checkName_cart);\n    document.querySelector('#delivery_address #fname').addEventListener('change', checkName_cart);\n} catch (e) {}\n\ntry {\n    document.querySelector('#delivery_address #lname').addEventListener('keyup', checksName_cart);\n    document.querySelector('#delivery_address #lname').addEventListener('blur', checksName_cart);\n    document.querySelector('#delivery_address #lname').addEventListener('change', checksName_cart);\n} catch (e) {}\n\ntry {\n    document.querySelector('#delivery_address #email').addEventListener('keyup', checkInput_cart);\n    document.querySelector('#delivery_address #email').addEventListener('blur', checkInput_cart);\n    document.querySelector('#delivery_address #email').addEventListener('change', checkInput_cart);\n} catch (e) {}\ntry {\n    document.querySelector('#delivery_address #phone').addEventListener('keyup', checkInput_cart);\n    document.querySelector('#delivery_address #phone').addEventListener('blur', checkInput_cart);\n    document.querySelector('#delivery_address #phone').addEventListener('change', checkInput_cart);\n} catch (e) {}\n\ntry {\n    document.querySelector('#delivery_address #city').addEventListener('keyup', checksCity_cart);\n    document.querySelector('#delivery_address #city').addEventListener('blur', checksCity_cart);\n    document.querySelector('#delivery_address #city').addEventListener('change', checksCity_cart);\n} catch (e) {}\n\n\n\n//Create form CartDataSend\nvar formCartDataSend = document.createElement(\"form\");\naddInputToForm('cart_name', formCartDataSend, '');\naddInputToForm('cart_surname', formCartDataSend, '');\naddInputToForm('cart_email', formCartDataSend, '');\naddInputToForm('cart_phone', formCartDataSend, '');\naddInputToForm('cart_city', formCartDataSend, '');\ntry {\n    function click_cartdata(cb) {\n        document.addEventListener(\"mouseup\", function(event) {\n            var el = event.target,\n                found;\n            while (el && !(found = el === document.querySelector('#delivery_address .btn.btn-primary.btn-xlarge'))) { \n                el = el.parentElement;\n            }\n            if (found) {\n                cb.call(el, event);\n            }\n        });\n    }\n    click_cartdata(function(event) {\n        formCartDataSend.id_cart_name.value = document.querySelector('#delivery_address #fname').value;\n        formCartDataSend.id_cart_surname.value = document.querySelector('#delivery_address #lname').value;\n        if (document.querySelector('#delivery_address #email')) {\n        formCartDataSend.id_cart_email.value = document.querySelector('#delivery_address #email').value;\n        }\n        formCartDataSend.id_cart_phone.value = document.querySelector('#delivery_address #phone').value;\n\t\tformCartDataSend.id_cart_city.value = document.querySelector('#delivery_address #city').value;\n        window.lh_sf(formCartDataSend);\n    });\n} catch (e) {}\n\n\n\n// items\nvar productBuyBtn = '#quickViewContent .js-basket-add-link'; // кнопка на карточке товара\nLeadhit.addEventLive(productBuyBtn, 'mouseup', function() {\n  try {\n    Leadhit.addToCart();\n  } catch (e) {}\n});\n\nvar catalogBuyBtn = '.span3 .thumbnail .buy'; // кнопка товара каталог и новинки на главной\nvar catalogItemUrl = '.span3 .item-name a'; // url товара в каталоге\nvar getCatalogItemUrl = function(el) {\n  return Leadhit.nearest(el, catalogItemUrl).href;\n};\n\n//добавление товара из каталога\nLeadhit.addEventLive(catalogBuyBtn, 'mouseup', function() {\n  try {\n    var item_url = getCatalogItemUrl(this);\n    Leadhit.addToCart(item_url);\n  } catch (e) {}\n});\n\n\nvar recommendBuyBtn = '.rslides-container .options_.js-basket-add-link'; // рекомендации на главной\nvar recommendItemUrl = '.rslides-container .slide-img a'; // url товара \nvar getrecommendItemUrl = function(el) {\n  return Leadhit.nearest(el, recommendItemUrl).href;\n};\n\n//добавление товара с главной\nLeadhit.addEventLive(recommendBuyBtn, 'mouseup', function() {\n  try {\n    var item_url = getrecommendItemUrl(this);\n    Leadhit.addToCart(item_url);\n  } catch (e) {}\n});\n*/\n\n","forms_script":""}}