/**/ (function(a){a.event.special.textchange={setup:function(){a(this).data("lastValue",this.contentEditable==="true"?a(this).php():a(this).val());a(this).bind("keyup.textchange",a.event.special.textchange.handler);a(this).bind("cut.textchange paste.textchange input.textchange",a.event.special.textchange.delayedHandler)},teardown:function(){a(this).unbind(".textchange")},handler:function(){a.event.special.textchange.triggerIfChanged(a(this))},delayedHandler:function(){var c=a(this);setTimeout(function(){a.event.special.textchange.triggerIfChanged(c)}, 25)},triggerIfChanged:function(a){var b=a[0].contentEditable==="true"?a.php():a.val();b!==a.data("lastValue")&&(a.trigger("textchange",[a.data("lastValue")]),a.data("lastValue",b))}};a.event.special.hastext={setup:function(){a(this).bind("textchange",a.event.special.hastext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.hastext.handler)},handler:function(c,b){b===""&&b!==a(this).val()&&a(this).trigger("hastext")}};a.event.special.notext={setup:function(){a(this).bind("textchange", a.event.special.notext.handler)},teardown:function(){a(this).unbind("textchange",a.event.special.notext.handler)},handler:function(c,b){a(this).val()===""&&a(this).val()!==b&&a(this).trigger("notext")}}})(jQuery); !function(a,b){"use strict";function c(c,g){var h=this;h.$el=a(c),h.el=c,h.id=e++,h.$el.bind("destroyed",a.proxy(h.teardown,h)),h.$clonedHeader=null,h.$originalHeader=null,h.cachedHeaderHeight=null,h.isSticky=!1,h.hasBeenSticky=!1,h.leftOffset=null,h.topOffset=null,h.init=function(){h.setOptions(g),h.$el.each(function(){var b=a(this);b.css("padding",0),h.$originalHeader=a("thead:first",this),h.$clonedHeader=h.$originalHeader.clone(),b.trigger("clonedHeader."+d,[h.$clonedHeader]),h.$clonedHeader.addClass("tableFloatingHeader"),h.$clonedHeader.css({display:"none",opacity:0}),h.$originalHeader.addClass("tableFloatingHeaderOriginal"),h.$originalHeader.after(h.$clonedHeader),h.$printStyle=a(''),h.$head.append(h.$printStyle)}),h.updateWidth(),h.toggleHeaders(),h.bind()},h.destroy=function(){h.$el.unbind("destroyed",h.teardown),h.teardown()},h.teardown=function(){h.isSticky&&h.$originalHeader.css("position","static"),a.removeData(h.el,"plugin_"+d),h.unbind(),h.$clonedHeader.remove(),h.$originalHeader.removeClass("tableFloatingHeaderOriginal"),h.$originalHeader.css("visibility","visible"),h.$printStyle.remove(),h.el=null,h.$el=null},h.bind=function(){h.$scrollableArea.on("scroll."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.on("scroll."+d+h.id,h.setPositionValues),h.$window.on("resize."+d+h.id,h.toggleHeaders)),h.$scrollableArea.on("resize."+d,h.toggleHeaders),h.$scrollableArea.on("resize."+d,h.updateWidth)},h.unbind=function(){h.$scrollableArea.off("."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.off("."+d+h.id,h.setPositionValues),h.$window.off("."+d+h.id,h.toggleHeaders)),h.$scrollableArea.off("."+d,h.updateWidth)},h.debounce=function(a,b){var c=null;return function(){var d=this,e=arguments;clearTimeout(c),c=setTimeout(function(){a.apply(d,e)},b)}},h.toggleHeaders=h.debounce(function(){h.$el&&h.$el.each(function(){var b,c=a(this),e=h.isWindowScrolling?isNaN(h.options.fixedOffset)?h.options.fixedOffset.outerHeight():h.options.fixedOffset:h.$scrollableArea.offset().top+(isNaN(h.options.fixedOffset)?0:h.options.fixedOffset),f=c.offset(),g=h.$scrollableArea.scrollTop()+e,i=h.$scrollableArea.scrollLeft(),j=h.options.cacheHeaderHeight?h.cachedHeaderHeight:h.$clonedHeader.height(),k=h.isWindowScrolling?g>f.top:e>f.top,l=(h.isWindowScrolling?g:0)a||a+h.$window.height()>h.$document.height()||0>b||b+h.$window.width()>h.$document.width()||h.$originalHeader.css({top:h.topOffset-(h.isWindowScrolling?0:a),left:h.leftOffset-(h.isWindowScrolling?0:b)})},0),h.updateWidth=h.debounce(function(){if(h.isSticky){h.$originalHeaderCells||(h.$originalHeaderCells=a("th,td",h.$originalHeader)),h.$clonedHeaderCells||(h.$clonedHeaderCells=a("th,td",h.$clonedHeader));var b=h.getWidth(h.$clonedHeaderCells);h.setWidth(b,h.$clonedHeaderCells,h.$originalHeaderCells),h.$originalHeader.css("width",h.$clonedHeader.width()),h.options.cacheHeaderHeight&&(h.cachedHeaderHeight=h.$clonedHeader.height())}},0),h.getWidth=function(c){var d=[];return c.each(function(c){var e,f=a(this);if("border-box"===f.css("box-sizing")){var g=f[0].getBoundingClientRect();e=g.width?g.width:g.right-g.left}else{var i=a("th",h.$originalHeader);if("collapse"===i.css("border-collapse"))if(b.getComputedStyle)e=parseFloat(b.getComputedStyle(this,null).width);else{var j=parseFloat(f.css("padding-left")),k=parseFloat(f.css("padding-right")),l=parseFloat(f.css("border-width"));e=f.outerWidth()-j-k-l}else e=f.width()}d[c]=e}),d},h.setWidth=function(a,b,c){b.each(function(b){var d=a[b];c.eq(b).css({"min-width":d,"max-width":d})})},h.resetWidth=function(b,c){b.each(function(b){var d=a(this);c.eq(b).css({"min-width":d.css("min-width"),"max-width":d.css("max-width")})})},h.setOptions=function(b){h.options=a.extend({},f,b),h.$window=a(h.options.objWindow),h.$head=a(h.options.objHead),h.$document=a(h.options.objDocument),h.$scrollableArea=a(h.options.scrollableArea),h.isWindowScrolling=h.$scrollableArea[0]===h.$window[0]},h.updateOptions=function(a){h.setOptions(a),h.unbind(),h.bind(),h.updateWidth(),h.toggleHeaders()},h.init()}var d="stickyTableHeaders",e=0,f={fixedOffset:0,leftOffset:0,marginTop:0,objDocument:document,objHead:"head",objWindow:b,scrollableArea:b,cacheHeaderHeight:!1};a.fn[d]=function(b){return this.each(function(){var e=a.data(this,"plugin_"+d);e?"string"==typeof b?e[b].apply(e):e.updateOptions(b):"destroy"!==b&&a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window); window.onload=function(){ $(document).on("click", ".getConsultant", function() { $(".mdn-callback-chat-button").click(); }); $(document).on("click", ".getCallme", function() { $(".mdn-callback-button").click(); }); if($(".contactButtons").is("div")) { function centerContactButtons() { $(".contactButtons").css("position", "fixed"); $(".contactButtons").css("display", "block"); var widthParentButton = $(".contactButton").outerWidth(); var spaceParentButton = $(".contactButton").offset().left; var widthButtonsBlock = $(".contactButtons").outerWidth(); //$(".contactButtons").css("padding-left",spaceParentButton + widthParentButton / 2 - 440 / 2) //$(".contactButtons").attr("data-pl",spaceParentButton + widthParentButton / 2 - 440 / 2) $(".contactButtons .cbutton").each(function() { var cbtop = $(this).offset().top - $(document).scrollTop(), cbleft = $(this).offset().left + (spaceParentButton + widthParentButton / 2 - 440 / 2); $(this).css("top",cbtop); $(this).css("left",cbleft); $(this).attr("data-top",cbtop); $(this).attr("data-left",cbleft); $('.contactButton').attr("data-ctop",$('.contactButton').offset().top - $(document).scrollTop() + $('.contactButton').outerHeight() / 2); $('.contactButton').attr("data-cleft",$('.contactButton').offset().left + $('.contactButton').outerWidth() / 2); }); return true; } $(window).resize(function(){ if(centerContactButtons()) { $(".contactButtons .cbutton").each(function() { $(this).css("position", "fixed"); }); $(".contactButtons").css("display", "none") .css("position", "absolute"); } }); function hiddenCbuttons() { $(".contactButtons .cbutton").each(function() { $(this).animate({top: $('.contactButton').data("ctop") - 45, left: $('.contactButton').data("cleft") - 55, opacity: "0"},300); },function() { $(".contactButtons").css("display", "none") }); } $('.contactButton').hover( function(){ $(".contactButtons").css("display", "block") .css("height", "170px"); $(".contactButtons").css("visibility", "visible") .css("position", "fixed"); //$(".contactButtons").css("padding-left",$(".contactButtons").data("pl")); $(".contactButtons .cbutton").css("visibility", "visible"); $(".contactButtons .cbutton").css("top", $('.contactButton').data("ctop") - 45); $(".contactButtons .cbutton").css("left", $('.contactButton').data("cleft") - 55); $(".contactButtons .cbutton").each(function() { $(this).animate({top: $(this).data("top"), left: $(this).data("left"), opacity: "1"},300) }); }, function(){ hiddenCbuttons() $(".contactButtons").css("position", "absolute") .css("height", "170px"); //$(".contactButtons").css("padding-left","0"); } ); if(centerContactButtons()) { $(".contactButtons .cbutton").each(function() { $(this).css("position", "fixed"); }); $(".contactButtons").css("display", "none") .css("position", "absolute"); } $('.contactButtons .cbutton').hover( function(){ $(this).children(".overlay").fadeOut(200); }, function(){ $(this).children(".overlay").fadeIn(200); } ); } $("#widget-socials .tabs-nav li").click(function(e) { e.preventDefault(); if(!$(this).is(".active")) { $("#widget-socials .tabs-nav li.active").removeClass("active"); $(this).addClass("active"); $("#widget-socials .tab-content .tab").css("display","none"); $("#widget-socials .tab-content .tab" + $(this).children("a").attr("href")).css("display","block"); } }); $(".navlink span").click(function() { if($(this).is(".active")) { $(this).removeClass("active"); $(".productionpanel").fadeOut(300); } else { $(this).addClass("active"); $(".productionpanel").fadeIn(300); } }); $(".productionpanel .closeProdPanel").click(function() { $(".navlink span").removeClass("active"); $(".productionpanel").fadeOut(300); }); $("table.fixtable").stickyTableHeaders(); $('.leftpanel').hover( function(){ $(".toppanel").addClass('lphover'); $(".productionpanel").addClass('lphover') }, function(){ $(".toppanel").removeClass('lphover'); $(".productionpanel").removeClass('lphover') } ); //Всплывающие подсказки function simple_tooltip(target_items, name){ $(target_items).each(function(i){ $("body").append("
Информация"+$(this).attr('title')+"
"); var my_tooltip = $("#"+name+i); if($(this).attr("title") != ""){ // Проверяем есть ли атрибут title $(this).removeAttr("title").mouseover(function(){ my_tooltip.css({opacity:1, display:"none"}).fadeIn(400); }).mousemove(function(kmouse){ my_tooltip.css({left:kmouse.pageX+25, top:kmouse.pageY+25}); }).mouseout(function(){ my_tooltip.fadeOut(400); }); } }); }; simple_tooltip(".tooltip","tooltipcont"); //Функция, ограничивающая ввод букв и спец. символов jQuery.fn.ForceNumericOnly = function() { return this.each(function() { $(this).keydown(function(e) { var key = e.charCode || e.keyCode || 0; // Разрешаем backspace, tab, delete, стрелки, обычные цифры Рё цифры РЅР° дополнительной клавиатуре return ( key == 8 || key == 9 || key == 46 || (key >= 37 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)); }); }); }; //Блоки с описанием по наведению if($(".sliderblock").is("div")) { $(".sliderblock").each(function() { $(this).children(".overlay").css("background-color",$(this).css("background-color")); }); $(".sliderblock").hover(function (e) { var jEl = $(this), w = jEl.outerWidth(), h = jEl.outerHeight(), off = jEl.offset(), x = e.pageX - off.left, y = e.pageY - off.top, xShift, // сдвиг от правой или левой границы yShift, // сдвиг от верхней или нижней границы xText, yText, itogText; if (x / w > .5) { xShift = w - x; xText = 'right'; } else { xShift = x; xText = 'left'; } if (y / h > .5) { yShift = h - y; yText = 'down'; } else { yShift = y; yText = 'up'; } itogText = (xShift < yShift) ? xText : yText; switch(itogText) { case "up": $(this).children(".overlay").css("top","-100%;") .css("left","0") $(this).children(".overlay").animate({top: "0%"},250); break; case "right": $(this).children(".overlay").css("left","100%") .css("top","0") $(this).children(".overlay").animate({left: "0"},250); break; case "left": $(this).children(".overlay").css("left","-100%") .css("top","0"); $(this).children(".overlay").animate({left: "0"},250); break; case "down": $(this).children(".overlay").css("top","100%") .css("left","0"); $(this).children(".overlay").animate({top: "0"},250); break; } }, function (e) { var jEl = $(this), w = jEl.outerWidth(), h = jEl.outerHeight(), off = jEl.offset(), x = e.pageX - off.left, y = e.pageY - off.top, xShift, // сдвиг от правой или левой границы yShift, // сдвиг от верхней или нижней границы xText, yText, itogText; if (x / w > .5) { xShift = w - x; xText = 'right'; } else { xShift = x; xText = 'left'; } if (y / h > .5) { yShift = h - y; yText = 'down'; } else { yShift = y; yText = 'up'; } itogText = (xShift < yShift) ? xText : yText; switch(itogText) { case "up": $(this).children(".overlay").animate({top: "-100%"},250); break; case "right": $(this).children(".overlay").animate({left: "100%"},250); break; case "left": $(this).children(".overlay").animate({left: "-100%"},250); break; case "down": $(this).children(".overlay").animate({top: "100%"},250); break; } } ); } //Всплывающие окна с описанием на главной $("*[data-vo]").hover( function(){ $("[data-vo="+$(this).data("vo")+"] .vo").addClass("focus") $("[data-vo="+$(this).data("vo")+"] .vo").addClass("active") .children(".text").slideDown(200); }, function(){ $("[data-vo="+$(this).data("vo")+"] .vo").removeClass("focus"); var $vo = $("[data-vo="+$(this).data("vo")+"] .vo"); var $text = $("[data-vo="+$(this).data("vo")+"] .vo .text"); setTimeout(function(){ if(!$vo.is(".focus")) { $text.slideUp(200,function() {$vo.removeClass("active");}); } },300); } ); //Табы if($("div").is(".tabsContainer")) { $(".tabsContainer .tabs .tab").first().addClass("active"); $(".tabsContainer .tabsConts .tabCont").first().slideDown(300); $(".tabsContainer .tabsConts .tabCont").first().addClass("active"); $(".tabsContainer .tabs .tab").click(function(){ if(!$(this).is(".active")) { $(".tabsContainer .tabsConts .tabCont.active").slideUp(400); $(".tabsContainer .tabs .tab.active").removeClass("active"); $(this).addClass("active"); $(this).parent(".tabs").parent(".tabsContainer").children(".tabsConts").children(".tabCont[data-tab=" + $(this).data("tab") +"]").slideDown(400, function () { $(this).addClass("active"); }); } }); } if($("ul").is(".akcii-inner")) { $(".akcii-inner").carouFredSel({ width: 200, height: '100%', direction: 'up', prev: ".akcii-prev", next: ".akcii-next", items: 1, scroll: { duration: 1500, onBefore: function( data ) { data.items.visible.children().css( 'opacity', 0 ).delay( 200 ).fadeTo( 400, 1 ); data.items.old.children().fadeTo( 400, 0 ); } } }); $(".akcii-block ul li").css('visibility','visible'); } if($("iframe").is("#calc_frame")) { var iframe = $('#calc_frame', parent.document.body); var contentBlockWidth = $("#mainContent").innerWidth(); var calcMarginL = (contentBlockWidth / 2) - (840 / 2); $('#calc_frame').css("margin-left", calcMarginL); } if($("ul").is(".banners-inner")) { $(".banners-inner").carouFredSel({ width: 200, height: '100%', direction: 'up', prev: ".banners-prev", next: ".banners-next", items: 1, scroll: { duration: 1000, onBefore: function( data ) { data.items.visible.children().css( 'opacity', 0 ).delay( 200 ).fadeTo( 400, 1 ); data.items.old.children().fadeTo( 400, 0 ); } }, }); $(".banners-block .banners-inner li").css('visibility','visible'); } if($("div").is(".carousel_topcar")) { $(".carousel_topcar").carouFredSel({ width: "100%", auto: true, prev: ".topcar-prev", next: ".topcar-next", mousewheel: true, swipe: { onMouse: true, onTouch: true }, scroll : { items: 1, easing: "quadratic", pauseOnHover: true } }); $(".carousel_items .item").css('visibility','visible'); } if($("div").is(".carousel_elements")) { $(".carousel_elements").carouFredSel({ width: "100%", auto: false, prev: ".elements-prev", next: ".elements-next", mousewheel: true, swipe: { onMouse: true, onTouch: true }, scroll: 1 }); } $.fn.alignCenterScreen = function() { this.css("position", "fixed"); var scrolltop = ($(window).height() - this.outerHeight()) / 2; if(scrolltop < 0) { this.css("position", "absolute"); scrolltop = 20; $('html, body').animate({ scrollTop: 0 }, 700); } this.css("top", scrolltop + "px"); this.css("left", ($(window).width() - this.outerWidth()) / 2 + $(window).scrollLeft() + "px"); return this }; $(".mv_popup").each(function() { $(this).prepend(''); }); $(document).on('click', '.mvclose', function () { $(this).parent(".mv_popup").removeClass("active") .fadeOut(300); }); $(document).click(function(event) { if($(".mv_popup").is(".active") && !$(".fastOrderWindow").is(".active") && !$(event.target).closest(".getPopup").length) { if ($(event.target).closest(".mv_popup.active").length) return; $(".mv_popup.active").removeClass("active") .fadeOut(300); } event.stopPropagation(); }); $(".getPopup").click(function(){ $(".mv_popup[data-id=" + $(this).data("id") + "]").alignCenterScreen() .addClass("active") .fadeIn(300); }); $(".fastorder").click(function(){ if($(this).is(".discount")) var doptext = "Цена указана с учетом скидки 15%. Данная скидка предоставляется оптовым покупателям, дилерам и в случае разовых акций компании."; else var doptext = "Чтобы оформить заказ, заполните форму. В ближайшее время с Вами свяжется менеджер и уточнит детали заказа."; $("#noactive").fadeIn(300); $(".fastOrderWindow .doptext").text(doptext); $(".fastOrderWindow .fotitle").text($(this).data('title')); $(".fastOrderWindow .orderlink").attr("data-subj",$(this).data('title')); $(".fastOrderWindow .fosum").text($(this).data('price')); $(".fastOrderWindow input[name=foamount]").val("1"); $(".fastOrderWindow input[name=foname]").val(""); $(".fastOrderWindow input[name=fophone]").val(""); $(".fastOrderWindow input[name=price]").val($(this).data('price')); $(".fastOrderWindow input[name=fullprice]").val($(this).data('price')); $(".fastOrderWindow").alignCenterScreen(); $(".fastOrderWindow").addClass("active"); $(".fastOrderWindow").fadeIn(300); }); $(document).on('click','.fastOrderWindow .foclose',function(){ $(".fastOrderWindow").fadeOut(300); $("#noactive").fadeOut(300); }); $(document).on('click','.fastOrderWindow .chblabel input[type=checkbox]',function(){ $(".fastOrderWindow .emailblock").slideToggle(300); }); function fastOrderApp() { $("#noactive").append($('
9999999
Для того чтобы быть в курсе наших акций и спецпредложений.
ОФОРМИТЬ ЗАКАЗ


Если необходимо прикрепить реквизиты для выставления счета, Вы можете воспользоваться полной формой заказа
')); } fastOrderApp(); if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) { $(".maskphone").attr("type","tel"); } else { $(".maskphone").mask("+7 (999) 999 99 99"); } //Окно быстрого заказа $(".fastOrderWindow input[name=foamount]").ForceNumericOnly(); //Слбытие клика по минусу, плюсу $(document).on('click','.countGroup .recount',function(){ if(!$(this).is(".active")) return; var count = $(this).parent(".countGroup").children(".countItem").val(); if($(this).is(".minus") && count != 0) { //Если кликнули по минусу count--; if(count == 1) $(this).parent(".countGroup").children(".minus").removeClass("active"); } if($(this).is(".plus")) { //Если кликнули по плюсу count++; if(count == 2) $(this).parent(".countGroup").children(".minus").addClass("active"); } $(this).parent(".countGroup").children(".countItem").val(count); recalc(); }); //Событие ввода с клавиатуры количества $('.countGroup .countItem').bind('textchange', function () { var count = $(this).val(); if(count=="") $(this).val(1); if(count==0) $(this).val(1); if(count < 2) $(this).parent(".countGroup").children(".minus").removeClass("active"); if(count >= 2) $(this).parent(".countGroup").children(".minus").addClass("active"); if(count > 0) $(this).val(count.replace(/^0+/, '')); //Обновляем цену в строке recalc(); }); function recalc() { var price = $(".fastOrderWindow input[name=price]").val(); var amount = $(".fastOrderWindow input[name=foamount]").val(); var fullprice = price * amount; $(".fastOrderWindow input[name=fullprice]").val(fullprice.toFixed(2)); if(fullprice.toFixed(2).length > 11) $(".fastOrderWindow .fosum").text(">99999999"); else $(".fastOrderWindow .fosum").text(fullprice.toFixed(2)); } $(document).on('click','.fosubmit',function(){ var name = $(".fastOrderWindow input[name=foname]").val(); var phone = $(".fastOrderWindow input[name=fophone]").val(); var email = $(".fastOrderWindow input[name=foemail]").val(); var meserrors = []; if(name == '') { $(".fastOrderWindow input[name=foname]").addClass('error'); meserrors[meserrors.length] = 'Введите имя!'; } else { if(name.length > 2) { $(".fastOrderWindow input[name=foname]").removeClass('error'); } else { $(".fastOrderWindow input[name=foname]").addClass('error'); meserrors[meserrors.length] = 'Имя должно содержать не менее 3 символов!'; } } if($(".fastOrderWindow .chblabel input[type=checkbox]").is(":checked")) { var subscribe = "1"; if(email == '') { $(".fastOrderWindow input[name=foemail]").addClass('error'); meserrors[meserrors.length] = 'Введите e-mail!'; } else { var pattern = /^[a-z0-9_-]+@[a-z0-9-]+\.([a-z]{1,6}\.)?[a-z]{2,6}$/i; if(email.search(pattern) == 0) { $(".fastOrderWindow input[name=foemail]").removeClass('error'); } else { $(".fastOrderWindow input[name=foemail]").addClass('error'); meserrors[meserrors.length] = 'E-mail введен некорректно!'; } } } else {var subscribe = "0"; email = "-";} if(phone == '') { $(".fastOrderWindow input[name=fophone]").addClass('error'); meserrors[meserrors.length] = 'Введите телефон!'; } else { $(".fastOrderWindow input[name=fophone]").removeClass('error'); } if(meserrors.length == 0) { $(".fastOrderWindow .preloader").css("display","block"); var title = $(".fastOrderWindow .fotitle").text(); var amount = $(".fastOrderWindow input[name=foamount]").val(); var fullprice = $(".fastOrderWindow input[name=fullprice]").val(); var referer = $(".fastOrderWindow input[name=referer]").val(); var message = 'Заявка через форму быстрого заказа. Заголовок: '+title+'; кол-во: '+amount+'; сумма: '+fullprice+'руб.'; $.post( "/mdn_orders/post.php", { InputName: name, InputPhone: phone, InputEmail: email, InputSubject: title, InputCompany: "-", TextareaMessage: message, referer: referer, subscribe: subscribe }, onAjaxSuccess ); function onAjaxSuccess(data) { // Здесь мы получаем данные, отправленные сервером и выводим их на экран. dataarr = data.split('||'); if(dataarr[0] == '0') { alert(dataarr[1]); $(".fastOrderWindow").fadeOut(300); $("#noactive").fadeOut(300); } else { alert(dataarr[1]); } $(".fastOrderWindow .preloader").css("display","none"); } } }); } $(function() { var offset = $("#fixblock").offset(); // запоминаем первоначальные отсупы var topPos = $("#fixblock").offset().top; $(window).scroll(function() { // во время скроллинга //var space = $('.spacer').offset().top - $("#fixblock").offset().top - $("#fixblock").outerHeight(); var top = $(document).scrollTop(), pip = $('.spacer').offset().top, //расстояние до подвала от верха окна браузера height = $("#fixblock").outerHeight(); //получаем значение высоты пл.блока if (top > topPos && top < pip - height) { if ($(window).scrollTop() > offset.top) { // Если скроллинг больше первоначальной позиции var space = $("#fixblock").offset().top + $("#fixblock").outerHeight(); //console.log(space); $("#fixblock").stop().animate({marginTop: $(window).scrollTop() - offset.top + 40}); // увиличиваем отступ сверху } else { $("#fixblock").stop().animate({marginTop: 0}); // Иначе отступ нулевой } } }); }); //Maskedinput (function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object') { // Node/CommonJS factory(require('jquery')); } else { // Browser globals factory(jQuery); } }(function ($) { var ua = navigator.userAgent, iPhone = /iphone/i.test(ua), chrome = /chrome/i.test(ua), android = /android/i.test(ua), caretTimeoutId; $.mask = { //Predefined character definitions definitions: { '9': "[0-9]", 'a': "[A-Za-z]", '*': "[A-Za-z0-9]" }, autoclear: true, dataName: "rawMaskFn", placeholder: '_' }; $.fn.extend({ //Helper Function for Caret positioning caret: function(begin, end) { var range; if (this.length === 0 || this.is(":hidden")) { return; } if (typeof begin == 'number') { end = (typeof end === 'number') ? end : begin; return this.each(function() { if (this.setSelectionRange) { this.setSelectionRange(begin, end); } else if (this.createTextRange) { range = this.createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', begin); range.select(); } }); } else { if (this[0].setSelectionRange) { begin = this[0].selectionStart; end = this[0].selectionEnd; } else if (document.selection && document.selection.createRange) { range = document.selection.createRange(); begin = 0 - range.duplicate().moveStart('character', -100000); end = begin + range.text.length; } return { begin: begin, end: end }; } }, unmask: function() { return this.trigger("unmask"); }, mask: function(mask, settings) { var input, defs, tests, partialPosition, firstNonMaskPos, lastRequiredNonMaskPos, len, oldVal; if (!mask && this.length > 0) { input = $(this[0]); var fn = input.data($.mask.dataName) return fn?fn():undefined; } settings = $.extend({ autoclear: $.mask.autoclear, placeholder: $.mask.placeholder, // Load default placeholder completed: null }, settings); defs = $.mask.definitions; tests = []; partialPosition = len = mask.length; firstNonMaskPos = null; $.each(mask.split(""), function(i, c) { if (c == '?') { len--; partialPosition = i; } else if (defs[c]) { tests.push(new RegExp(defs[c])); if (firstNonMaskPos === null) { firstNonMaskPos = tests.length - 1; } if(i < partialPosition){ lastRequiredNonMaskPos = tests.length - 1; } } else { tests.push(null); } }); return this.trigger("unmask").each(function() { var input = $(this), buffer = $.map( mask.split(""), function(c, i) { if (c != '?') { return defs[c] ? getPlaceholder(i) : c; } }), defaultBuffer = buffer.join(''), focusText = input.val(); function tryFireCompleted(){ if (!settings.completed) { return; } for (var i = firstNonMaskPos; i <= lastRequiredNonMaskPos; i++) { if (tests[i] && buffer[i] === getPlaceholder(i)) { return; } } settings.completed.call(input); } function getPlaceholder(i){ if(i < settings.placeholder.length) return settings.placeholder.charAt(i); return settings.placeholder.charAt(0); } function seekNext(pos) { while (++pos < len && !tests[pos]); return pos; } function seekPrev(pos) { while (--pos >= 0 && !tests[pos]); return pos; } function shiftL(begin,end) { var i, j; if (begin<0) { return; } for (i = begin, j = seekNext(end); i < len; i++) { if (tests[i]) { if (j < len && tests[i].test(buffer[j])) { buffer[i] = buffer[j]; buffer[j] = getPlaceholder(j); } else { break; } j = seekNext(j); } } writeBuffer(); input.caret(Math.max(firstNonMaskPos, begin)); } function shiftR(pos) { var i, c, j, t; for (i = pos, c = getPlaceholder(pos); i < len; i++) { if (tests[i]) { j = seekNext(i); t = buffer[i]; buffer[i] = c; if (j < len && tests[j].test(t)) { c = t; } else { break; } } } } function androidInputEvent(e) { var curVal = input.val(); var pos = input.caret(); if (oldVal && oldVal.length && oldVal.length > curVal.length ) { // a deletion or backspace happened checkVal(true); while (pos.begin > 0 && !tests[pos.begin-1]) pos.begin--; if (pos.begin === 0) { while (pos.begin < firstNonMaskPos && !tests[pos.begin]) pos.begin++; } input.caret(pos.begin,pos.begin); } else { var pos2 = checkVal(true); while (pos.begin < len && !tests[pos.begin]) pos.begin++; input.caret(pos.begin,pos.begin); } tryFireCompleted(); } function blurEvent(e) { checkVal(); if (input.val() != focusText) input.change(); } function keydownEvent(e) { if (input.prop("readonly")){ return; } var k = e.which || e.keyCode, pos, begin, end; oldVal = input.val(); //backspace, delete, and escape get special treatment if (k === 8 || k === 46 || (iPhone && k === 127)) { pos = input.caret(); begin = pos.begin; end = pos.end; if (end - begin === 0) { begin=k!==46?seekPrev(begin):(end=seekNext(begin-1)); end=k===46?seekNext(end):end; } clearBuffer(begin, end); shiftL(begin, end - 1); e.preventDefault(); } else if( k === 13 ) { // enter blurEvent.call(this, e); } else if (k === 27) { // escape input.val(focusText); input.caret(0, checkVal()); e.preventDefault(); } } function keypressEvent(e) { if (input.prop("readonly")){ return; } var k = e.which || e.keyCode, pos = input.caret(), p, c, next; if (e.ctrlKey || e.altKey || e.metaKey || k < 32) {//Ignore return; } else if ( k && k !== 13 ) { if (pos.end - pos.begin !== 0){ clearBuffer(pos.begin, pos.end); shiftL(pos.begin, pos.end-1); } p = seekNext(pos.begin - 1); if (p < len) { c = String.fromCharCode(k); if (tests[p].test(c)) { shiftR(p); buffer[p] = c; writeBuffer(); next = seekNext(p); if(android){ //Path for CSP Violation on FireFox OS 1.1 var proxy = function() { $.proxy($.fn.caret,input,next)(); }; setTimeout(proxy,0); }else{ input.caret(next); } if(pos.begin <= lastRequiredNonMaskPos){ tryFireCompleted(); } } } e.preventDefault(); } } function clearBuffer(start, end) { var i; for (i = start; i < end && i < len; i++) { if (tests[i]) { buffer[i] = getPlaceholder(i); } } } function writeBuffer() { input.val(buffer.join('')); } function checkVal(allow) { //try to place characters where they belong var test = input.val(), lastMatch = -1, i, c, pos; for (i = 0, pos = 0; i < len; i++) { if (tests[i]) { buffer[i] = getPlaceholder(i); while (pos++ < test.length) { c = test.charAt(pos - 1); if (tests[i].test(c)) { buffer[i] = c; lastMatch = i; break; } } if (pos > test.length) { clearBuffer(i + 1, len); break; } } else { if (buffer[i] === test.charAt(pos)) { pos++; } if( i < partialPosition){ lastMatch = i; } } } if (allow) { writeBuffer(); } else if (lastMatch + 1 < partialPosition) { if (settings.autoclear || buffer.join('') === defaultBuffer) { // Invalid value. Remove it and replace it with the // mask, which is the default behavior. if(input.val()) input.val(""); clearBuffer(0, len); } else { // Invalid value, but we opt to show the value to the // user and allow them to correct their mistake. writeBuffer(); } } else { writeBuffer(); input.val(input.val().substring(0, lastMatch + 1)); } return (partialPosition ? i : firstNonMaskPos); } input.data($.mask.dataName,function(){ return $.map(buffer, function(c, i) { return tests[i]&&c!=getPlaceholder(i) ? c : null; }).join(''); }); input .one("unmask", function() { input .off(".mask") .removeData($.mask.dataName); }) .on("focus.mask", function() { if (input.prop("readonly")){ return; } clearTimeout(caretTimeoutId); var pos; focusText = input.val(); pos = checkVal(); caretTimeoutId = setTimeout(function(){ if(input.get(0) !== document.activeElement){ return; } writeBuffer(); if (pos == mask.replace("?","").length) { input.caret(0, pos); } else { input.caret(pos); } }, 10); }) .on("blur.mask", blurEvent) .on("keydown.mask", keydownEvent) .on("keypress.mask", keypressEvent) .on("input.mask paste.mask", function() { if (input.prop("readonly")){ return; } setTimeout(function() { var pos=checkVal(true); input.caret(pos); tryFireCompleted(); }, 0); }); if (chrome && android) { input .off('input.mask') .on('input.mask', androidInputEvent); } checkVal(); //Perform initial check for existing values }); } }); }));