var Domain=document.location.protocol+"//"+document.location.host;var Yauth=false;try{Yauth=Lego.isSessionValid()}catch(e){}var Retpath=document.location.href;var modules_handlers=[{reqs:["MyShopsBar","AjaxProcessor","AjaxRequest","toolbar_init"],handler:"toolbar_init"}];function srcloaded(){var c,d,b,a;for(d in modules_handlers){c=modules_handlers[d];a=true;for(b in c.reqs){a=a?c.reqs[b] in window:false}if(a){window[c.handler]()}}}if(document.documentElement.getBoundingClientRect){jQuery.fn.superOffset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return jQuery.superOffset.bodyOffset(this[0])}var c=this[0].getBoundingClientRect(),g=this[0].ownerDocument,b=g.body,a=g.documentElement,i=a.clientTop||b.clientTop||0,h=a.clientLeft||b.clientLeft||0,f=c.top+(self.pageYOffset||jQuery.boxModel&&a.scrollTop||b.scrollTop)-i,d=c.left+(self.pageXOffset||jQuery.boxModel&&a.scrollLeft||b.scrollLeft)-h;return{top:f,left:d}}}else{if(document.getBoxObjectFor){jQuery.fn.superOffset=function(){if(this[0]===document){return{top:0,left:0}}var g=document.getBoxObjectFor(this[0]),f=0,i=0,d=this[0],h=d.ownerDocument,b=h.documentElement,a=h.body;var c=h.defaultView.getComputedStyle(d,null);while((d=d.parentNode)&&d!==a&&d!==b){f+=d.scrollTop;i+=d.scrollLeft}return{top:g.y-parseInt(c.borderTopWidth,10)-f,left:g.x-parseInt(c.borderLeftWidth,10)-i}}}else{jQuery.fn.superOffset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return jQuery.superOffset.bodyOffset(this[0])}jQuery.superOffset.initialized||jQuery.superOffset.initialize();var g=this[0],c=g.offsetParent,b=g,m=g.ownerDocument,j,d=m.documentElement,h=m.body,i=m.defaultView,a=i.getComputedStyle(g,null),l=g.offsetTop,f=g.offsetLeft;while((g=g.parentNode)&&g!==h&&g!==d){j=i.getComputedStyle(g,null);if(!jQuery.browser.opera||jQuery.browser.version>9.27||(g.tagName!="TR"&&g.tagName!="TBODY")){l-=g.scrollTop,f-=g.scrollLeft}if(g===c){l+=g.offsetTop,f+=g.offsetLeft;if(jQuery.superOffset.doesNotAddBorder&&!(jQuery.superOffset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(g.tagName))){l+=parseInt(j.borderTopWidth,10)||0,f+=parseInt(j.borderLeftWidth,10)||0}b=c,c=g.offsetParent}if(jQuery.superOffset.subtractsBorderForOverflowNotVisible&&j.overflow!=="visible"){l+=parseInt(j.borderTopWidth,10)||0,f+=parseInt(j.borderLeftWidth,10)||0}a=j}if(a.position==="relative"||a.position==="static"){l+=h.offsetTop,f+=h.offsetLeft}if(a.position==="fixed"){l+=Math.max(d.scrollTop,h.scrollTop),f+=Math.max(d.scrollLeft,h.scrollLeft)}return{top:l,left:f}}}}jQuery.superOffset={initialize:function(){if(this.initialized){return}var i=document.body,b=document.createElement("div"),d,c,l,f,j,a,g=i.style.marginTop,h='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';j={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(a in j){b.style[a]=j[a]}b.innerHTML=h;i.insertBefore(b,i.firstChild);d=b.firstChild,c=d.firstChild,f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(c.offsetTop!==5);this.doesAddBorderForTableAndCells=(f.offsetTop===5);d.style.overflow="hidden",d.style.position="relative";this.subtractsBorderForOverflowNotVisible=(c.offsetTop===-5);i.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(i.offsetTop===0);i.style.marginTop=g;i.removeChild(b);this.initialized=true},bodyOffset:function(a){jQuery.superOffset.initialized||jQuery.superOffset.initialize();var c=a.offsetTop,b=a.offsetLeft;if(jQuery.superOffset.doesNotIncludeMarginInBodyOffset){c+=parseInt(jQuery.curCSS(a,"marginTop",true),10)||0,b+=parseInt(jQuery.curCSS(a,"marginLeft",true),10)||0}return{top:c,left:b}}};jQuery.fn.extend({position:function(){function b(i,j){return i[0]&&parseInt(jQuery.curCSS(i[0],j,true),10)||0}var g=0,f=0,c;if(this[0]){var d=this.offsetParent(),h=this.superOffset(),a=/^body|html$/i.test(d[0].tagName)?{top:0,left:0}:d.superOffset();h.top-=b(this,"marginTop");h.left-=b(this,"marginLeft");a.top+=b(d,"borderTopWidth");a.left+=b(d,"borderLeftWidth");c={top:h.top-a.top,left:h.left-a.left}}return c},offsetParent:function(){var a=this[0].offsetParent||document.body;while(a&&(!/^body|html$/i.test(a.tagName)&&jQuery.css(a,"position")=="static")){a=a.offsetParent}return jQuery(a)}});var usePageOffset=typeof window.pageXOffset=="number";jQuery.each(["Left","Top"],function(b,a){var c="superScroll"+a;jQuery.fn[c]=function(d){if(!this[0]){return null}return d!==undefined?this.each(function(){this==window||this==document?window.scrollTo(!b?d:jQuery(window).superScrollLeft(),b?d:jQuery(window).superScrollTop()):this[c]=d}):this[0]==window||this[0]==document?(usePageOffset?self[b?"pageYOffset":"pageXOffset"]:jQuery.boxModel&&document.documentElement[(c=="superScrollLeft")?"scrollLeft":"scrollTop"]||document.body[(c=="superScrollLeft")?"scrollLeft":"scrollTop"]):this[0][c]}});(function(b){var g=b(document);g.keyup(function(d){var h="";if(window.event){h=d.keyCode}else{if(d.which){h=d.which}}if(h==27){b.fn.popupClose()}});g.bind("click",c);g.data("popup",{lastParent:0,modal:false,id:0});b.fn.popupOpen=function(h){var z=g.data("popup");var q=b(this).attr("id")||"p007";var i=h.type||"success";var m=h.cache||true;var y=(i=="success"||i=="inform"||i=="warning"||i=="action_modal");if(!z.lastParent||(z.lastParent&&!z.modal&&"popup"+b(this).attr("id")!==z.id)){f();var w="";b("body").append('<div id="popup'+q+'" class="b-popup"></div>');var t=b("#popup"+q);window._pp=t;var w="";if(i=="tip"){w+='<div class="b-popup-content"><div class="b-popup-body"></div></div>'}else{w+='<i class="b-popup-tl"></i><i class="b-popup-tr"></i><i class="b-popup-t"></i><i class="b-popup-l"></i><div class="b-popup-content"><div class="b-popup-close" title="Закрыть (Esc)"><i></i></div><div class="b-popup-body"></div></div><i class="b-popup-r"></i><i class="b-popup-b"></i><i class="b-popup-bl"></i><i class="b-popup-br"></i>'}b(w).appendTo(t);w="";if("title" in h){t.find("div.b-popup-content").prepend('<div class="b-popup-title">'+h.title+"</div>")}else{if(i!="tip"){t.find("div.b-popup-body").css({"padding-top":"10px"})}}if(h.url){b.ajax({url:h.url,cache:m,beforeSend:function(){t.find("div.b-popup-body").html("<p>Загружается...</p>")},success:function(A){t.find("div.b-popup-body").html(A)}})}else{if(h.node){w=b(h.node).clone().wrap("<div></div>").parent()}else{if(h.html){w=h.html}}}t.find("div.b-popup-body").append(w);if(y){t.addClass("b-popup-modal");b("body").addClass("doNotFlicker")}t.addClass("b-popup-"+i);if(i=="note"||i=="tip"){t.find("div.b-popup-content").prepend('<div class="b-popup-tail"></div>');t.css({position:"absolute"})}var o=parseInt(t.outerWidth());var p=(h.height)?((parseInt(h.height)%2==1)?parseInt(h.height)+1:parseInt(h.height)):false;if(p){t.find("div.b-popup-body").css({height:p+"px"})}var r=(h.width)?((parseInt(h.width)%2==1)?parseInt(h.width)+1:parseInt(h.width)):false;if(r){if(y){t.find("div.b-popup-body").css({width:r+"px"})}t.css({width:(r+30)+"px"})}var v=b(this).superOffset();var x={width:t.outerWidth(),height:t.outerHeight()};if(y){if(h.top){t.css({top:parseInt(h.top)+"px"})}else{t.css({"margin-top":Math.floor(x.height/2*(-1))+"px"})}if(h.left){t.css({left:parseInt(h.left)+"px"})}else{t.css({"margin-left":Math.floor(x.width/2*(-1))+"px"})}}else{if(i=="note"){t.css({top:v.top+b(this).innerHeight()+"px",left:v.left+"px"})}else{if(i=="tip"){t.css({top:v.top+"px",left:v.left+80+"px"})}else{var j=g.scrollTop();var d=g.scrollLeft();var n=Math.max(Math.floor((b(window).height()-x.height)/2+j),j);var l=Math.max(Math.floor((b(window).width()-x.width)/2+d),d);t.css({top:n+"px",left:l+"px"})}}}if(b(window).width()-v.left<x.width&&v.left>x.width&&!y){t.addClass("b-popup-note-right");var u=(-1)*(x.width-(o+parseInt(t.css("margin-left"))));t.css({"margin-left":u})}else{if(!y&&i=="note"){t.addClass("b-popup-note-left")}else{if(!y&&i=="tip"){t.addClass("b-popup-tip-left")}}}t.find("div.b-popup-close").bind("click",function(){b(this).popupClose(t)});g.data("popup").lastParent=this;g.data("popup").modal=y;g.data("popup").id="popup"+q;g.data("popup").onclose="onclose" in h?h.onclose:null;t.addClass("someFakeClassName");if(h.timeout){setTimeout(function(){b.fn.popupClose()},h.timeout)}return false}};function a(h){var i={left:h.offsetLeft,top:h.offsetTop};if(h.offsetParent){var d=a(h.offsetParent);i.left+=d.left;i.top+=d.top}return i}b.fn.popupClose=function(d){if(b.support.opacity){b('div[class~="b-popup"]').fadeOut("fast",f)}else{f()}return true};function f(){var d=b('div[class~="b-popup"]');b("body").removeClass("doNotFlicker");d.filter("#MarketMyShopsBar").hide();d.filter(":not(#MarketMyShopsBar)").remove();if(typeof g.data("popup").onclose=="function"){g.data("popup").onclose()}g.data("popup",{modal:false,lastParent:0,id:0})}function c(h){var d=g.data("popup").modal;if(h.target==g.data("popup").lastParent||b(h.target).parents().is("div.b-popup")||b(h.target).is(".b-popup")||d){return true}else{if(!g.data("popup").modal&&g.data("popup").lastParent){b.fn.popupClose();return false}else{return true}}}})(window.jQuery);function AjaxProcessor(a){this.HTTPCode=0;this.status=0;this.customer=a;this.result=null;this.ProgID=["MSXML2.XMLHTTP","Microsoft.XMLHTTP"]}AjaxProcessor.prototype._getConnector=function(){try{return new XMLHttpRequest()}catch(b){for(var a=0;a<this.ProgID.length;a++){try{return new ActiveXObject(this.ProgID[a])}catch(b){continue}}return false}};AjaxProcessor.prototype.stop=function(){if(this.request&&this.request.readyState!=4){this.request.abort()}};AjaxProcessor.prototype.start=function(){var c;this.request=c=this._getConnector();if(!c){return false}this.customer.sleep();var a=this.customer;var b=this;c.onreadystatechange=function(){if(c.readyState==4&&c.status){return a.wakeup(c.status,c.responseText)}return false};c.open(this.customer.getMethod(),this.customer.calculateUrl(),this.customer.async);c.send(this.customer.body);return true};function printr(o){s="";for(k in o){s+=k+"=["+eval("o[k]")+"], "}alert(s)}function validateUrl(a){return true}function Dispatcher(){this.collection=[];this.add=function(a){this.collection[this.collection.length]=a;return this.collection.length-1};this.get=function(a){return this.collection[a]};this.unset=function(a){return this.collection[a]=null}}var Globals=new Dispatcher;function isMethodBelongToObject(a,b){return typeof(b)=="string"&&b.length!=0&&a[b]!=undefined&&typeof(a[b])=="function"}function isUrl(a){return typeof(a)=="string"&&a.length>0&&validateUrl(a)}function isObject(a){return typeof(a)=="object"}function CreateAjaxRequest(f,d,c,b,a){if(isObject(f)&&isMethodBelongToObject(f,c)&&isMethodBelongToObject(f,b)&&isUrl(d)){return new AjaxRequest(f,d,c,b,a)}else{return null}}function AjaxRequest(f,d,c,b,a){this.method="GET";this.url=d;this.traceArgs=a||null;this.successCode="200";this.timeout=10000;this.timer=null;this.body=null;this.customer=f;this.successMeth=c;this.unSuccessMeth=b;this.result=null;this.params=[];this.randurl=true;this.provider=new AjaxProcessor(this);this.dnum=Globals.add(this);this.async=true;this.can=false}AjaxRequest.prototype.setTimeout=function(a){this.timeout=a};AjaxRequest.prototype.getTimeout=function(a){return this.timeout};AjaxRequest.prototype.calculateUrl=function(){var a=this.url;a+=(this.params.length||this.randurl?"?":"");for(var b=0;b<this.params.length;b++){a+="&"+this.params[b][0]+"="+encodeURIComponent(this.params[b][1])}a+=(this.randurl?"&rnd="+Math.random():"");return a};AjaxRequest.prototype.setSuccessCode=function(a){this.successCode=a;return true};AjaxRequest.prototype.setParam=function(b,c,a){var d=isNaN(a)?this.params.length:a;this.params[d]=[b,c];return d};AjaxRequest.prototype.setMethod=function(a){if(a=="GET"||a=="POST"){this.method=a;return true}return false};AjaxRequest.prototype.getMethod=function(){return this.method};AjaxRequest.prototype.start=function(){this.can=true;return this.provider.start()};AjaxRequest.prototype.wakeup=function(a,c){if(this.timer==false||this.can==false){return false}else{clearTimeout(this.timer)}var b=(this.traceArgs!=null?this.traceArgs:"");if(a==this.successCode){return this.customer[this.successMeth](c,b)}else{return this.customer[this.unSuccessMeth](b)}};AjaxRequest.prototype.wakeupByTimeout=function(){clearTimeout(this.timer);this.can=false;this.timer=false;var a=(this.traceArgs!=null?this.traceArgs:"");this.customer[this.unSuccessMeth](a);return false};AjaxRequest.prototype.sleep=function(){this.timer=window.setTimeout("Globals.get("+this.dnum+").wakeupByTimeout();",this.timeout)};srcloaded();function MyShop(name,shopid,rate,ordering,delivery,quality,text,context){this.shopid=shopid;this.name=name;this.context=context;this.buff={};this.offers={};this.gp_0=rate||null;this.text=text||"";this.ordering=ordering||null;this.delivery=delivery||null;this.quality=quality||null;this.gate=Domain+"/gate/";this.addOffer=function(offerid,abuseurl){if(!(offerid in this.offers)){this.offers[offerid]=abuseurl}};this.setRateOk=function(response,trace){var result;eval(response);if(result&&("processing" in result)&&(result.processing==true)){this.gp_0=result.gp_0-0;this.ordering=result.gp_1-0;this.delivery=result.gp_2-0;this.quality=result.gp_3-0;this.text=(result.text!="null"&&$.trim(result.text)!="")?$.trim(result.text):"";if(this.text==""){MyShopsBar.set_current(trace[0],trace[1]);MyShopsBar.deactivate();this.buff={};MyShopsBar.setValues()}else{var gradeLink=document.getElementById("toolbarplace"+trace[0]);window.open(gradeLink.href+"&r=1&sign","_self")}}else{}return true};this.setRateFailed=function(){return false};this.abuse=function(offerid){if(offerid in this.offers){document.location.href=this.offers[offerid]+"&abusetext="+trim(EncodeURI(MyShopsBar.elems.textarea.value))}return false};this.commit=function(rate){var gp_0=this.buff&&"gp_0" in this.buff?this.buff.gp_0:this.gp_0;if(gp_0==null){$("#MTB_no-rate-warning").css("display","inline");$("#textSpacerMainRate").addClass("errorAlert")}else{var ordering=this.buff&&"ordering" in this.buff?this.buff.ordering:this.ordering;var delivery=this.buff&&"delivery" in this.buff?this.buff.delivery:this.delivery;var quality=this.buff&&"quality" in this.buff?this.buff.quality:this.quality;var text=$.trim(MyShopsBar.elems.textarea.value);this.buff={};var oRequest=CreateAjaxRequest(this,this.gate,"setRateOk","setRateFailed",[MyShopsBar.current_place,MyShopsBar.current_shop]);oRequest.setParam("a","c");oRequest.setParam("shop_id",this.shopid);oRequest.setParam("anonymous",1);oRequest.setParam("sk",mvc.obj("user").prop("sk"));if(gp_0!=null){oRequest.setParam("gr_0",gp_0)}if(ordering!=null){oRequest.setParam("gr_1",ordering)}if(delivery!=null){oRequest.setParam("gr_2",delivery)}if(quality!=null){oRequest.setParam("gr_3",quality)}if(MyShopsBar.current_place in MyShopsOffers){oRequest.setParam("context",MyShopsOffers[MyShopsBar.current_place])}oRequest.setParam("comment",myenc(text));oRequest.start()}return false}}var MyShopsOffers={};var MyShopsCollection={shops:{},addOffer:function(b,j,g,i,d,f,l,m,c,h,a){if(!(b in this.shops)){this.shops[b]=new MyShop(b,j,i,d,f,l,m,c)}this.shops[b].addOffer(g,h);if(a){MyShopsOffers[g]=a}}};function viewportSize(){var a=[];if(typeof window.innerHeight!="undefined"){a=[window.innerWidth,window.innerHeight]}else{var b=(document.body.clientWidth)?document.body:document.documentElement;a=[b.clientWidth,b.clientHeight]}return a}function getPlace(c){var b=viewportSize();var a=$(window);return{x:(a.width()/2)+a.scrollLeft(),y:(a.height()/2)+a.scrollTop()}}var MyShopsBar={agreement_action:false,current_place:false,current_shop:false,nailed:false,real_rate:null,real_rate_timer:false,elems:{},auth:Yauth,grades_smile:[":-((",":-(",":-|",":-)",":-))"],grades_text:[["ужасный&#160;магазин","Удобство&#160;заказа","Доставка","Качество&#160;товара"],["плохой магазин","Удобство&#160;заказа","Доставка","Качество&#160;товара"],["обычный магазин","Удобство&#160;заказа","Доставка","Качество&#160;товара"],["хороший магазин","Удобство&#160;заказа","Доставка","Качество&#160;товара"],["отличный&#160;магазин","Удобство&#160;заказа","Доставка","Качество&#160;товара"]],init:function(a){this.agreement=a||false;this.elems.shopsbar=document.getElementById("MarketMyShopsBar");this.elems.shopheader=document.getElementById("marketMyShopsBarShopHeader");this.elems.textarea=document.getElementById("commentArea");this.elems.thermometer=document.getElementById("marketMyShopsBarThermometer");this.elems.thermometer_link=document.getElementById("MSBT_Link");this.elems.userAlert=document.getElementById("userOpinionAlert")},TTimer:null,killTTimer:function(){if(this.TTimer!=null){window.clearTimeout(this.TTimer)}},enable_thermometer:function(){this.killTTimer();this.TTimer=window.setTimeout(function(){MyShopsBar.hide_thermometer()},600);return false},hide_thermometer:function(){this.killTTimer();this.elems.thermometer.style.display="none";return false},activate_thermometer:function(a){if(this.elems.userAlert){this.elems.userAlert.style.display="none"}return this.set_current(this.thermometer_state[0],this.thermometer_state[1],this.thermometer_state[2])},set_thermometer:function(a,b,c){var d=MyShopsCollection.shops[b].gp_0;this.thermometer_state=[a,b,c];this.elems.thermometer_link.innerHTML=d!=null?"<span>моя оценка</span>":"<span>написать отзыв</span>";this.elems.thermometer_link.onmouseover=function(){return MyShopsBar.killTTimer()};this.elems.thermometer_link.onmouseout=function(){return MyShopsBar.enable_thermometer()};return false},thermometer:function(d,a,b,c){if(this.nailed){return false}this.elems.thermometer.onmouseover=function(){return false};this.set_thermometer(a,b,c);return false},getRC:function(c,a){var b=(a===true)?"offsetTop":"offsetLeft";var d=c[b];while(c.offsetParent!=null){c=c.offsetParent;d+=c[b];if(c.tagName=="BODY"){break}}return d},set_current:function(a,b,c){if(!this.nailed){this.current_place=a;this.current_shop=b}else{this.deactivate();this.set_current(a,b)}try{this.activate(c)}catch(d){alert(d)}return false},subrate:function(a){if(this.current_shop===undefined||!this.current_shop||!(this.current_shop in MyShopsCollection.shops)||!("shopid" in MyShopsCollection.shops[this.current_shop])){return false}for(rate in a){MyShopsCollection.shops[this.current_shop].buff[rate]=a[rate]}this.setValues(MyShopsCollection.shops[this.current_shop].buff);return false},rate:function(a){this.real_rate=null;return this.subrate(a)},rateAndHideWarn:function(a){this.hideWarning();return this.rate(a)},hideWarning:function(){var a=$("#MTB_no-rate-warning");if(a.css("display")!="none"){a.css("display","none");$("#textSpacerMainRate").removeClass("errorAlert")}},commit:function(c){if(this.agreement_action){this.setAgreeTransaction(c);return false}var a=MyShopsCollection.shops[this.current_shop].commit();if(c){var b=this;window.setTimeout(function(){b.abuse()},500)}return false},abuse:function(){MyShopsCollection.shops[this.current_shop].abuse(this.current_place)},isValidGrade:function(a){return(",-2,-1,0,1,2,".indexOf(","+a+",")!=-1)},setValues:function(r,a){if(this.current_shop===undefined||!this.current_shop||!(this.current_shop in MyShopsCollection.shops)||!("shopid" in MyShopsCollection.shops[this.current_shop])){return false}$(this.elems.shopheader).text("Оценить магазин "+this.current_shop);var b=MyShopsCollection.shops[this.current_shop].gp_0;var u=MyShopsCollection.shops[this.current_shop].ordering;var t=MyShopsCollection.shops[this.current_shop].delivery;var p=MyShopsCollection.shops[this.current_shop].quality;var c=MyShopsCollection.shops[this.current_shop].text;b=(b!=null&&!isNaN(b))?b:null;u=(u!=null&&!isNaN(u))?u:null;t=(t!=null&&!isNaN(t))?t:null;p=(p!=null&&!isNaN(p))?p:null;var g=r&&"gp_0" in r&&(r.gp_0!=null&&!isNaN(r.gp_0))?r.gp_0:b;var o=c;var f=r&&"ordering" in r&&(r.ordering!=null&&!isNaN(r.ordering))?r.ordering:u;var d=r&&"delivery" in r&&(r.delivery!=null&&!isNaN(r.delivery))?r.delivery:t;var m=r&&"quality" in r&&(r.quality!=null&&!isNaN(r.quality))?r.quality:p;for(var l=0;l<5;l++){var n=l-2;document.getElementById("smilesMainRate"+n).className=((g!=null&&(g>=n))?" b-rating__star-my":" b-rating__star");document.getElementById("textSpacerMainRate"+n).className=(g!=null&&(g==n))?"visible":"tip";document.getElementById("ordering"+n).className=((f!=null&&(f>=n))?" b-rating__star-my":" b-rating__star");document.getElementById("delivery"+n).className=((d!=null&&(d>=n))?" b-rating__star-my":" b-rating__star");document.getElementById("quality"+n).className=((m!=null&&(m>=n))?" b-rating__star-my":" b-rating__star")}document.getElementById("textSpacerMainRate").className=(g==null)?"visible":"tip";var q=document.getElementById("agreepub");if(document.getElementById("MTB_rate")){document.getElementById("MTB_rate").disabled=(q!=null&&!this.agreement)}if(q){q.checked=this.agreement}if(this.isValidGrade(b)&&a!==true){for(offerid in MyShopsCollection.shops[this.current_shop].offers){var h=$("#toolbarplace"+offerid);if(h.length>0){h.find("span").html("моя оценка");var j="";for(l=-2;l<=b;l++){j+='<span class="b-rating__star b-rating__star-my" title="моя оценка магазина"><img class="b-rating__icon" alt="*" src="/blocks/b-rating/transparent.png"/></span>'}for(l=b+1;l<3;l++){j+='<span class="b-rating__star" title="моя оценка магазина"><img class="b-rating__icon" alt="*" src="/blocks/b-rating/transparent.png"/></span>'}h.parent().find("span.b-rating__with_text").find("span.b-rating").html(j)}else{return false}}}return false},setAgreeTransaction:function(a){var b=document.getElementById("agreepub");var c=CreateAjaxRequest(this,Domain+"/shop-grade.xml","setAgreeOk","setAgreeFailed",a?[a]:null);c.setParam("a","u");if(b.checked){c.setParam("confirmed",true)}c.start();return false},setAgreeOk:function(a,b){document.getElementById("grades_confirm").style.display="none";this.agreement_action=false;this.commit(b)},setAgreeFailed:function(a){},setAgree:function(){this.agreement=document.getElementById("agreepub").checked;this.agreement_action=this.agreement;this.setValues(MyShopsCollection.shops[this.current_shop].buff);return true},move:function(b,a){document.body.scrollTop=b;document.body.scrollLeft=a},deactivate:function(){if(this.elems.shopsbar){this.elems.shopsbar.style.visibility="hidden";this.elems.shopsbar.style.display="none";this.nailed=false;MyShopsCollection.shops[this.current_shop].buff={}}return false},activate:function(b){if(this.current_shop===undefined||!this.current_shop||!(this.current_shop in MyShopsCollection.shops)||!("shopid" in MyShopsCollection.shops[this.current_shop])){return false}if(this.current_place&&this.elems.shopsbar.style.display!="block"){this.setValues(null,true);this.elems.textarea.value=MyShopsCollection.shops[this.current_shop].text;var a=document.getElementById("toolbarplace"+this.current_place);var c=getPlace(a);this.elems.shopsbar.style.left=c.x-200+"px";this.elems.shopsbar.style.top=c.y-240>80?c.y-240+"px":80+"px";this.elems.shopsbar.style.visibility="visible";this.elems.shopsbar.style.display="block";this.nailed=true;this.burl=b}return false}};function myenc(a){return trim(a)}function trim(a){return a?a.replace(/^[\s\xA0]+/g,"").replace(/[\s\xA0]+$/g,""):""}function UnHideTree(b){var c="/i/i-minus.gif";var a="/i/i-plus.gif";if(b.firstChild.src.match(a)){b.firstChild.src=c;b.parentNode.parentNode.getElementsByTagName("li")[1].style.display="block"}else{b.firstChild.src=a;b.parentNode.parentNode.getElementsByTagName("li")[1].style.display="none"}return false}function hideLogin(){if(document.getElementById("login-form")){document.getElementById("login-form").style.display="none"}return false}function EncodeURI(a){try{return encodeURI(a)}catch(b){return escape(a)}}srcloaded();var ItemToMoveID=null;function checkCookie(){if(document.cookie.length>0){return true}else{alert("Для использования этой функции вам необходимо включить cookies в вашем браузере.");return false}}function showCode(){var a=document.getElementById("codeCont");if(a.className=="closed"){a.className="opened"}else{a.className="closed"}}function moveSelectedItem(b,g,d){var a=document.getElementById("memo-lists-layer-move-"+g);if(a){var f=getBoundsMarket(b);a.style.left=f.left+"px";a.style.top=f.top-(-2)+f.height+"px";switchElement(a);reloadCodeFrame();deleteIdent(d);deleteIdentGroups(g);deleteIdentOffers(g)}ItemToMoveID=g;return false}function moveItemToList(a,b){if(ItemToMoveID==null){return false}var c={BurnOk:function(){this.BurnFinish()},BurnFinish:function(){var d=document.getElementById("memo-lists-layer-move-"+ItemToMoveID);switchElement(d);if(!b){document.getElementById("item-id"+ItemToMoveID).parentNode.removeChild(document.getElementById("item-id"+ItemToMoveID))}if(b){window.location.href=window.location.href}ItemToMoveID=null;reloadCodeFrame();nothingShow()},BurnFailed:function(){alert("Ошибка перемешения. Попробуйте позже");this.BurnFinish()}};c.Request=CreateAjaxRequest(c,"/gate/move-items.xml","BurnOk","BurnFailed");c.Request.setParam("old_list_id",currentListId);c.Request.setParam("new_list_id",a);c.Request.setParam("id",ItemToMoveID);c.Request.start();return false}function clearList(c,a){if(confirm("Очистить список?")){var b={BurnOk:function(){this.BurnFinish()},BurnFinish:function(){var d=getElementsByClassName(document,"table","results")[0];d.style.display="none";c.style.display="none";document.getElementById("nothing-holder").style.display="block"},BurnFailed:function(){alert("Ошибка удаления. Попробуйте позже");this.BurnFinish()}};b.Request=CreateAjaxRequest(b,"/gate/clear-list.xml","BurnOk","BurnFailed");b.Request.setParam("list_id",a);b.Request.start()}return false}function reloadCodeFrame(){var a=document.getElementById("codeFrame");if(a){a.src=a.src}}function BurnComment(a,c){var b={BurnOk:function(){document.getElementById("note"+a).disabled=false;this.BurnFinish()},BurnFinish:function(){var f=document.getElementById("note"+a).value;document.getElementById("memo-note-"+a).innerHTML=f.replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>");reloadCodeFrame();setClass(document.getElementById("comment-place-"+a),"has-note",f=="");switchClass(document.getElementById("comment-place-"+a),"open");var d=document.getElementById("comment-swither-"+a);switchClass(d,"open");setClass(d,"has-note",f=="");d.firstChild.firstChild.data=(f=="")?"моя заметка":"моя заметка"},BurnFailed:function(){alert("Ошибка записи. Попробуйте позже")}};b.Request=CreateAjaxRequest(b,"/gate/add-ware.xml","BurnOk","BurnFailed");if(c=="2"){b.Request.setParam("offer_id",document.getElementById("offer_id"+a).value);b.Request.setParam("model_id",document.getElementById("model_id"+a).value);b.Request.setParam("display_name",document.getElementById("display_name"+a).value);b.Request.setParam("cat_name",document.getElementById("cat_name"+a).value);b.Request.setParam("hid",document.getElementById("hid"+a).value);b.Request.setParam("note",document.getElementById("note"+a).value);b.Request.setParam("type","o")}else{if(c=="1"){b.Request.setParam("group_id",document.getElementById("group_id"+a).value);b.Request.setParam("display_name",document.getElementById("display_name"+a).value);b.Request.setParam("cat_name",document.getElementById("cat_name"+a).value);b.Request.setParam("hid",document.getElementById("hid"+a).value);b.Request.setParam("note",document.getElementById("note"+a).value);b.Request.setParam("type","g")}else{b.Request.setParam("model_id",document.getElementById("model_id"+a).value);b.Request.setParam("display_name",document.getElementById("display_name"+a).value);b.Request.setParam("cat_name",document.getElementById("cat_name"+a).value);b.Request.setParam("hid",document.getElementById("hid"+a).value);b.Request.setParam("note",document.getElementById("note"+a).value);b.Request.setParam("type","m")}}document.getElementById("note"+a).disabled=true;b.Request.start();return false}function deleteIdent(f){var d=[];for(var c=0,b=0,a=idents.length;c<a;c++){if(idents[c]!=f){d[b++]=idents[c]}}idents=d;return idents}function deleteIdentGroups(f){var b=[];for(var d=0,c=0,a=identsGroups.length;d<a;d++){if(identsGroups[d]!=f){b[c++]=identsGroups[d]}}identsGroups=b;return identsGroups}function deleteIdentOffers(f){var d=[];for(var c=0,b=0,a=identsOffers.length;c<a;c++){if(identsOffers[c]!=f){d[b++]=identsOffers[c]}}identsOffers=d;return identsOffers}function deleteItem(d,c,a){conf_text="Удалить товар?";if(mvc.map("models").obj(c).prop("expected-price")>0){conf_text+="\nПри этом подписка на товар аннулируется."}if(confirm(conf_text)){var b={BurnOk:function(){this.BurnFinish()},BurnFinish:function(){document.getElementById("item-id"+d).parentNode.removeChild(document.getElementById("item-id"+d));reloadCodeFrame();deleteIdent(c);deleteIdentGroups(c);deleteIdentOffers(c);nothingShow()},BurnFailed:function(){alert("Ошибка удаления. Попробуйте позже");this.BurnFinish()}};b.Request=CreateAjaxRequest(b,"/gate/delete-item.xml","BurnOk","BurnFailed");b.Request.setParam("a","d");b.Request.setParam("id",d);b.Request.setParam("list_id",a);b.Request.start();return false}else{return false}}function compareSelectedItems_OPEN(b){var a=document.getElementById("memo-lists-layer-categories");if(a){var d=getBoundsMarket(b);a.style.left=d.left+"px";a.style.top=d.top-(-2)+d.height+"px";if(a.style.display=="none"){switchElement(a);return false}}return false}function compareSelectedItems(c,a){if(c.match(/bla/)){var b=c.replace(/bla/g,",").replace(/,$/,"")}else{var b=c}window.open("/compare.xml?CMD=-CMP="+b+"&hid="+a+"&list_id="+currentListId+"&from_memo","_self");return false}function searchSelectedItemsOneShop(c,a){if(idents.length>20){alert("Поиск в одном магазине ищет до 20 товаров");return false}else{var h=idents.join(",")?idents.join(","):"";var g=identsOffers.join(",o")?",o"+identsOffers.join(",o"):"";var f=identsGroups.join(",g")?",g"+identsGroups.join(",g"):"";if(idents.length==0){identsOffers[0]="o"+identsOffers[0];var g=identsOffers.join(",o")}if(idents.length==0&&identsOffers.length==0){identsGroups[0]="g"+identsGroups[0];var f=identsGroups.join(",g")}var b=h.concat(g);var d=b.concat(f);if(c&&a){window.open("/search-models.xml?model_ids="+d+"&list_id="+c+"&hid="+a,"_self")}else{if(c){window.open("/search-models.xml?model_ids="+d+"&list_id="+c,"_self")}else{if(a){window.open("/search-models.xml?model_ids="+d+"&hid="+a,"_self")}else{window.open("/search-models.xml?model_ids="+d,"_self")}}}return false}}function nothingShow(){if(idents.length==0&&identsGroups.length==0&&identsOffers.length==0){$("#nothing-holder").show()}}function switchListComment(){var b=$("#list-comment").get(0);var a=$("#list-comment-text").get(0);if(b&&a){switchElement(b);switchElement(a)}}function switchListName(){var a=$("#list-name").get(0);if(a){switchElement(a)}};
