const okay={};okay.router={};okay.router.OkayCMS_NovaposhtaCost_find_city='https://profildoorsarh.ru/ajax/np/find_city';okay.router.OkayCMS_NovaposhtaCost_find_city_for_door='https://profildoorsarh.ru/ajax/np/find_city_for_door';okay.router.OkayCMS_NovaposhtaCost_find_street='https://profildoorsarh.ru/ajax/np/find_street';okay.router.OkayCMS_NovaposhtaCost_get_cities='https://profildoorsarh.ru/ajax/np/get_cities';okay.router.OkayCMS_NovaposhtaCost_get_warehouses='https://profildoorsarh.ru/ajax/np/get_warehouses';okay.router.OkayCMS_NovaposhtaCost_calc='https://profildoorsarh.ru/ajax/np/calc';okay.router.cart_ajax='https://profildoorsarh.ru/ajax/cart_ajax.php';okay.router.wishlist_ajax='https://profildoorsarh.ru/ajax/wishlist.php';okay.router.comparison_ajax='https://profildoorsarh.ru/ajax/comparison.php';okay.router.ajax_search='https://profildoorsarh.ru/ajax/search_products';okay.change_payment_method=function(){let delivery_input=$('input[name="delivery_id"]:checked');let current_payment_id=$('input[name="payment_method_id"]:checked').val();let delivery_id=delivery_input.val();let payments_ids=new Array();if(String(delivery_input.data('payment_method_ids')).length>0){payments_ids=String(delivery_input.data('payment_method_ids')).split(',')} $(".fn_payment_method__item").hide().find('input[name="payment_method_id"]').prop('disabled',!0);$(".fn_payment_method__item").find('input[name="payment_method_id"]').not('[value="'+current_payment_id+'"]').prop('checked',!1);if(payments_ids.length>0){payments_ids.forEach(function(payment_id,i,arr){let payment_block=$(".fn_payment_method__item_"+payment_id);let payment_input=payment_block.find('input[name="payment_method_id"]');let currency_id=payment_input.data('currency_id');payment_block.show();payment_block.find('.fn_payment_price').text(okay.convert(delivery_input.data('total_price'),currency_id));payment_input.prop('disabled',!1)});$('.fn_payments_block').show();if($('input[name="payment_method_id"][value="'+current_payment_id+'"]').is(':disabled')){$(".fn_payment_method__item:visible").first().find('input[name="payment_method_id"]').prop('checked',!0).trigger('click')}}else{$('.fn_payments_block').hide()} okay.update_cart_total_price();$('input[name="delivery_id"]').parent().removeClass('active');$('#deliveries_'+delivery_id).parent().addClass('active')};okay.update_cart_total_price=function(){let delivery_input=$('input[name="delivery_id"]:checked');$('#fn_cart_total_price').text(okay.convert(delivery_input.data('total_price')));$('#fn_total_purchases_price').text(okay.convert($('.fn_purchases_wrap').data('total_purchases_price'),null,!0,!0));if(delivery_input.data('is_free_delivery')){$('#fn_total_free_delivery').show();$('#fn_total_delivery_price').hide()}else{$('#fn_total_free_delivery').hide();$('#fn_total_delivery_price').text(okay.convert(delivery_input.data('delivery_price'),null,!0,!0)).show()} if(delivery_input.data('separate_payment')==!0&&delivery_input.data('is_free_delivery')==!1){$('#fn_total_separate_delivery').show()}else{$('#fn_total_separate_delivery').hide()}};okay.convert=function(price,currencyId=null,format=!0,withCurrency=!1){if(currencyId===null){currencyId=2} let currencies=Object.create(null);currencies[2]={'rate_from':'1.00','rate_to':'1.00','cents':'0','sign':'руб',};let currency=currencies[currencyId];if(typeof currency=="undefined"){console.error('currency ID='+currencyId+' is not defined');return'currency error'} let decimal=currency.cents;let dec_point=',';let separator=' ';let res=parseFloat(price*currency.rate_from/currency.rate_to);if(format===!0){res=Number(res).toFixed(decimal).toString().split('.');let b=res[0].replace(/(\d{1,3}(?=(\d{3})+(?:\.\d|\b)))/g,"\$1"+separator);res=(res[1]?b+dec_point+res[1]:b);if(withCurrency===!0){res+=' '+currency.sign}}else{res=Number(res).toFixed(decimal)} return res}