$((function(){KMA.init()}));var KMA=function(t,e){return t.extend(e,{init:function(){this.initFireMetric(),this.setTimezone(),this.initDataCountry(),this.initMethodForm(),this.checkPhoneLen()},showNewsBlogIframe:!0,funcNewsBlogIframe:function(e,n){if(this.showNewsBlogIframe)return this.showNewsBlogIframe=!1,t("body").css({overflow:"hidden",background:"#FFF"}).append('<iframe src="'+n+'" id="comebacker_smi" style="position:fixed;border:none;top:0;left:0;right:0;bottom:0;width:100%;height:100%;z-index:9999999999;"></iframe>'),e.comebacker_text},initNewsBlogIframe:function(e,n,a){var r=this;t(document).on("click","a",(function(){window.needShowComabacker=!1,setTimeout((function(){window.location.href=n}),200)}));var i=null,o=1e3*parseInt(a);t(document).on("mousemove keydown scroll",(function(){clearTimeout(i),i=setTimeout((function(){r.funcNewsBlogIframe(e,n)}),o)})),t("body").trigger("mousemove")},fireMetric:function(e){var n,a,r=void 0,i=void 0;void 0!==t(e).attr("data-goal")?r=i=t(e).attr("data-goal"):(r=t(e).attr("data-ym-goal"),i=t(e).attr("data-ga-goal")),a=t(e).attr("data-ga-goal-cat"),n=t(e).attr("data-ym-id"),!0===window.metricDebug&&console.log(n,r,i,a);try{void 0!==typeof n&&void 0!==typeof r&&t.globalEval("yaCounter"+n+".reachGoal('"+r+"');"),void 0!==typeof i&&("function"==typeof gtag?gtag("event",i,a?{event_category:a}:{}):ga("send",i,a?{eventCategory:a}:{}))}catch(t){!0===window.metricDebug&&console.log("metric doesnt install",t)}},initFireMetric:function(){var e=this;t(document).on("click","[data-trigger=click]",(function(t,n,a){a||e.fireMetric(this)})),t(document).on("submit","[data-trigger=submit]:not([data-kma-yacounter-id]):not([data-kma-ga-goal])",(function(){return!!t(this).parents("#kmacb-form").length||(e.fireMetric(this),!1)})),t(document).on("kma.cbform-validate",(function(n){return"submit"===t(n.target).attr("data-trigger")&&e.fireMetric(n.target),!1})),t(document).on("kma.callbackOperator",(function(n){"click"===t(n.target).attr("data-trigger")&&e.fireMetric(n.target)}))},initMethodForm:function(){t("form").attr("method","POST")},initDataCountry:function(){var e=this;e.changeDataCountry(window.country),e.changeDataNotCountry(window.country),t(".country_select").change((function(){e.changeDataCountry(t(this).val()),e.changeDataNotCountry(t(this).val())}))},eur:["AT","BG","GB","HU","DE","GR","ES","IT","CY","MK","NL","PL","PT","RO","RS","SK","SI","TR","FR","HR","CZ","CH","BE","IL","LV","LT","LU","NO","SE","EE"],sng:["RU","UA","BY","KZ","MD","KG","UZ","AZ","AM","TJ","TM","GE","UZ"],afr:["NG"],changeDataCountry:function(e){var n=this;t.each(t("[data-kma-country]"),(function(){var a=t(this).attr("data-kma-country").split(" ").join("").toUpperCase().split(","),r=t(this).is("[data-kma-class]")?t(this).attr("data-kma-class"):void 0,i=void 0;i=n.sng.indexOf(e)>-1?"SNG":n.eur.indexOf(e)>-1?"EUR":n.afr.indexOf(e)>-1?"AFR":"ASIA",a.indexOf(e)>-1||null!=i&&a.indexOf(i)>-1?null!=r?t(this).addClass(r):t(this).show():null!=r?t(this).removeClass(r):t(this).hide()}))},changeDataNotCountry:function(e){var n=this;t.each(t("[data-kma-not-country]"),(function(){var a=t(this).attr("data-kma-not-country").split(" ").join("").toUpperCase().split(","),r=void 0;r=n.sng.indexOf(e)>-1?"SNG":n.eur.indexOf(e)>-1?"EUR":n.afr.indexOf(e)>-1?"AFR":"ASIA",a.indexOf(e)>-1||null!=r&&a.indexOf(r)>-1?t(this).hide():t(this).show()}))},phoneMaxLen:25,checkPhoneLen:function(){var e=this;try{null!=window.phone_max_length&&""!=window.phone_max_length&&(e.phoneMaxLen=parseInt(window.phone_max_length))}catch(t){}t(document).on("keypress","input[name=phone]",(function(n){var a=new RegExp("[^0-9]*","g");t(this).val().replace(a,"").length>=e.phoneMaxLen&&n.preventDefault()}))},validateAndSendForm:function(e,n){var a=this;t(document).on("submit","form",(function(r,i){if(!t(this).closest("#kmacb-form").length){if(e&&a.prepareJsonData(t(this)),t("input[name=name]",this).val(t.trim(t("input[name=name]",this).val())),!t("input[name=name]",this).val())return alert(n.validation_name),!1;var o=t("input[name=phone]",this).val(),c=new RegExp("[^0-9]*","g"),l=new RegExp("[^0-9-+ ()]","g"),s=o.replace(c,"");if(-1!=o.search(l))return alert(n.validation_phone1),!1;if(!s||s.length<9)return alert(n.validation_phone2),!1;if(s.length&&s.length>a.phoneMaxLen)return alert(n.validation_phone3),!1;if(a.showComebackerAlert=!1,i)t("#kmacb-form form").trigger("kma.cbform-validate");else{try{var u=null==t(this).attr("data-kma-yacounter-id-important")?t(this).attr("data-kma-yacounter-id"):t(this).attr("data-kma-yacounter-id-important"),d=null==t(this).attr("data-kma-yacounter-goal-important")?t(this).attr("data-kma-yacounter-goal"):t(this).attr("data-kma-yacounter-goal-important");null!=u&&null!=d&&(u=u.trim(),d=d.trim(),""!=u&&""!=d&&window["yaCounter"+u].reachGoal(d),!0===window.metricDebug&&console.log(u,d))}catch(t){console.log("Exception: Yandex Metrica - yaCounter")}try{var m=t(this).attr("data-kma-ga-goal"),h=t(this).attr("data-kma-ga-goal-category");null!=m&&(m=m.trim(),"function"==typeof gtag?gtag("event",m,h?{event_category:h}:{}):ga("send",m,h?{eventCategory:h}:{})),null!=window.kma_order_ga_params&&("function"==typeof gtag?gtag("event",m,h?{event_category:h}:{}):ga("send",m,h?{eventCategory:h}:{})),!0===window.metricDebug&&console.log(m,h)}catch(t){console.log("Exception: Google Analitics - send event")}}return t(this).trigger("kma.form-validate"),!0}})),t("a.order-btn").click((function(){return t(this).closest("form").submit(),!1}))},prepareJsonData:function(e){var n=e.serializeArray(),a=!1;t(n).each((function(t,e){"address"==e.name&&(a=!0),"name"!=e.name&&"phone"!=e.name&&"address"!=e.name&&"client_data"!=e.name||delete n[t]})),0==a&&e.append("<input type='hidden' name='address' />"),e.find("input[name='address']").val(t.JSON.encode(n))},setTimezone:function(){var e=(new Date).getTimezoneOffset();t("form").append('<input type="hidden" name="timezone" value="'+e+'" />')}})}(jQuery,KMA||{});function change_country(t){if("undefined"==typeof country_list||null==country_list[t])return console.log("there is no such country in country_list"),!1;for(var e in 0==country_list[t].s1?($(".price_land_s1").text(text_item_is_free),$(".price_land_s1 + .price_land_curr").hide()):($(".price_land_s1").text(country_list[t].s1),$(".price_land_s1 + .price_land_curr").show()),$(".price_land_curr").text(country_list[t].curr),$(".price_land_s2").text(country_list[t].s2),$(".price_land_s3").text(country_list[t].s3),$(".price_land_s4").text(country_list[t].s4),$(".price_land_discount").text(country_list[t].discount),$(".price_field_s1").val(country_list[t].s1),$(".price_field_s2").val(country_list[t].s2),$(".price_field_s3").val(country_list[t].s3),$("rekv").html(country_list[t].rekv),$(".js-agreement-rekv").html(country_list[t].rekv),country_list[t].specialfields)$(".additional_fields_"+e).html(country_list[t].specialfields[e]);$("form input[name=campaign]").val(country_list[t].campaign)}function sendFormDataTmp(t,e,n){var a={},r=n.closest("form");switch(a.form_update_from_script=1,a.request_id=request_id,a.form_data={},t){case"name":e.length>4&&(a.fio=e);break;case"phone":e.length>8&&(a.phone=e);break;case"country":2==e.length&&(a.country=e)}$("input",r).each((function(){var t=$(this).attr("name"),e=$(this).val();void 0!==t&&""!=t&&void 0!==e&&""!=e&&(a.form_data[t]=e)})),$("select",r).each((function(){var t=$(this).attr("name"),e=$(this).val();void 0!==t&&""!=t&&void 0!==e&&""!=e&&(a.form_data[t]=e)})),$.get(tmp_data_to_server,a)}$((function(){"undefined"!=typeof list_of_parameters&&jQuery.each($('form[action="'+action_url+'"]'),(function(t,e){for(key_param in list_of_parameters)0==$(e).find("input[name="+key_param+"]").length&&$(e).append('<input type="hidden" name="'+key_param+'" value="'+list_of_parameters[key_param]+'" />')}))})),$((function(){try{$(document).on("change",".country_select",(function(){change_country($(this).val()),$(".country_select").val($(this).val())}))}catch(t){$(".country_select").live("change",(function(){change_country($(this).val()),$(".country_select").val($(this).val())}))}change_country(country),setTimeout((function(){$('form[action="'+action_url+'"] .country_select').length&&$('form[action="'+action_url+'"] .country_select').val()!=country&&($('form[action="'+action_url+'"] .country_select').val(country),$('form[action="'+action_url+'"] .country_select').trigger("change"))}),500)})),$((function(){$('form[action="'+action_url+'"] input').blur((function(t){var e=$(t.currentTarget);"name"!=e.attr("name")&&"phone"!=e.attr("name")||(void 0===e.attr("oldvalue")?oldval="":oldval=e.attr("oldvalue"),oldval!=e.val()&&(e.attr("oldvalue",e.val()),sendFormDataTmp(e.attr("name"),e.val(),e)))})),$('form[action="'+action_url+'"] input').each((function(){var t=$(this);"name"!=t.attr("name")&&"phone"!=t.attr("name")||(t.attr("oldvalue",t.val()),""!=t.val()&&sendFormDataTmp(t.attr("name"),t.val(),t))}))})),$((function(){city&&$(".geocity,.user-city").text(city)})),$((function(){0===country_list[country].s1?($(".price_land_s1").text(text_item_is_free),$(".hidden-pzero, .price_land_curr").hide(),$(".price_land_s4 + .price_land_curr").show(),$(".show-pzero").show(),$(".price_land_s1").each((function(t,e){var n=$(e).parent();n.find(".price_land_curr").length>0&&0===n.find("script").length&&n.html(n.html().replace(/span> <span class="price_land_curr/g,'span><span class="price_land_curr'))}))):($(".show-pzero").hide(),$(".price_land_s1").each((function(t,e){var n=$(e).parent();if("."===n.find(".price_land_curr:last").text().substr(n.find(".price_land_curr:last").text().length-1)&&-1!==$.inArray(n.html().substr(n.html().length-2),[">.",'."'])&&0===n.find("script").length)switch(n.html().substr(n.html().length-2)){case'."':n.html(n.html().substr(0,n.html().length-2)+'"');break;case">.":n.html(n.html().substr(0,n.html().length-2)+">")}})))}));