Cookies=new Object();Cookies.set=function(b,h,d,j,f,a){if((d)&&(d.toString().match(/\+(\d+)(h|d|m|y)/))){var e=new Date();var g=parseInt(RegExp.$1);var i=RegExp.$2;switch(i){case"y":e.setYear(e.getYear()+g);break;case"m":e.setMonth(e.getMonth()+g);break;case"d":e.setDate(e.getDate()+g);break;case"h":e.setHours(e.getHours()+g);break;}d=e.toGMTString();}document.cookie=b+"="+escape(h)+((d)?"; expires="+d:"")+((j)?"; path="+j:"")+((f)?"; domain="+f:"")+((a)?"; secure":"");};Cookies.get=function(b){var d=" "+document.cookie;var c=" "+b+"=";var e=null;var f=0;var a=0;if(d.length>0){f=d.indexOf(c);if(f!=-1){f+=c.length;a=d.indexOf(";",f);if(a==-1){a=d.length;}e=unescape(d.substring(f,a));}}return(e);};Browser=function(){var d=navigator.userAgent.toLowerCase();var a=/msie/.test(d)&&!/opera/.test(d);var b=/MSIE (5\.5|6).+Win/.test(navigator.userAgent);var c=/webkit/.test(d);return{isMSIE:a,isWebKit:c,isIE6:b,getScrollBody:function(){return(c)?document.body:document.documentElement;}};}();function Log(b){var a=document.getElementById("log");if(!a){a=document.createElement("div");a.id="log";Browser.getScrollBody().appendChild(a);}a.innerHTML="<div>"+b+"</div>"+a.innerHTML;}if(!Array.indexOf){Array.prototype.indexOf=function(a,c){if(!c){c=0;}for(var b=c;b<this.length;b++){if(this[b]==a){return b;}}return -1;};}if(!String.trim){String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"");};}ConvertHashToString=function(d,c,f){var a=new Array();for(var b in d){var e=(f)?encodeURIComponent(b):b;var g=(f)?encodeURIComponent(d[b]):d[b];a.push(e+"="+g);}return a.join(c);};var __sizingRegExp=/iesizing\-(\w+)/;function fixPNG(d,a){if(/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){a=a||"crop";var c=__sizingRegExp.exec(d.className);if(c){a=c[1];}var b;if(d.tagName=="IMG"){if(/\.png$/.test(d.src)){b=d.src;d.src="/i/e.gif";}}else{b=d.currentStyle.backgroundImage.match(/url\(["']?(.+\.png).*?["']?\)/i);if(b){b=b[1];d.runtimeStyle.backgroundImage="none";}}if(b){d.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"',sizingMethod='"+a+"')";}else{d.runtimeStyle.filter="true";}}}Placeholder=function(){var b=navigator.userAgent.toLowerCase();var h=/msie/.test(b)&&!/opera/.test(b);if(("placeholder" in document.createElement("input"))||((!h)&&((!window.addEventListener)||(!window.getComputedStyle)))){return{attach:function(l){return l;}};}var c=["fontStyle","fontVariant","fontWeight","fontSize","fontFamily"];function k(l,p,n){var o=document.createElement("span");o.className="placeholder";o.innerHTML=p;a(l,o);if(!n){d(l,o);}l.__placeholder=o;g(o,"mousedown",function(q){var q=q||window.event;f(l);if(q.preventDefault){l.focus();q.preventDefault();}else{window.setTimeout(function(){l.focus();},50);q.returnValue=false;}});g(l,"focus",function(){f(l);});g(l,"blur",function(){j(l);});var m=function(){if(l.value!==""){f(l);}};if(h){g(document,"readystatechange",m);}else{g(document,"DOMContentLoaded",m);}m();}function f(l){if((l.__placeholder)&&(!l.__placeholder.__hidden)){l.__placeholder.style.display="none";l.__placeholder.__hidden=true;}}function j(l){if((l.__placeholder)&&(l.__placeholder.__hidden)&&(l.value==="")){l.__placeholder.innerHTML=l.getAttribute("placeholder");l.__placeholder.style.display="block";l.__placeholder.__hidden=false;}}function a(q,l){var m=document.createElement("div");m.style.position="relative";q.parentNode.insertBefore(m,q);m.appendChild(q);var o={left:q.offsetLeft,top:q.offsetTop,width:q.clientWidth,height:q.clientHeight,paddingTop:e(q,"borderTopWidth")+e(q,"paddingTop"),paddingRight:e(q,"borderRightWidth")+e(q,"paddingRight"),paddingBottom:e(q,"borderBottomWidth")+e(q,"paddingBottom"),paddingLeft:e(q,"borderLeftWidth")+e(q,"paddingLeft")};l.style.position="absolute";l.style.zIndex=e(q,"zIndex")+1;l.style.overflow="hidden";l.style.whiteSpace="nowrap";l.style.clip="rect(auto, "+(o.paddingLeft+o.width)+"px, "+(o.paddingTop+o.height)+"px, auto)";l.style.cursor=i(q,"cursor");l.style.lineHeight=i(q,"lineHeight");for(var n in o){l.style[n]=o[n]+"px";}m.appendChild(l);return l;}function d(o,l){var n=[];for(var m=0;m<c.length;m++){n.push(i(o,c[m]));}l.style.font=n.join(" ");return l;}function i(m,l){l=l.replace(/([A-Z])/g,"-$1").toLowerCase();return window.getComputedStyle(m,"").getPropertyValue(l);}function e(m,l){var n=i(m,l);return((n==null)||(n==="auto"))?0:parseInt(n);}function g(l,m,n){l.addEventListener(m,n,false);return l;}if(h){i=function(m,l){return m.currentStyle[l];};g=function(l,m,n){l.attachEvent("on"+m,n);return l;};}return{attach:function(l,m){if((l)&&(!l.__placeholder)&&(l.getAttribute("placeholder")!=undefined)){k(l,l.getAttribute("placeholder"),m);}return l;}};}();GlobalResources=new Object();GlobalResources.AJAX_URI="/djson/";if(window.location.toString().match(/SESS_ID=(\d+)/)){GlobalResources.SESS_ID=RegExp.$1;}GlobalResources.getJSON=function(b,a){if(!GlobalResources._AJAX_SETUP){GlobalResources._AJAX_SETUP=GlobalResources.initAjax();}if(GlobalResources.SESS_ID){b.SESS_ID=GlobalResources.SESS_ID;
}$.post($G.AJAX_URI,b,a,"json");};GlobalResources.initAjax=function(){var b=$(document.body);function a(c){if(c){b.addClass("waiting");}else{b.removeClass("waiting");}}$(document).ajaxStart(function(){a(true);}).ajaxStop(function(){a(false);}).ajaxError(function(f,e,c,d){alert("Произошла ошибка при загрузки данных");});return 1;};GlobalResources.NavigationBar=function(){var m=200;var k=100;var a=300;var o=$(),b=$(),j=$();var c=true;var h;function d(){var q=b.offset().top;var p=b.outerHeight();var s=h.scrollTop;function r(){var t=b.parent().height()-p+q;var u=(s>q)?((s>t)?t:s):q;u-=q;b.stop().animate({top:u},m,"swing");}$(window).scroll(function(){var t=h.scrollTop;window.setTimeout(function(){if(t==s){r();}},k);s=t;});r();}function e(p){c=false;var q=-(o.outerWidth()+o.parent().offset().left);if(p){o.stop().css({marginLeft:q});g();}else{o.stop().animate({marginLeft:q},a,"swing",g);}}function g(){j.removeClass("fbb-close");}function l(p){c=true;if(p){o.stop().css({marginLeft:0});n();}else{o.stop().animate({marginLeft:0},a,"swing",n);}}function n(){j.addClass("fbb-close");}function i(){if(c){e();}else{l();}}function f(){e(true);var p=o.parent();p.css("min-height",b.height());}return{setup:function(){h=Browser.getScrollBody();var p=$("div.cont-wrap-wide");b=p.find("div.left-col");if(b.length){b.css("position","relative");o=$(document.createElement("div")).addClass("b-floating-bar").insertBefore(b).append(b);j=$(document.createElement("div")).addClass("fb-btn").addClass("fbb-close").click(i).appendTo(b);$(window).resize(f);d();f();}}};}();GlobalResources.Popup=function(){var a=window;var b=document;return{show:function(h,g,c,f){if(h._window){h._window.focus();return;}f=f||"simple";var i=GlobalResources.Popup.showStandart(h.href,g,c,f,h);if((!jQuery.browser.opera)&&(!Browser.isMSIE)){var d=$(h);d.addClass("active");var e=function(){d.removeClass("active");h._window=null;};if(f=="modern"){i.attachEventListener("close",e);}else{h._window=i;i.onbeforeunload=e;}}},showStandart:function(c,f,l,i,j){if(i=="modern"){var k=new $G.Window({align:"center-center",width:f,height:l,animation:true,animationSlide:true,slideAncestor:j});k.attachEventListener("draw",function(m){var d=document.createElement("iframe");d.src=c;m.$content.append($(d).css({width:f,height:l}));});k.show();return k;}else{var h=new Date();var e="W_"+h.getTime().toString();var g={alwaysLowered:"no",dependent:"yes",directories:"no",location:"no",menubar:"no",toolbar:"no",scrollbars:"no",resizable:"yes",innerWidth:f,innerHeight:l,width:f,height:l};var k=window.open(c,e,ConvertHashToString(g,","));return k;}}};}();GlobalResources.CallRequest=function(){var d=/8\-\d{3}\-\d{3}\-\d{4}/;var f,a;var b=false;function g(){if(!b){b=true;$G.getJSON({_do:"call_request",phone:a.value},c);}}function c(h){if(h.success){$(f).replaceWith($(document.createElement("div")).addClass("text").html(h.success));}else{a.blur();a.value=a.defaultValue;b=false;}}function e(){if((a.value)&&(a.value!=a.defaultValue)){g();}return false;}return{init:function(h){f=document.getElementById(h);if((f)&&(f.tagName.toLowerCase()==="form")){$(f).submit(e);var i=$('input[name="phone"]',f).focus(function(){$(this).addClass("active");if(this.value==this.defaultValue){this.value="";}}).blur(function(){if(!this.value){$(this).removeClass("active");this.value=this.defaultValue;}});a=i.get(0);a.value=a.defaultValue="Введите номер";}}};}();GlobalResources.LoginForm=function(){var b;function a(){}return{init:function(){b=document.getElementById("login-form");if(b){var c=$(b);c.submit(a);c.find("input:text,input:password").focus(function(){$(this).addClass("active");}).blur(function(){if(!this.value){$(this).removeClass("active");}}).each(function(){Placeholder.attach(this);});}}};}();GlobalResources.Clocks=function(){var c=new Array();var e;var a;function d(){e=window.setInterval(b,500);}function b(){var k=new Date();var g=new Date(k.getTime()+(k.getTimezoneOffset()+a*60)*60000);var n=g.getHours();var f=g.getMinutes();if(n<10){n="0"+n;}if(f<10){f="0"+f;}var l=g.getSeconds();for(var j=0;j<c.length;j++){c[j].innerHTML=n+"<span>:</span>"+f;c[j].className=(l%2==0)?"sh":"";}}return{init:function(f,g){a=g;var h=document.getElementById(f);if(h){c.push(h);d();}},addElement:function(f){var g=document.getElementById(f);if(g){c.push(g);}}};}();GlobalResources.VisualEffects=function(){var b=400;var a=$(document.getElementById("cnt-wrap"));a.find('a[rel="fancy"]').fancybox({padding:0,titlePosition:"inside",overlayOpacity:0});a.find('a[rel="fold"]').click(function(){if(this._unfolded){$(this).parent().addClass("f-deact").next().slideUp(b);this._unfolded=false;}else{var c=this;function d(){$(Browser.getScrollBody()).animate({scrollTop:$(c).parent().offset().top-20},b);}$(this).parent().removeClass("f-deact").next().slideDown(b,d);this._unfolded=true;}return false;});};$G=GlobalResources;GlobalResources.EventDispatcher=function(){this._eventStack=new Array();};GlobalResources.EventDispatcher.prototype={attachEvent:function(a,b){this._eventStack.push(new $G.Event(a,b));
},removeEvent:function(a,c){for(var b=0;b<this._eventStack.length;b++){var d=this._eventStack[b];if((d.name==a)&&((c===null)||(d.handler===c))){this._eventStack.splice(b,1);}}},dispatchEvent:function(b){var a=Array.prototype.slice.call(arguments,1);for(var c=0;c<this._eventStack.length;c++){var d=this._eventStack[c];if(d.name==b){d.fire(a);}}}};GlobalResources.Event=function(a,b){this.name=a;this.handler=b;};GlobalResources.Event.prototype={fire:function(a){this.handler.apply(this,a);}};GlobalResources.Window=function(a){this._options=a||{};this._d=document.documentElement;this._eventDispatcher=new $G.EventDispatcher();this._setup();};GlobalResources.Window.prototype={show:function(){this._draw();},close:function(){this._hide();this._eventDispatcher.dispatchEvent("close");},attachEventListener:function(b,a){this._eventDispatcher.attachEvent(b,a);},removeEventListener:function(b,a){this._eventDispatcher.removeEvent(b,a);},_setup:function(){this.innerWidth=this._options.width||0;this.innerHeight=this._options.height||0;this.align=this._options.align||"left-top";this.contentOverflow=this._options.overflow||"hidden";this.animation=this._options.animation||false;this.fadeDuration=this._options.fadeDuration||300;this.animationSlide=this._options.animationSlide||false;this.slideDuration=this._options.slideDuration||300;this._slideAncestor=this._options.slideAncestor;},_draw:function(){var b=this;this._$overlay=$(document.createElement("div")).addClass("popup-overlay").click(function(){b.close();}).appendTo(document.body);if(Browser.isIE6){this._$overlay.css({position:"absolute",height:Browser.getScrollBody().scrollHeight});}this._$wrap=$(document.createElement("div")).addClass("popup-window").css({width:this.innerWidth,height:this.innerHeight}).hide().appendTo(document.body);this.outerWidth=this._$wrap.outerWidth();this.outerHeight=this._$wrap.outerHeight();$(document.createElement("div")).addClass("close-btn").html("Закрыть").appendTo(this._$wrap).click(function(){b.close();});this.$content=$(document.createElement("div")).css({clear:"both",overflow:this.contentOverflow,height:this.innerHeight}).appendTo(this._$wrap);var e=this._getAlignmentCoords();this._$wrap.css({left:e.left,top:e.top});this._eventDispatcher.dispatchEvent("draw",this);if(this.animation){var c=function(){b._$wrap.fadeIn(b.fadeDuration,function(){b._eventDispatcher.dispatchEvent("show",b);});};if((this.animationSlide)&&(this._slideAncestor)){var d=$(this._slideAncestor);var a=d.offset();$(document.createElement("div")).addClass("pw-slide").css({left:a.left,top:a.top,width:d.outerWidth(),height:d.outerHeight()}).animate({left:e.left,top:e.top,width:this.outerWidth,height:this.outerHeight},this.slideDuration,"swing",function(){c();$(this).remove();}).appendTo(this._d);}else{c();}}else{this._$wrap.show();this._eventDispatcher.dispatchEvent("show",this);}},_hide:function(){var a=this;if(this.animation){this._$wrap.fadeOut(this.fadeDuration,function(){a._$wrap.remove();a._$overlay.remove();});}else{this._$wrap.remove();this._$overlay.remove();}},_getAlignmentCoords:function(){var d=this.align.split("-");var c=0,b=0;switch(d[0]){case"left":b=this.borderOffset;break;case"right":b=this._d.clientWidth-this.outerWidth-this.borderOffset;break;case"center":b=(this._d.clientWidth-this.outerWidth)/2;}switch(d[1]){case"top":c=this.borderOffset;break;case"bottom":c=this._d.clientHeight-this.outerHeight-this.borderOffset;break;case"center":c=(this._d.clientHeight-this.outerHeight)/2;}var a=Browser.getScrollBody();b+=a.scrollLeft;c+=a.scrollTop;return{left:b,top:c};}};GlobalResources.MetaLinks=function(){function a(d){var c=this.href;var f=document.title;if(jQuery.browser.mozilla){window.sidebar.addPanel(f,c,"");}else{if(jQuery.browser.msie){window.external.AddFavorite(c,f);}else{if(jQuery.browser.opera){this.setAttribute("rel","sidebar");return true;}else{var b=new $G.Window({align:"center-center",width:300,height:36,animation:true});b.attachEventListener("draw",function(e){e.$content.html('<div style="font-size: 1.2em; text-align: center">Нажмите Ctrl+D, чтобы добавить сайт в избранное</div>');});b.show();}}}return false;}return{init:function(){$(document.getElementById("bookmark-link")).click(a);}};}();GlobalResources.Votings=function(){var c=$();function a(){var e=c.find("label input").css({opacity:0}).after(document.createElement("ins")).change(function(){if(this.checked){c.find("ins").removeClass("act");$(this).siblings("ins").addClass("act");}});e.eq(0).attr("checked","checked").siblings("ins").addClass("act");c.submit(function(){b();return false;});}function b(){var g=c.get(0);var e=c.serializeArray();var h=0;for(var f=0;f<e.length;f++){if(e[f].name=="voting_answer_id"){h=e[f].value;break;}}if(h>0){$G.getJSON({_do:"vote",answer_id:h},d);}}function d(g){if((g)&&(g.answers)){var e=$(document.createElement("dl")).insertAfter(c);for(var f=0;f<g.answers.length;f++){e.append($(document.createElement("dt")).html(g.answers[f][0])).append($(document.createElement("dd")).html(g.answers[f][1]));
}c.replaceWith(e);}}return{init:function(){c=$(document.getElementById("voting")).find("form");if(c.length){a();}}};}();$(function(){$G.NavigationBar.setup();$G.Clocks.init("i-clocks",$G.timezoneOffset);$G.Clocks.addElement("call-request-clocks");$G.VisualEffects();$G.MetaLinks.init();$G.LoginForm.init();$G.CallRequest.init("call-request-form");$G.Votings.init();if(window._SITE==="b2b"){B2B.init();}if(window._SITE==="catalog"){$G.Catalog.init();}});
