
$(document).ready(function(){var settings_for_site_auto_scroll=$("#settings_for_site_auto_scroll").val();var settings_for_site_preview_dd=$("#settings_for_site_preview_dd").val();var settings_for_site_audio=$("#settings_for_site_audio").val();if(!window.SVGAngle){var oldBrowser=true;$(".svg_img").each(function(){$(this).attr('src',$(this).attr('src').replace('.svg','.png'));});}else{var oldBrowser=false;}
$(".thisdurl").click(function(){window.open(this.href,'_top');});$(".calendar_td.url").click(function(){window.open($(this).find('a[href]:first').attr("href"),'_top');});$(window).scroll(function(){var win_width=$(window).width();var win_height=$(window).height();var max_top=5;$('#winw').val(win_width);if($(this).scrollTop()>1&&$("div").is("#header_adv")){$('#header').css("top","0");$('#header_adv').hide();}
if($(this).scrollTop()>400&&$("div").is(".dd_bmbt")){$('.dd_bmbt').fadeIn('200');}else{$('.dd_bmbt').fadeOut('200');}
if($(this).scrollTop()>max_top){if(!$('.header_menu.mobile').is(':visible')){$('#header').css("background","url('/img/top_gradient.png') repeat-x top");}else{$('#header').css("background","url('/img/top_gradient_mobile.png') repeat-x top");}
$("#open_header_menu").click(function(){$("html, body").animate({scrollTop:0},0);return false;});}else{$("#header").removeAttr("style");}});$('.change_lang').click(function(){if(!$('.area_basic').is(':visible')){$('.area_basic').show();$('.area_alt').hide();}else{$('.area_basic').hide();$('.area_alt').show();}
if($('#temp_control').length>0){$('#temp_control').trigger('click');}
return false;});$('.open_tips').click(function(){if(!$(this).next('.tips').is(':visible')){$(this).next('.tips').slideDown(500);}else{$(this).next('.tips').slideUp(500);}
return false;});function control_win_resize(){var win_height=$(window).height();var win_width=$(window).width();window.current_win_width=$(window).width();$('#winw').val(win_width);if(win_width>640){$('#drop_menu_left').removeClass('open');$('#header, #content_div').removeClass('drop_left');$("#full_path").show();}}
control_win_resize();$(window).resize(function(){control_win_resize()});if($('.mb_special').length>0&&$('#winw').val()>1170){$('.mb_special').delay(2750).animate({"padding-bottom":"0px"},700);$('.show_special_bckgr').click(function(){if($('.mb_special').css("padding-bottom")=="0px"){$('.mb_special').animate({"padding-bottom":"250px"},700);}else{$('.mb_special').animate({"padding-bottom":"0px"},700);}});}
$('.search_input').focus(function(){$("html, body").animate({scrollTop:0},0);});$('.header_menu.default #search_ico').click(function(){if($('.s_def_style').is(':visible')){$('.s_def_style').hide();}else{$('.s_def_style').show().focus();}});$(".deal_img_div_mobile, .act_img_div_mobile, .td_deal_img_div_mobile, .td_edit_img_div_mobile").click(function(){if($(this).height()==200){$(this).css({height:"100%"});$('.deal_img_200_gr').hide();}else{$(this).css({height:"200px"});$('.deal_img_200_gr').show();}});$('.header_menu.mobile #mobile_menu_div #search_ico').click(function(){$('.header_menu.mobile #mobile_menu_div').hide();$('.header_menu.mobile #mobile_menu_back').show();$('.header_menu.mobile #mobile_search_div').show();$('.s_mob_style').focus();return false;});$('#mobile_menu_left, #mobile_menu_back').click(function(){if($('#mobile_menu_left').is(':visible')){$('#mobile_menu_left').hide();$('#mobile_menu_back').show();}else{$('#mobile_menu_back').hide();$('#mobile_menu_left').show();$('.header_menu.mobile #mobile_search_div').hide();$('.header_menu.mobile #mobile_menu_div').show();$('.s_mob_style').blur();$('#top_search_result').hide();$("#full_black_screen").fadeOut(300);return false;}
return false;});$('#pay_ok').click(function(){$(this).hide();});$('.show_map_of_site').click(function(){if($('#drop_menu_right_map').is(':visible')){$(".show_map_of_site").removeClass('active');$('#drop_menu_right_map').removeClass('open');$('#header, #content_div').removeClass('drop_right');$("#full_black_screen").fadeOut(300);$('#top_search_result').hide();$('#trouble_mail').hide();}else{$("html, body").animate({scrollTop:0},0);$('#drop_menu_right_map').addClass('open');$('#drop_menu_right').removeClass('open');$('#drop_menu_left').removeClass('open');$(".show_map_of_site").addClass('active');$('#header, #content_div').removeClass('drop_left');$("#full_black_screen").fadeIn(300);$('#top_search_result').hide();$('#trouble_mail').fadeIn(300);}});$('.user_self_servive, #user_login, .goto_login').click(function(){if($('#drop_menu_right').is(':visible')){$(".user_self_servive").removeClass('active');$('#drop_menu_right').removeClass('open');$('#header, #content_div').removeClass('drop_right');$("#full_black_screen").fadeOut(300);$('#top_search_result').hide();$('#trouble_mail').fadeIn(300);}else{$("html, body").animate({scrollTop:0},0);$(".show_map_of_site").removeClass('active');$('#drop_menu_right_map').removeClass('open');$('#drop_menu_right').addClass('open');$(".user_self_servive").addClass('active');$('#drop_menu_left').removeClass('open');$('#header, #content_div').removeClass('drop_left');$("#full_black_screen").fadeIn(300);$('#top_search_result').hide();$('#trouble_mail').hide();}});$("#full_black_screen").click(function(){$("#full_black_screen").fadeOut(300);$('#drop_menu_right').removeClass('open');$(".user_self_servive").removeClass('active');$(".show_map_of_site").removeClass('active');$('#top_search_result').hide();$('#trouble_mail').fadeIn(300);});$('#wbs').click(function(){if(!$('#wbs_select').is(':visible')){$('#wbs_select').slideDown(500);}else{$('#wbs_select').slideUp(500);}});$('#wbsl').click(function(){if(!$('#wbsl_select').is(':visible')){$('#wbsl_select').slideDown(500);}else{$('#wbsl_select').slideUp(500);}});$('#wbs_fptd_right').click(function(){if(!$('#wbs_fptd_select').is(':visible')){$('#wbs_fptd_select').slideDown(500);}else{$('#wbs_fptd_select').slideUp(500);}});$('#fp_search_big_input').keyup(function(){var q=$(this).val();if(q.length>=3){$('.search_input').focus().val(q);$('.search_input').trigger('keyup');$('#mobile_menu_left, .header_menu.mobile #mobile_menu_div #search_ico').trigger('click');$(this).val('');}else{return false;}});$('#show_filters, #close_filters').click(function(){if(!$('#add_param').is(':visible')){$('#add_param').slideDown(1000);var dest=$('#add_param').offset().top;$('html,body').animate({scrollTop:dest-55},500);}else{$('#add_param').slideUp(500);$('html,body').animate({scrollTop:0},500);}});$('.add_param_deal').click(function(){$(this).hide();$(this).prevAll().slideDown(500);$(this).parents('td').prev('td').find('.clang').slideDown(500);});$('#reminder_bottom').click(function(){if($('#reminder').is(':visible')){$('#reminder, #login_title').hide();$('#login, #reminder_title, #social_logos').show();}else{$('#reminder, #login_title').show();$('#login, #reminder_title, #social_logos').hide();}});$('#social_more').click(function(){if($('#social_logos_more').is(':visible')){$('#social_logos_more').hide();$('#social_more').show();}else{$('#social_logos_more').show();$('#social_more').hide();}});$("#login_form.button_green, #reminder_form.button_green, #social_logo").click(function(){$("#login, #reminder, #social_logos, #reminder_bottom").hide();$("#loading").show();});var accordion_head=$('.accordion > li > a'),accordion_body=$('.accordion li > .sub-menu');accordion_head.on('click',function(event){if($(this).attr('id')!='logout'){if($(this).attr('class')!='active'){accordion_body.slideUp(0);$(this).next().stop(true,true).slideToggle(0);accordion_head.removeClass('active');$(this).addClass('active');return false;}else{$(this).next().slideUp(0);$(this).removeClass('active');return false;}}});$("#expf #tp, #date_from, #date_to, #show_only_used, #show_all, #date_type, #date_type_used, #date_type_all, #expf #new, #expf #used, #expf #exp, #expf #all, #expf #inbox, #expf #sent_items, #expf #smp, #expf #dlvry, #expf #ticket, #expf #sd, #expf #sm, #expf #sy, #expf #idact, #expf #p24, #expf #p24t_pa, #expf #p24t_pv, #expf #p24t_pu, #expf #all_shwtp, #expf #adv, #expf #reg, #expf #all_shwst, #expf #active, #expf #work, #expf #pending, #expf #archive, #expf #process, #expf #prepaid, #expf #activation").change(function(){$("#expf").submit();});$("#feedback_link").click(function(){var dest=$('#feedback_div').offset().top;$('html,body').animate({scrollTop:dest-60},500);return false;});$("#voucher_delete, #close_form_delete").click(function(){if(!$('#voucher_delete_div').is(':visible')){$("#voucher_delete_div").show();$("#voucher_gift_div").hide();var dest=$('#voucher_delete_div').offset().top;$('html,body').animate({scrollTop:dest-60},500);}else{$("#voucher_gift_div").slideUp(500);$("#voucher_delete_div").slideUp(500);}
return false;});$("#voucher_gift, #close_form_gift").click(function(){if(!$('#voucher_gift_div').is(':visible')){$("#voucher_delete_div").hide();$("#voucher_gift_div").show();var dest=$('#voucher_gift_div').offset().top;$('html,body').animate({scrollTop:dest-60},500);}else{$("#voucher_gift_div").slideUp(500);$("#voucher_delete_div").slideUp(500);}
return false;});$("#change_cc_type").click(function(){var url=$("#cc_type_url").val();$.fancybox({type:'iframe',href:url,maxWidth:640,maxHeight:300,autoSize:true})});tooltip();screenshotPreview();imagePreview();$(".false").click(function(){return false;});if($('.fancybox').length>0||$('.popupwin').length>0||$('.popupshop').length>0||$('.shrarer').length>0||$('.vopen').length>0||$('.advert_popup').length>0){$('.fancybox').fancybox();$('.popupwin').fancybox({maxWidth:640,fitToView:true,width:'100%',height:'100%',autoSize:false,closeClick:true,openEffect:'none',closeEffect:'none',scrolling:'auto',preload:true});$('.popupshop').fancybox({maxWidth:1200,maxHeight:800,fitToView:true,width:'100%',height:'100%',autoSize:true,closeClick:true,openEffect:'none',closeEffect:'none',scrolling:'auto',preload:true});$('.shrarer').fancybox({maxWidth:640,fitToView:true,autoSize:true,autoHeight:true,closeClick:true,openEffect:'none',closeEffect:'none',scrolling:'auto',preload:true});$('.advert_popup').fancybox({maxWidth:350,fitToView:true,autoSize:true,autoHeight:true,closeClick:true,openEffect:'none',closeEffect:'none',scrolling:'auto',preload:true});$(".vopen").fancybox({fitToView:true,width:'100%',height:'100%',autoSize:false,closeClick:true,openEffect:'none',closeEffect:'none',scrolling:'auto',preload:true});$(".fancybox-effects-a").fancybox({helpers:{title:{type:'outside'},overlay:{speedOut:0}}});$(".fancybox-effects-b").fancybox({openEffect:'none',closeEffect:'none',helpers:{title:{type:'over'}}});$(".fancybox-effects-c").fancybox({wrapCSS:'fancybox-custom',closeClick:true,openEffect:'none',helpers:{title:{type:'inside'},overlay:{css:{'background':'rgba(238,238,238,0.85)'}}}});$(".fancybox-effects-d").fancybox({padding:0,openEffect:'elastic',openSpeed:150,closeEffect:'elastic',closeSpeed:150,closeClick:true,helpers:{overlay:null}});}
if($('label').length>0){$("label[for]").each(function(){var timeout;var element=$("#"+$(this).attr("for"));$(this).on("click",function(){timeout=setTimeout(function(){element.click();},0);});element.on("click",function(){clearTimeout(timeout);});});}
$(".vzoom").hover(function(){$(this).append('<img src="/img/icons/phzoom.png" class="zoom" width="60" height="60" style="display: none;" />');var img=$(document).find(".zoom");$(img).fadeIn(100);},function(){var img=$(document).find(".zoom");$(img).fadeOut(200,function(){$(img).remove();});});$(".open_multiselect").click(function(){$("#parent_div, .deal_img_div_mobile, #liisi_form").hide();$("#multiselect").fadeIn('normal');$("html, body").animate({scrollTop:0},150);});if(!oldBrowser){$(".fl_deals_fp").hover(function(){$(this).css({'z-index':'100'});if(settings_for_site_preview_dd==1){$("#full_black_screen").delay(750).fadeIn(1750);}
if(current_win_width>600){$(this).find('.fl_deals_fp_title').delay(0).hide().slideDown(350);$(this).find('.fl_deals_fp_button').delay(1500).fadeIn(1000);}else{$(this).find('.fl_deals_fp_title').delay(0).hide().show();$(this).find('.fl_deals_fp_button').fadeIn(1000);$(this).find('.fl_deals_fp_close').show();}
if(settings_for_site_auto_scroll==1||current_win_width<600){var dest=$(this).offset().top;$('html,body').delay(100).animate({scrollTop:dest-70},500);}
$(this).find('.fl_deals_fp_gradient, .fl_deals_fp_gradient_1, .fl_deals_showed').hide();$(this).find('.fl_deals_fp_title').toggleClass('fl_deals_fp_title fl_deals_fp_title_hover');},function(){$("#full_black_screen, .fl_deals_fp_button, .fl_deals_fp_close").stop(true).fadeOut(0);$(this).removeAttr("style");$(this).find('.fl_deals_fp_title_hover').toggleClass('fl_deals_fp_title_hover fl_deals_fp_title');$(this).find('.fl_deals_fp_gradient, .fl_deals_fp_gradient_1, .fl_deals_showed').delay(240).fadeIn(750);if(settings_for_site_auto_scroll==1){$('html,body').stop(true);}});}
$(".fl_deals_fp_close").click(function(){$('#full_black_screen, .fl_deals_fp_button, .fl_deals_fp_close').stop(true).fadeOut(0);$(this).parents(':eq(1)').find('.fl_deals_fp').removeAttr("style");$(this).parents(':eq(1)').find('.fl_deals_fp_title_hover').toggleClass('fl_deals_fp_title_hover fl_deals_fp_title');$(this).parents(':eq(1)').find('.fl_deals_fp_gradient, .fl_deals_fp_gradient_1, .fl_deals_showed').show();return false;});$(".fl_deals_fp_incl").click(function(){url=$(this).parents(':eq(1)').find('.check_thisdurl').attr("href");if(current_win_width<900){if($(this).parents(':eq(1)').find('.check_thisdurl').css("margin-top")=='1px'){window.open(url,'_top');}else{return false;}}else{$('#full_black_screen').stop(true).fadeOut(0);}});if($('.swiper-container').length>0){if(oldBrowser){var mySwiper=$('.swiper-container').swiper({mode:'horizontal',speed:1000,autoResize:true});}else{var mySwiper=$('.swiper-container').swiper({mode:'horizontal',speed:1000,autoResize:true,loop:true,pagination:'.pagination',paginationClickable:true});}
$(".swiper-container").hover(function(){$('.wide_big_div').fadeIn(750);},function(){if(current_win_width>750){$('.wide_big_div').delay(750).fadeOut(1000);}});$('.swiper-arrow-left').on('click',function(e){e.preventDefault()
mySwiper.swipePrev()})
$('.swiper-arrow-right').on('click',function(e){e.preventDefault()
mySwiper.swipeNext()})}
if(!oldBrowser){if(settings_for_site_audio==1){$(".header_menu.default .pic_menu").mouseenter(function(){var sdiv=$("#audio_1")[0];sdiv.volume=0.05;sdiv.load();sdiv.play();});$("#logo_mv").mouseenter(function(){var sdivl=$("#audio_2")[0];sdivl.volume=0.2;sdivl.load();sdivl.play();});}}
$(".file-upload-override-button").click(function(){$("#file-upload-button").trigger('click');});$("#file-upload-button").change(function(){var fileName=$(this).val().replace('C:\\fakepath\\','');$("#file-upload-filename").html('>> '+fileName);});$(".file-upload-override-button-small").click(function(){$("#file-upload-button-small").trigger('click');});$("#file-upload-button-small").change(function(){var fileName=$(this).val().replace('C:\\fakepath\\','');$(".file-upload-override-button-small").val('>> '+fileName);});$(".upl-img-button").click(function(){$(this).prev().trigger('click');});$(document).on("click",".delete_file",function(event){var user=$(this).attr('user');var dir=$(this).attr('dir');var type_of=$(this).attr('type_of');var picname=$(this).attr('picname');var id=$(this).attr('id');$.ajax({url:"/ajax/delete_file.php",type:"GET",data:{"type_of":type_of,"user":user,"dir":dir,"picname":picname,"id":id},cache:false,success:function(){}});if(type_of=="avatar"){$(this).remove();$("#self_avatar").attr('src',"/img/no_image.jpg");$('#self_avatar').html(user);}else if(type_of=="photo"||type_of=="video"){$(".delete_file").parent('div').parent('div').remove();}else if(type_of=="ticket"){$(this).parent('li').remove();}
return false;});$(".confirm_button").click(function(){if($(this).parents(':eq(1)').find('.accept').is(':checked')){$(this).parents('form').submit();}else{$(this).parents(':eq(1)').find('.confirm_attention').addClass('dred');}});$(".search_input").keyup(function(){var q=$(this).val();var partner_id=$("#cur_partner").val();if(q.length>=3&&q.length<150){$.ajax({url:"/ajax/search.php",type:"GET",data:{"q":q,"partner_id":partner_id},cache:false,success:function(html){$("#top_search_result").show()
$("#top_search_result").empty();$("#top_search_result").append(html);$("#full_black_screen").fadeIn(300);$('#drop_menu_right').removeClass('open');$('#trouble_mail').hide();}});}else{$("#top_search_result").empty();$("#top_search_result").hide();$("#full_black_screen").fadeOut(300);}});if($('.no_brake_textarea').length>0){$('.no_brake_textarea').each(function(){var text=$(this).html();new_text=text.replace(/%%%/g,'\n');$(this).html(new_text);});}
$(".delete_comment").click(function(){var id=$(this).attr('vid');$.ajax({url:"ajax/delete_comment.php",type:"GET",data:{"id":id},cache:false,success:function(){}});$("#cmnt_"+id).remove();return false;});$('.title_store').hover(function(){if($('#div_about_parnter').length>0&&!$('#div_about_parnter').is(':visible')){$('#div_about_parnter').slideDown(500);$('#div_about_parnter_dir').slideDown(500);$('.pic_menu_center').slideUp(100);}});});(function(t){"use strict";function e(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0}function r(t,e){var r,n;for(r=0,n=t.length;n>r;r++)if(t[r]===e)return!0;return!1}function n(t,e){var r;t.createTextRange?(r=t.createTextRange(),r.move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))}function a(t,e){try{return t.type=e,!0}catch(r){return!1}}t.Placeholders={Utils:{addEventListener:e,inArray:r,moveCaret:n,changeType:a}}})(this),function(t){"use strict";function e(){}function r(){try{return document.activeElement}catch(t){}}function n(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(V);return(a||u)&&"true"===t.getAttribute(D)?(t.removeAttribute(D),t.value=t.value.replace(t.getAttribute(V),""),t.className=t.className.replace(R,""),n=t.getAttribute(F),parseInt(n,10)>=0&&(t.setAttribute("maxLength",n),t.removeAttribute(F)),r=t.getAttribute(P),r&&(t.type=r),!0):!1}function a(t){var e,r,n=t.getAttribute(V);return""===t.value&&n?(t.setAttribute(D,"true"),t.value=n,t.className+=" "+I,r=t.getAttribute(F),r||(t.setAttribute(F,t.maxLength),t.removeAttribute("maxLength")),e=t.getAttribute(P),e?t.type="text":"password"===t.type&&M.changeType(t,"text")&&t.setAttribute(P,"password"),!0):!1}function u(t,e){var r,n,a,u,i,l,o;if(t&&t.getAttribute(V))e(t);else for(a=t?t.getElementsByTagName("input"):b,u=t?t.getElementsByTagName("textarea"):f,r=a?a.length:0,n=u?u.length:0,o=0,l=r+n;l>o;o++)i=r>o?a[o]:u[o-r],e(i)}function i(t){u(t,n)}function l(t){u(t,a)}function o(t){return function(){m&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)?M.moveCaret(t,0):n(t)}}function c(t){return function(){a(t)}}function s(t){return function(e){return A=t.value,"true"===t.getAttribute(D)&&A===t.getAttribute(V)&&M.inArray(C,e.keyCode)?(e.preventDefault&&e.preventDefault(),!1):void 0}}function d(t){return function(){n(t,A),""===t.value&&(t.blur(),M.moveCaret(t,0))}}function g(t){return function(){t===r()&&t.value===t.getAttribute(V)&&"true"===t.getAttribute(D)&&M.moveCaret(t,0)}}function v(t){return function(){i(t)}}function p(t){t.form&&(T=t.form,"string"==typeof T&&(T=document.getElementById(T)),T.getAttribute(U)||(M.addEventListener(T,"submit",v(T)),T.setAttribute(U,"true"))),M.addEventListener(t,"focus",o(t)),M.addEventListener(t,"blur",c(t)),m&&(M.addEventListener(t,"keydown",s(t)),M.addEventListener(t,"keyup",d(t)),M.addEventListener(t,"click",g(t))),t.setAttribute(j,"true"),t.setAttribute(V,x),(m||t!==r())&&a(t)}var b,f,m,h,A,y,E,x,L,T,N,S,w,B=["text","search","url","tel","email","password","number","textarea"],C=[27,33,34,35,36,37,38,39,40,8,46],k="#ccc",I="placeholdersjs",R=RegExp("(?:^|\\s)"+I+"(?!\\S)"),V="data-placeholder-value",D="data-placeholder-active",P="data-placeholder-type",U="data-placeholder-submit",j="data-placeholder-bound",q="data-placeholder-focus",z="data-placeholder-live",F="data-placeholder-maxlength",G=document.createElement("input"),H=document.getElementsByTagName("head")[0],J=document.documentElement,K=t.Placeholders,M=K.Utils;if(K.nativeSupport=void 0!==G.placeholder,!K.nativeSupport){for(b=document.getElementsByTagName("input"),f=document.getElementsByTagName("textarea"),m="false"===J.getAttribute(q),h="false"!==J.getAttribute(z),y=document.createElement("style"),y.type="text/css",E=document.createTextNode("."+I+" { color:"+k+"; }"),y.styleSheet?y.styleSheet.cssText=E.nodeValue:y.appendChild(E),H.insertBefore(y,H.firstChild),w=0,S=b.length+f.length;S>w;w++)N=b.length>w?b[w]:f[w-b.length],x=N.attributes.placeholder,x&&(x=x.nodeValue,x&&M.inArray(B,N.type)&&p(N));L=setInterval(function(){for(w=0,S=b.length+f.length;S>w;w++)N=b.length>w?b[w]:f[w-b.length],x=N.attributes.placeholder,x?(x=x.nodeValue,x&&M.inArray(B,N.type)&&(N.getAttribute(j)||p(N),(x!==N.getAttribute(V)||"password"===N.type&&!N.getAttribute(P))&&("password"===N.type&&!N.getAttribute(P)&&M.changeType(N,"text")&&N.setAttribute(P,"password"),N.value===N.getAttribute(V)&&(N.value=x),N.setAttribute(V,x)))):N.getAttribute(D)&&(n(N),N.removeAttribute(V));h||clearInterval(L)},100)}M.addEventListener(t,"beforeunload",function(){K.disable()}),K.disable=K.nativeSupport?e:i,K.enable=K.nativeSupport?e:l}(this);function show_cart(currency){var total_items=$('#total_items').val();var total_balance=parseFloat($('#total_balance').val());var liisi_select=$("#liisi_select").is(":checked");var total_price_basket=0;var leasing_period=parseInt($("#leasing_period").val());var promocode_value=parseInt($('#promocode_value').val());var referral_value=parseFloat($('#referral_value').val());var leasing_total=0;var leasing_sample_price=0;var total_smartpost_price=0;var total_post24_price=0;var total_delivery_price=0;var total_dpd_price=0;var delivery_div=false;var smartpost_data=false;var post24_data=false;var dpd_data=false;var all_p24=new Array();var all_smp=new Array();var all_dpd=new Array();var total_items=0;var total_economy=0;var full_price_cart=0;$(".item").each(function(){var id_item=$(this);var price=parseFloat($(this).find(".select_price").val());var total_value=parseInt($(this).find(".total_count").val());var idu_item=String($(this).find("input:hidden[name='idu']").val());var idp_item=$(this).find("input:hidden[name='idp']").val();var strdlvry=$(this).find(".strdlvry").val();var sel_dlvry=parseInt($(this).find(".select_delivery_type").val());var smartpost_price=parseFloat($("#smp_price_"+idp_item).val());var post24_price=parseFloat($("#p24_price_"+idp_item).val());var dpd_price=parseFloat($("#dpd_price_"+idp_item).val());if($(this).find(".more_discount_price").val()>0){var more_discount_price=parseFloat($(this).find(".more_discount_price").val()).toFixed(2);}else{var more_discount_price=0;}
if(total_value>1){$(this).find(".select_type_voucher").show();}else{$(this).find(".select_type_voucher").hide();}
$(this).find(".vs_select").click(function(){$(id_item).find("input.separated").prop('checked',true);return false;});$(this).find(".vo_select").click(function(){$(id_item).find("input.one").prop('checked',true);return false;});if(sel_dlvry>1||strdlvry==1){if($.inArray(idp_item,all_smp)<0&&sel_dlvry==2){all_smp.push(idp_item);total_smartpost_price=total_smartpost_price+smartpost_price;}
if($.inArray(idp_item,all_dpd)<0&&sel_dlvry==3){all_dpd.push(idp_item);total_dpd_price=total_dpd_price+dpd_price;}
if($.inArray(idp_item,all_p24)<0&&sel_dlvry==4){all_p24.push(idp_item);total_post24_price=total_post24_price+post24_price;}
$(this).find(".select_type_voucher").hide();if(all_smp.length>0||all_dpd.length>0||all_p24.length>0){delivery_div=true;}
if(sel_dlvry==2){smartpost_data=true;}
if(sel_dlvry==4){post24_data=true;}
if(sel_dlvry==3){dpd_data=true;}}
var more_discount_price_total=more_discount_price*total_value;var total_price_item=total_value*price-more_discount_price_total;total_price_basket=total_price_basket+total_price_item;$(this).find(".total_summ").html(parseFloat(total_price_item).toFixed(2));$(this).find(".total_more_discount").html(parseFloat(more_discount_price_total).toFixed(2));if($(this).find('.remove_item').val()!=1){total_items++;}
$(this).find(".remove_id").click(function(){$(id_item).hide();$(id_item).find('.remove_item').attr("value",1);$(id_item).find('.select_price').attr("value",0);$.ajax({url:"cart.php",type:"POST",cache:false,data:$('#order_form').serialize(),success:function(response){document.forms['#order_form'].submit();return false;}});$("#order_form").change();$(this).unbind('click',handler);});});if(delivery_div){$(".delivery_div").show();}else{$(".delivery_div").hide();}
if(smartpost_data){$(".smartpost_data").show();}else{$(".smartpost_data").hide();}
if(post24_data){$(".post24_data").show();}else{$(".post24_data").hide();}
if(dpd_data){$(".dpd_data").show();}else{$(".dpd_data").hide();}
total_delivery_price=total_dpd_price+total_smartpost_price+total_post24_price;$("#dlv_price").html(parseFloat(total_delivery_price).toFixed(2));total_price_basket=total_price_basket+total_smartpost_price+total_dpd_price+total_post24_price;if(total_balance+referral_value>=total_price_basket){total_economy=parseFloat(total_price_basket).toFixed(2);$("#no_bank_links").show();$("#bank_links, #div_promocode, #div_promocode_checkbox").hide();total_economy=parseFloat(total_price_basket).toFixed(2);}else{total_economy=parseFloat(total_balance+promocode_value+referral_value).toFixed(2);if(total_economy>=total_price_basket){$("#bank_links, #div_promocode, #div_promocode_checkbox").hide();$("#no_bank_links").show();total_economy=total_price_basket;}else{$("#bank_links, #div_promocode_checkbox").show();$("#no_bank_links").hide();}}
$("#bonus_money").html(total_economy);full_price_cart=parseFloat(total_price_basket).toFixed(2);total_price_basket=parseFloat(total_price_basket-total_economy).toFixed(2);if(total_price_basket<0){total_price_basket=0;}
$("#total_summ_bank").html(total_price_basket);$("#full_price_cart").html(full_price_cart);if(total_items==0){$("#payerdata").remove();}
if(total_price_basket>=10){$("#leasing_checkbox").show();if(liisi_select){$("#leasing_calculator, #leasing_descr, #after_leasing_descr").show();$("#bank_links, #leasing_price_title, #div_promocode").hide();}else{$("#leasing_descr, #leasing_calculator, #after_leasing_descr").hide();$("#bank_links, #leasing_price_title").show();}
var to_leasing=total_price_basket;var m_payment=liisi_counter(to_leasing,leasing_period);if(m_payment<7){var to_leasing=total_price_basket;var leasing_period=Math.round(to_leasing/7);$('#leasing_period').prop('value',leasing_period);var m_payment=liisi_counter(to_leasing,leasing_period);}
leasing_sample_price=parseFloat(m_payment).toFixed(2);leasing_total=parseFloat(leasing_period*m_payment).toFixed(2);$("#leasing_price").html(leasing_sample_price);$('#leasing_period_value').prop('value',leasing_period);$("#leasing_total").html(leasing_total);$("#leasing_price_1").html(leasing_sample_price);$('#leasing_period_value_1').html(leasing_period);}else{$("#leasing_checkbox").hide();$('#liisi_select').prop('checked',false);$("#leasing_calculator").hide();$('#leasing_period_value').prop('value','0');}}
function liisi_counter(to_leasing,leasing_period){var to_leasing;var leasing_period;var complects=new Array('500-999.99,7-12,12.5','500-999.99,25-60,14','500-999.99,13-24,13','500-999.99,1-6,12','300-499.99,13-36,14.5','300-499.99,37-60,15','300-499.99,1-12,16','150-299.99,7-12,18','150-299.99,37-60,16','150-299.99,13-36,17','150-299.99,1-6,20','1000-6400,7-12,12','1000-6400,25-60,13','1000-6400,13-24,12.5','1000-6400,1-6,9','0-149.99,37-60,18','0-149.99,25-36,20','0-149.99,13-24,21','0-149.99,1-12,25');interest=0;for(var i=0;i<complects.length;i++){if(interest==0){var complect=complects[i].split(',');var p_range=complect[0].split('-');var m_range=complect[1].split('-');if(to_leasing>=Number(p_range[0])&&to_leasing<=Number(p_range[1])&&leasing_period>=Number(m_range[0])&&leasing_period<=Number(m_range[1])){interest=Number(complect[2]);}}}
interest=interest/1200;var m_loan=to_leasing/leasing_period;var m_interest=to_leasing*interest;var m_payment=m_loan+m_interest;m_payment=Math.round(m_payment*100)/100;return m_payment;}
function sample_liisi(calc_price){var price=parseFloat(calc_price);var leasing_period=parseInt($("#leasing_period").val());var to_leasing=price;var m_payment=liisi_counter(to_leasing,leasing_period);if(m_payment<7){to_leasing=price;leasing_period=Math.round(to_leasing/7);m_payment=liisi_counter(to_leasing,leasing_period);}
leasing_sample_price=parseFloat(m_payment).toFixed(2);$("#leasing_price").html(leasing_sample_price);$('#leasing_period_value').prop('value',leasing_period);$('#leasing_period').prop('value',leasing_period);}