(function(j,g){var d=j.bShareUtil,k=j.bShareControl;d.createShareBox=function(b,a){var c=j[b];c.isOpen=!1;c.bsBox=null;c.create=function(){d.loadStyle("#bsBox {z-index:100000001;background:transparent;padding:0;margin:0;border:none;width:"+a.boxWidth+"px;height:"+a.boxHeight+"px;} #bsClose {_overflow:hidden;cursor:pointer;position:absolute;color:#666;font-weight:bold;font-family:Arial,\u5b8b\u4f53,sans-serif;font-size:12px;line-height:normal;} ");var b=g.createElement("div"),h='<div id="bsBox" style="display:none;"><div id="bsClose">X</div><iframe id="bShareFrame" name="bsFrame'+
Math.floor(Math.random()*1E3)+'" frameborder="0" scrolling="no" allowtransparency="true" transparency="true"></iframe></div>';b.innerHTML=h;g.body.appendChild(b);c.bsBox=g.getElementById("bsBox");g.getElementById("bsClose").onclick=function(){c.disappear()}};c.show=function(a){c.isOpen?c.disappear():(c.prepare(a),c.load(),c.display())};c.display=function(){a.position=a.position||0;switch(a.position){case 0:var b=(d.getWH().w-a.boxWidth)/2,h=(d.getWH().h-a.boxHeight)*2/5,e=Math.max(g.documentElement.scrollTop,
g.body.scrollTop);c.bsBox.style.position=d.isQk()?"absolute":"fixed";c.bsBox.style.left=(b>0?b:0)+"px";c.bsBox.style.top=(d.isQk()?e:0)+(h>20?h:20)+"px";break;case 1:e=d.getElem(g,"a",a.anchor)[c.curb],b=d.getOffset(e).y,h=d.getOffset(e).x,e=e.offsetHeight,c.bsBox.style.position="absolute",c.bsBox.style.left=h+"px",c.bsBox.style.top=b+e+2+"px"}b=g.getElementById("bsClose");b.style.top=a.closeTop+"px";b.style.right=a.closeRight+"px";b=g.getElementById("bShareFrame");b.style.height=a.boxHeight+"px";
b.style.width=a.boxWidth+"px";c.bsBox.style.height=a.boxHeight+"px";c.bsBox.style.width=a.boxWidth+"px";c.bsBox.style.display="";c.click()};c.disappear=function(){c.bsBox.style.display="none";c.isOpen=!1};c.initBox=function(){c.create();g.body.onclick=function(){c.isOpen&&c.disappear()}}};d.loadEngine=function(b){var a=j[b],c=a.config,f=a.params;a.prepare=function(b){var e={};typeof b==="object"?e=b:(a.curb=b===void 0?a.curb:b,a.curb>=0&&(e=a.entries[a.curb]||{}));f.url=e.url||f.url||j.location.href;
f.title=e.title||f.title||g.title;f.summary=e.summary?d.shortenText(e.summary,110):f.summary||d.getContent();f.lang=f.request_locale=c.lang;f.pics=e.pics||f.pics||d.getPics();f.pic=e.pic||f.pic;for(var i in e)/(url|title|summary|content)/.test(i)||(f[i]=e[i])};a.share=function(b,e,c){a.prepare(c);a.load(e)&&a.afterLoad&&a.afterLoad();d.stopProp(b)};a.stats=function(b,e,c){a.prepare(c);a.shareStats(e);d.stopProp(b)};a.shareStats=function(b){var e=a.bhost+"/bshare_share_statistics?";e+="site="+b;e+=
"&url="+d.encode(f.url);e+="&title="+d.encode(f.title);e+="&publisherUuid="+f.publisherUuid;e+="&type="+f.type;d.loadScript(e)};a.view=function(h){if(!k.viewed){k.viewed=!0;var e=a.bhost+"/bshare_view?Callback="+b+".viewcb&";e+="url="+d.encode(h);e+="&h="+d.encode(j.location.hash);e+="&uuid="+f.publisherUuid;c.showShareCount&&(e+="&sc=1");e+=a.bpsCount?"&l="+a.bpsCount:"&l=17";this.isLite&&(e+="&lite=1");if(g.referrer)h=g.createElement("a"),h.href=g.referrer,e+="&ref="+d.encode(h.host);d.loadScript(e)}};
a.click=function(){if(a.preb!==a.curb){a.preb=a.curb;var b=a.bhost+"/bshare_click?";b+="url="+d.encode(a.params.url);b+="&title="+d.encode(a.params.title);b+="&uuid="+f.publisherUuid;d.loadScript(b)}};a.viewcb=function(b,e,d){k.bShareLoad=!0;b&&a.entries.length===0&&a.showCount(b);if(e)a.user=e;if(d&&d.length>0)c.bps=d;(e||d)&&typeof a.ready==="function"&&a.ready()};a.count=function(h){if(c.showShareCount){var e=a.bhost+"/bshare_share_count?Callback="+b+".showCount";e+="&url="+d.encode(h);d.loadScript(e)}};
a.shareCount=function(a,e){/0|2|10/.test(c.style)?a=d.longRound(a):/11/.test(c.style)||(a=d.shortRound(a));var i={cssFloat:"none"};if(b!=="bShareLike")switch(c.style){case 1:i.left="36px";i.color="#fff";i.fontsize="12px";break;case 10:i.left="27px";case 0:case 2:i.fontsize="11px";break;case 11:i.top="25px",i.fontsize="17px"}if(e){var f=e.style,g;for(g in i)if(g!=="color"||!f.color)f[g]=i[g];e.innerHTML=d.addCommas(a)}else return d.addCommas(a)};a.showCount=function(b){a.counters=b;var e=d.getElem(g,
"span","shareCount");if(!e||e.length===0)e=d.getElem(g,"span","BSHARE_COUNT");var c,f;if(typeof b==="number"){for(c=0,f=e.length;c<f;c++)a.shareCount(b,e[c]);d.getElem(g,"span","BSHARE_COUNT",function(c){c.innerHTML=""+a.shareCount(b,null)})}else if(b.length>0){f=b.length;for(c=0;c<f;c++)a.shareCount(b[c],e[c]);for(c=f-1;c<e.length;c++)a.shareCount(b[f-1],e[c])}};a.updateCounter=function(){typeof a.counters==="number"?a.counters+=1:a.counters[a.curb]+=1;a.showCount(a.counters)}};d.roundNumber=function(b,
a){try{return Math.round(b*Math.pow(10,a))/Math.pow(10,a)}catch(c){return b}};d.longRound=function(b){if(b>999999)return d.roundNumber(b/1E6,2)+"M";else if(b>99999)return d.roundNumber(b/1E3,1)+"K";return b};d.shortRound=function(b){if(b>999999)return d.roundNumber(b/1E6,1)+"M";else if(b>99999)return d.roundNumber(b/1E3,0)+"K";else if(b>9999)return d.roundNumber(b/1E3,1)+"K";else if(b>999)return d.roundNumber(b/1E3,2)+"K";return b};d.addCommas=function(b){try{b+="";for(var a=b.split("."),c=a[0],d=
a.length>1?"."+a[1]:"",a=/(\d+)(\d{3})/;a.test(c);)c=c.replace(a,"$1,$2");return c+d}catch(g){return b}};d.shortenText=function(b,a){b=b||"";return b.length>a?b.substring(0,a)+"...":b};d.getCurrentSelection=function(){var b="";if(j.getSelection)b=j.getSelection().toString();else if(g.getSelection)b=g.getSelection;else if(g.selection)try{b=g.selection.createRange().text}catch(a){}return b};d.grabTextContent=function(){for(var b="",a=g.getElementsByTagName("p"),c=0,f=a.length;c<f;c++){var h=a[c];if(h.id===
"BSHARE_TEXT"||h.className.indexOf("BSHARE_TEXT")!==-1)b+=d.getText(h)}b===""&&d.getElem(g,"meta",null,function(a){var c=a.getAttribute("name");c&&c.toLowerCase()==="description"&&(b=a.getAttribute("content"))});return b};d.getContent=function(){var b=null,a=d.getCurrentSelection();return a?d.shortenText(a,110):(b===null&&(b=d.grabTextContent()),d.shortenText(b,110))};d.getPics=function(){for(var b="",a=d.getElem(g,"img"),c=0,f=a.length;c<f;c++){var h=a[c];if(!(h.offsetHeight<=119||h.offsetWidth<=
119)){if(b.length+h.src.length>=1500)break;b!==""&&(b+="|");b+=h.src}}return b}})(window,document);
