var SocialShareKit=function(){function h(n){return r(n).share()}function c(n){document.readyState!="loading"?n():document.addEventListener?document.addEventListener("DOMContentLoaded",n):document.attachEvent("onreadystatechange",function(){document.readyState!="loading"&&n()})}function u(n){return document.querySelectorAll(n)}function l(n,t){for(var i=0;i<n.length;i++)t(n[i],i)}function a(n,t,i){n.addEventListener?n.addEventListener(t,i):n.attachEvent("on"+t,function(){i.call(n)})}function f(n){return n.className.match(s)}function v(n){var t=n||window.event;return t.preventDefault?t.preventDefault():(t.returnValue=!1,t.cancelBubble=!0),t.currentTarget||t.srcElement}function y(n,t,i){var r,u,f,e;return t&&i?(u=document.documentElement.clientWidth/2-t/2,f=(document.documentElement.clientHeight-i)/2,e="status=1,resizable=yes,width="+t+",height="+i+",top="+f+",left="+u,r=window.open(n,"",e)):r=window.open(n),r.focus(),r}function p(t,i,r){var u,s=o(t,i,r),v=e(t,i,r,s),c=typeof s.title!="undefined"?s.title:w(i),h=typeof s.text!="undefined"?s.text:b(i),l=s.image?s.image:n("og:image"),a=typeof s.via!="undefined"?s.via:n("twitter:site"),f={shareUrl:v,title:c,text:h,image:l,via:a,options:t,shareUrlEncoded:function(){return encodeURIComponent(this.shareUrl)}};switch(i){case"facebook":u="https://www.facebook.com/share.php?u="+f.shareUrlEncoded();break;case"twitter":u="https://twitter.com/intent/tweet?url="+f.shareUrlEncoded()+"&text="+encodeURIComponent(c+(h&&c?" - ":"")+h);a&&(u+="&via="+a.replace("@",""));break;case"google-plus":u="https://plus.google.com/share?url="+f.shareUrlEncoded();break;case"pinterest":u="https://pinterest.com/pin/create/button/?url="+f.shareUrlEncoded()+"&description="+encodeURIComponent(h);l&&(u+="&media="+encodeURIComponent(l));break;case"tumblr":u="https://www.tumblr.com/share/link?url="+f.shareUrlEncoded()+"&name="+encodeURIComponent(c)+"&description="+encodeURIComponent(h);break;case"linkedin":u="https://www.linkedin.com/shareArticle?mini=true&url="+f.shareUrlEncoded()+"&title="+encodeURIComponent(c)+"&summary="+encodeURIComponent(h);break;case"vk":u="https://vkontakte.ru/share.php?url="+f.shareUrlEncoded();break;case"buffer":u="https://buffer.com/add?source=button&url="+f.shareUrlEncoded()+"&text="+encodeURIComponent(h);break;case"email":u="mailto:?subject="+encodeURIComponent(c)+"&body="+encodeURIComponent(c+"\n"+v+"\n\n"+h+"\n")}if(f.networkUrl=u,t.onBeforeOpen)t.onBeforeOpen(r,i,f);return f.networkUrl}function e(n,t,i,r){return r=r||o(n,t,i),r.url||window.location.href}function w(t){var i;return t=="twitter"&&(i=n("twitter:title")),i||document.title}function b(t){var i;return t=="twitter"&&(i=n("twitter:description")),i||n("description")}function n(n,t){var i,r=u("meta["+(t?t:n.indexOf("og:")===0?"property":"name")+'="'+n+'"]');return r.length&&(i=r[0].getAttribute("content")||""),i||""}function o(n,t,i){var u=["url","title","text","image"],o={},f,r,e,s,h=i.parentNode;t=="twitter"&&u.push("via");for(s in u)r=u[s],e="data-"+r,f=i.getAttribute(e)||h.getAttribute(e)||(n[t]&&typeof n[t][r]!="undefined"?n[t][r]:n[r]),typeof f!="undefined"&&(o[r]=f);return o}function k(n,t){var i=document.createElement("div");i.innerHTML=t;i.className="ssk-num";n.appendChild(i)}function d(n,t,i,r){var u,f,o,e=encodeURIComponent(t);switch(n){case"facebook":u="https://graph.facebook.com/?id="+e;f=function(n){return r(n.share?n.share.share_count:0)};break;case"twitter":i&&i.twitter&&i.twitter.countCallback&&i.twitter.countCallback(t,r);break;case"google-plus":u="https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ";o='[{"method":"pos.plusones.get","id":"p","params":{"id":"'+t+'","userId":"@viewer","groupId":"@self","nolog":true},"jsonrpc":"2.0","key":"p","apiVersion":"v1"}]';f=function(n){return n=JSON.parse(n),n.length?r(n[0].result.metadata.globalCounts.count):void 0};g(u,f,o);return;case"linkedin":u="https://www.linkedin.com/countserv/count/share?url="+e;f=function(n){return r(n.count)};break;case"pinterest":u="https://api.pinterest.com/v1/urls/count.json?url="+e;f=function(n){return r(n.count)};break;case"vk":u="https://vk.com/share.php?act=count&url="+e;f=function(n){return r(n)};break;case"buffer":u="https://api.bufferapp.com/1/links/shares.json?url="+e;f=function(n){return r(n.shares)}}u&&f&&nt(n,u,f,o)}function g(n,t,i){var r=new XMLHttpRequest;r.onreadystatechange=function(){this.readyState===4&&this.status>=200&&this.status<400&&t(this.responseText)};r.open("POST",n,!0);r.setRequestHeader("Content-Type","application/json");r.send(i)}function nt(n,t,i){var r="cb_"+n+"_"+Math.round(1e5*Math.random()),u=document.createElement("script");return window[r]=function(n){try{delete window[r]}catch(t){}document.body.removeChild(u);i(n)},n=="vk"?window.VK={Share:{count:function(n,t){window[r](t)}}}:n=="google-plus"&&(window.services={gplus:{cb:window[r]}}),u.src=t+(t.indexOf("?")>=0?"&":"?")+"callback="+r,document.body.appendChild(u),!0}var s=/(twitter|facebook|google-plus|pinterest|tumblr|vk|linkedin|buffer|email)/,i="*|*",r,t;return t=function(n){var t=n||{},i=t.selector||".ssk";this.nodes=u(i);this.options=t},t.prototype={share:function(){function o(t){var r=v(t),h=f(r),u=h[0],i,o,s,e,c;if(h&&(i=p(n,u,r),i)){if(window.twttr&&r.getAttribute("href").indexOf("twitter.com/intent/")!==-1){r.setAttribute("href",i);return}if(u!=="email"){if(u==="buffer"?(o=800,s=680):(o=575,s=400),e=y(i,o,s),n.onOpen)n.onOpen(r,u,i,e);n.onClose&&(c=window.setInterval(function(){if(e.closed!==!1){window.clearInterval(c);n.onClose(r,u,i,e)}},250))}else document.location=i}}function s(){var r,u;for(r in t)u=r.split(i),function(t){d(u[0],u[1],n,function(n){for(var i in t)k(t[i],n)})}(t[r])}var r=this.nodes,n=this.options,t={},u=function(){r.length&&(l(r,function(r){var u=f(r),s;u&&(r.getAttribute("data-ssk-ready")||(r.setAttribute("data-ssk-ready",!0),a(r,"click",o),r.parentNode.className.indexOf("ssk-count")!==-1&&(u=u[0],s=u+i+e(n,u,r),s in t||(t[s]=[]),t[s].push(r))))}),s())};return n.forceInit===!0?u():c(u),this.nodes}},r=function(n){return new t(n)},{init:h}}();window.SocialShareKit=SocialShareKit