(function(e){window._bilingualTheme.bilingualElements=[],window.Bilingual=function(){e(function(){var b=e(".lang-attr"),h=e(".lang-select");_bilingualTheme.settings.use_lang2||(e(".lang-select").remove(),C("sn-multiling")),h.show(),L(),k(),h.on("click","span",function(){currentLang=p(e(this).data("lang"))});function p(a){var a;_bilingualTheme.settings.primary_language=="1"?a=a==null?"lang1":a:a=a==null?"lang2":a,languages=e(".lang"),newLang=e("."+a),languages.hide(),newLang.show(),e.each(newLang,function(n,i){i=e(i),i.hasClass("inline-block")?i.css("display","inline-block"):i.css("display","block")}),e.each(window._bilingualTheme.bilingualElements,function(n,i){var g=i.elem;if(i.attr!="text")i[a]!=""&&g.attr(i.attr,i[a]);else{var r="";i[a]!=""?(r=i[a],g.data("price")&&(r+=" - "+g.data("price"))):r=g.text(),r!=""&&g.text(r)}});var t="";if(_bilingualTheme.template=="index")t=_bilingualTheme.shopName;else{var l=e(".tab-title");l.find(".lang").length>0?t=e(".tab-title ."+a).first().text():t=l.text()}return t!=_bilingualTheme.shopName&&(t+=" | "+_bilingualTheme.shopName),_(t),d("sn-multiling",a,1),a}function _(s){window.document.title=s}function k(){var s=E("sn-multiling");p(s)}function d(s,a,t){if(t){var l=new Date;l.setTime(l.getTime()+t*24*60*60*1e3);var n="; expires="+l.toGMTString()}else var n="";document.cookie=s+"="+a+n+"; path=/"}function E(s){for(var a=s+"=",t=document.cookie.split(";"),l=0;l<t.length;l++){for(var n=t[l];n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(a)==0)return n.substring(a.length,n.length)}return null}function C(s){d(s,"",-1)}function L(){var s=_bilingualTheme.template.indexOf("product")!=-1;if(e.each(b,function(l,n){if(n=e(n),attr=n.data("attr"),n.length!=0){var i=n.data("bilingual").toString(),g=i.indexOf("|"),r=i.substring(0,g),u=i.substring(g+1,n.data("bilingual").length);window._bilingualTheme.bilingualElements.push({elem:n,attr:attr,lang1:r,lang2:u})}}),s){var a=e(".selector-wrapper");e.each(a,function(l,n){var i=e(n),g=i.find("label"),r=i.find("option"),u=g.text().toString(),f=u.indexOf("|");if(f!=-1){var S=u.substring(0,f),N=u.substring(f+1,u.length);g.text(""),e("<span></span>",{class:"lang lang1",text:S}).appendTo(g),e("<span></span>",{class:"lang lang2",text:N}).appendTo(g)}e.each(r,function(P,v){var m=e(v),o=m.val().toString(),w=o.indexOf("|"),c=o.substring(0,w),x=o.substring(w+1,o.length),O;c=c==""?x:c,e.each(window._bilingualTheme.bilingualElements,function(y,T){var B=v.nodeName+" "+m.text(),A=T.elem[0].nodeName+" "+T.elem.text();B==A&&(O=y)}),window._bilingualTheme.bilingualElements.push({elem:m,attr:"text",lang1:c,lang2:x})})})}var t=e(".lang1");e.each(t,function(l,n){e(n).next().hasClass("lang")||e(n).removeClass("lang lang1")})}})},Bilingual()})(jQuery);
//# sourceMappingURL=/s/files/1/1068/0658/t/2/assets/bl-scripts.js.map?v=63916719907177140801448030256