﻿var searchBox;var searchSlide;var searchContainer;$(document).ready(function(){MainMenu();$("#aspnetForm")[0].setAttribute("autocomplete","off");searchBox=$("input[id$=searchBox]");searchSlide=$("#divSearchSlide");searchContainer=$("#tSearchSlide");$(document).click(function(){searchSlide.hide()});$(searchSlide).click(function(a){a.stopPropagation()});$(searchBox).click(function(a){a.stopPropagation()});$("#aCities").unbind("click").click(function(){if($("#divCities").hasClass("open")){$("#divCities").removeClass("open");$("#divCities").hide()}else{$("#divCities").addClass("open");$("#divCities").fadeIn()}return false});CallTrack()});function GlobalSearch(){var a=searchBox[0];var b=/[^0-9a-zA-Zа-яА-Я.,()\-\/ ]/;if(a.value.match(b)){var c=a.value.split(b).join("");a.value=c}GetSearchSlide()}function GetSearchSlide(){var a=searchBox[0].value;if(a.replaceAll(" ","").length>1){execText("getSearch_"+a,$("#tSearchSlide"))}else{$("#divSearchSlide").hide()}}function execText(b,a){$.ajax({type:"POST",url:"/AjaxHandler.ashx",data:b,contentType:"application/x-www-form-urlencoded",dataType:"text",timeout:30000,success:function(c){confirmTextCommand(c,a)},error:function(c){$.notifier("Произошла ошибка. Попробуйте снова.","error")}})}function confirmTextCommand(b,a){var c=searchBox[0].value;if(b!=""&&c.replaceAll(" ","").length>1){searchContainer.html(b);$("#divSearchSlide").slideDown()}else{$("#divSearchSlide").hide()}}function exec(b){var a=$("input[id $= hSort]").val();$.ajax({type:"POST",url:"/jQueryAjaxRequest.aspx/HandleCommand",data:"{command : '"+b+"'}",contentType:"application/json; charset=utf-8",dataType:"json",success:function(c){confirmCommand(c)},error:function(c){$.notifier("Произошла ошибка. Попробуйте снова.","error")}})}function confirmCommand(response){var result=eval("("+response.d+")");if(result.IsSuccess){switch(result.Command.split("_")[0]){case"getModificationsAddBasket":if(result.Command.split("_").length>=3){if(result.Command.split("_")[2]>4){$("#divPopupModifications .popup-content").css("max-height","500px").css("overflow","scroll")}}$("#tModsData").html(result.Message);$("#h3Title").html(result.Message2);$("#divPopupModifications").fadeIn();Basket();break;case"getModificationsAddReview":$("#tModsData").html(result.Message);$("#h3Title").html(result.Message2);$("#divPopupModifications").fadeIn();break}}else{$.notifier("Произошла ошибка. Попробуйте снова.","error")}}function CallTrack(){$(document).bind("keydown",function(a){if(a.ctrlKey&&a.keyCode=="13"){$("#divPopupCallTRacker").fadeIn();pageTracker._trackPageview("/call_tracker");$(document).unbind("keydown")}})}$(document).ready(function(){$("a.bg-out").click(function(a){$("div.plus-popup-content").toggleClass("opened");$("div.plus-popup").toggleClass("on");a.stopPropagation()});$("li[id^=liFamily_]").click(function(){var a=this.id.split("_")[1];$("li[id^=liFamily_]").removeClass("cur");$(this).addClass("cur");$("div[id^=divItms_]").hide();$("div[id^=divItms_"+a+"]").show()});searchBox.focus(function(){$("#divCallNote").hide();$(".search").toggleClass("active");if($(this).val()=="Поиск"){$(this).val("")}GetSearchSlide()});searchBox.blur(function(){$(".search").toggleClass("active");if($(this).val()==""){$(this).val("Поиск")}});$(".popup-anchor").hover(function(){},function(){$(this).next("div").css("display","none")});$(".popup-anchor").click(function(){$(this).next("div").css("display","block").fadeIn(500)});$(document).bind("click",function(){$("div.plus-popup").removeClass("opened")});$(".open-video-popup").click(function(){$(".video-link").fadeIn()});$("#aCallOpen").click(function(){$("#divCallMePlease").fadeIn();return false});$("#aCallOpen").hover(function(){$("#aAddCallMe").show();$("#divCallNote").fadeIn(300)},function(){$("#divCallNote").hide()});$(".tip").hover(function(){$("#divPhoneNote").fadeIn(300)},function(){$("#divPhoneNote").hide()});$("*[class*=popup-close]").click(function(){$("*[class*=popup-position]").fadeOut()});$("#divCallMePlease #tbPhone1").unbind("keyup").keyup(function(){$(this).val($(this).val().replace(/[^0-9+\-() ]/g,""))});$("#divCallMePlease #tbPhone2").unbind("keyup").keyup(function(){$(this).val($(this).val().replace(/[^0-9+\-() ]/g,""))});$("#aAddCallMe").unbind("click").click(function(){$(this).hide();var c=HtmlEncode($("#divCallMePlease #tbName").val());var b=$("#divCallMePlease #tbPhone1").val();var a=$("#divCallMePlease #tbPhone2").val();var d=HtmlEncode($("#divCallMePlease #tbComment").val());if(c!=""&&b!=""&&a!=""){$.ajax({type:"POST",url:"/jQueryAjaxRequest.aspx/AddCallMe",data:'{name: "'+c+'", phone: "'+b+"-"+a+'", comment: "'+d+'", url: "'+top.location+'"}',contentType:"application/json; charset=utf-8",dataType:"json",success:function(e){$("#divCallMePlease").fadeOut();pageTracker._trackPageview("/zvonok_katerine");gaCallMe(e.d);$.notifier("Ваш номер добавлен.","success")},error:function(){$("#divCallMePlease").fadeOut();$.notifier("Ошибка. Попробуйте еще раз.","error")}})}else{$(this).show();$.notifier("Ошибка. Поля заполнены неверно","error")}});$("#aAddErrorRequest").unbind("click").click(function(){$(this).hide();var a=HtmlEncode($("#divErrorRequest #tbNameError").val());var b=HtmlEncode($("#divErrorRequest #tbText").val());if(a!=""&&b!=""){$.ajax({type:"POST",url:"/jQueryAjaxRequest.aspx/AddErrorRequest",data:'{name: "'+a+'", text: "'+b+'", url: "'+top.location+'"}',contentType:"application/json; charset=utf-8",dataType:"json",success:function(c){$("#divErrorRequest").fadeOut();pageTracker._trackPageview("/error_request");$.notifier("Спасибо. Вы нам очень помогли.","success")},error:function(){$("#divErrorRequest").fadeOut();$.notifier("Ошибка. Попробуйте еще раз.","error")}})}else{$(this).show();$.notifier("Ошибка. Поля заполнены неверно","error")}})});var divPopHover=false;function MainMenu(){$(document).bind("click",function(){$("div[id^=divPop_]").hide();$("*[id^=spanF_]").removeClass("onvar")});$("*[id^=spanF_]").hover(function(a){var b=parseInt(this.id.split("_")[1]);$("*[id^=spanF_]").removeClass("onvar");$(this).addClass("onvar");$("div[id^=divPop_]").hide();$("div[id=divPop_"+b+"]").show();a.stopPropagation()});$("div[id^=divPop_]").hover(function(a){divPopHover=true},function(){divPopHover=false;$("*[id^=spanF_]").removeClass("onvar");$("div[id^=divPop_]").hide()});$("*[id^=spanF_]").click(function(a){var b=parseInt(this.id.split("_")[1]);$("*[id^=spanF_]").removeClass("onvar");$(this).addClass("onvar");$("div[id^=divPop_]").hide();$("div[id=divPop_"+b+"]").show();a.stopPropagation()})}function ValidateEmail(a){var b=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;return b.test(a)}(function(b){b.notifier=function(d,c){a(d,c)};function a(f,e){var c=b(document.getElementById("divNoticeContainer"));var d=jQuery.notifier.settings.noticeTemplate;d=d.replace("%Message%",f);if(e=="success"){d=d.replace("%CssClass%","b-notif-success")}else{if(e=="error"){d=d.replace("%CssClass%","b-notif-error")}}var g=b(d).hide().fadeIn(jQuery.notifier.settings.noticeFadeTimeout);b.notifier.settings.noticeDisplay(g);c.append(g);if(b.notifier.settings.displayTimeout>0){setTimeout(function(){jQuery.notifier.settings.noticeRemove(g,function(){g.remove()})},jQuery.notifier.settings.displayTimeout)}}b.notifier.settings={noticeTemplate:'<div class="%CssClass%">%Message%</div>',noticeDisplay:function(c){c.fadeIn(jQuery.notifier.settings.noticeFadeTimeout)},noticeRemove:function(c,d){c.animate({opacity:"0",height:"0px"},{duration:jQuery.notifier.settings.noticeFadeTimeout,complete:d})},noticeFadeTimeout:"slow",displayTimeout:5000}})(jQuery);function completeNotify(){var a=$("input[id*=hCommandStatusMessage]");for(var b=0;b<a.length;b++){var c=a[b].value;if(c){$.notifier(c);a[b].value=""}}}if(Array.indexOf=="undefined"||!Array.indexOf){Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++){if(this[a]==b){return a}}return -1}}function HtmlEncode(a){return $("<div/>").text(a).html().replace(/\"/g,"&quot;")}function HtmlDecode(a){return $("<div/>").html(a).text().replace(/&quot;/g,'"')}String.prototype.replaceAll=function(b,a){return this.split(b).join(a)};function gaCallMe(b){var a="/call_analytics_"+b;pageTracker._trackPageview(a)}function Competition(){$(".popup-anchor").hover(function(){},function(){$(this).next("div").css("display","none")})}function SetCase(b){var a=b.id.split("_")[1];setSwitch(a)}function setSwitch(a){$("li[id*=liLider]:visible").fadeOut(300,function(){$("span[class=on]").removeClass("on");$("li[id=liLider_"+a+"]").fadeIn(300);$("span[id=spanCase_"+a+"]").addClass("on")})}function NextCase(){if($("span[class=on]").size()>0){var a=$("span[class=on]")[0].id.split("_")[1];var c=(parseInt(a)+1).toString();var b=$("span[id=spanCase_"+c+"]");if(b.length==0){c=0}setSwitch(c)}}function PrevCase(){if($("span[class=on]").size()>0){var a=$("span[class=on]")[0].id.split("_")[1];var b;if(a>0){b=(parseInt(a)-1).toString()}else{b=$("span[id*=spanCase_]:last")[0].id.split("_")[1]}setSwitch(b)}}$(document).ready(function(){$(document).everyTime("7s","timer1",function(a){NextCase()});$("div[id*=divLeaders]").bind("mouseenter",function(){$(document).stopTime()}).bind("mouseleave",function(){$(document).stopTime().everyTime("7s","timer1",function(a){NextCase()})})});jQuery.fn.extend({everyTime:function(b,c,d,e,a){return this.each(function(){jQuery.timer.add(this,b,c,d,e,a)})},oneTime:function(a,b,c){return this.each(function(){jQuery.timer.add(this,a,b,c,1)})},stopTime:function(a,b){return this.each(function(){jQuery.timer.remove(this,a,b)})}});jQuery.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1000,das:10000,hs:100000,ks:1000000},timeParse:function(c){if(c==undefined||c==null){return null}var a=this.regex.exec(jQuery.trim(c.toString()));if(a[2]){var b=parseInt(a[1],10);var d=this.powers[a[2]]||1;return b*d}else{return c}},add:function(e,c,d,g,h,b){var a=0;if(jQuery.isFunction(d)){if(!h){h=g}g=d;d=c}c=jQuery.timer.timeParse(c);if(typeof c!="number"||isNaN(c)||c<=0){return}if(h&&h.constructor!=Number){b=!!h;h=0}h=h||0;b=b||false;if(!e.$timers){e.$timers={}}if(!e.$timers[d]){e.$timers[d]={}}g.$timerID=g.$timerID||this.guid++;var f=function(){if(b&&this.inProgress){return}this.inProgress=true;if((++a>h&&h!==0)||g.call(e,a)===false){jQuery.timer.remove(e,d,g)}this.inProgress=false};f.$timerID=g.$timerID;if(!e.$timers[d][g.$timerID]){e.$timers[d][g.$timerID]=window.setInterval(f,c)}if(!this.global[d]){this.global[d]=[]}this.global[d].push(e)},remove:function(c,b,d){var e=c.$timers,a;if(e){if(!b){for(b in e){this.remove(c,b,d)}}else{if(e[b]){if(d){if(d.$timerID){window.clearInterval(e[b][d.$timerID]);delete e[b][d.$timerID]}}else{for(var d in e[b]){window.clearInterval(e[b][d]);delete e[b][d]}}for(a in e[b]){break}if(!a){a=null;delete e[b]}}}for(a in e){break}if(!a){c.$timers=null}}}}});if(jQuery.browser.msie){jQuery(window).one("unload",function(){var d=jQuery.timer.global;for(var a in d){var c=d[a],b=c.length;while(--b){jQuery.timer.remove(c[b],a)}}})}$(function(){if($("input[id$=hShowFilter]").val()!="1"){$("#divSearchForm").hide();$("#pTab").removeClass("search_tab_open");$("#pTab").addClass("search_tab_close");$("#spanTabButton").html("Показать форму поиска")}else{$("#divSearchForm").slideDown("normal");$("#pTab").removeClass("search_tab_close");$("#pTab").addClass("search_tab_open");$("#spanTabButton").html("Спрятать форму поиска")}$("#pTab").unbind("click").click(function(){if(!$("#pTab").hasClass("search_tab_close")){$("#divSearchForm").slideUp();$("#pTab").removeClass("search_tab_open");$("#pTab").addClass("search_tab_close");$("#spanTabButton").html("Показать форму поиска");$("#jQueryAjaxRequest").load("/jQueryAjaxRequest.aspx?random="+(new Date()).getTime()+"&showfilter=0")}else{$("#divSearchForm").slideDown("normal");$("#pTab").removeClass("search_tab_close");$("#pTab").addClass("search_tab_open");$("#spanTabButton").html("Спрятать форму поиска");$("#jQueryAjaxRequest").load("/jQueryAjaxRequest.aspx?random="+(new Date()).getTime()+"&showfilter=1")}});$("a[id$=btnFilterSubmit]").unbind("click").click(function(){var c="";if($("select[id*=selectManufacturer]").val()!="0"){c+="m="+$("select[id*=selectManufacturer]").val()+"~"}var f=$("select[id*=selectSingle]");for(var e=0;e<f.length;e++){if($(f[e]).val()!="0"){c+=f[e].id.split("_")[1]+"="+$(f[e]).val()+"~"}}var b=$("select[id*=selectFrom]");for(var d=0;d<b.length;d++){var a=$("select[id*="+b[d].id+"]").val();var g=$("select[id*="+b[d].id.replace("From","To")+"]").val();if(a!="0"||g!="0"){c+=a+","+g+"~"}}$("input[id$=hParameters]").val(c)});$("select[id*=selectFrom]").unbind("change").change(function(){var b=this.id.replace("From","To");var a=$("option[value="+$("select[id*="+b+"]").val()+"]").html();var c=$("option[value="+$(this).val()+"]").html();if($(this).val()!="0"&&$("select[id*="+b+"]").val()!="0"&&parseFloat(a.split(" ")[0])<parseFloat(c.split(" ")[0])){$("select[id*="+b+"]").val($(this).val())}});$("select[id*=selectTo]").unbind("change").change(function(){var b=this.id.replace("To","From");var c=$("option[value="+$("select[id*="+b+"]").val()+"]").html();var a=$("option[value="+$(this).val()+"]").html();if($(this).val()!="0"&&$("select[id*="+b+"]").val()!="0"&&parseFloat(c.split(" ")[0])>parseFloat(a.split(" ")[0])){$("select[id*="+b+"]").val($(this).val())}})});