var bds=bds||{};bds.util=bds.util||{};bds.se=bds.se||{};bds.se.weibo=(function(){function h(a,b){if(b=="small"){var d=120,c=120;if(a.width>d){a.height=Math.floor(a.height*(d/a.width));a.width=d}if(a.height>c){a.width=Math.floor(a.width*(d/a.height));a.height=c}}else{if(b=="big"){var d=440;if(a.width>d){a.height=Math.floor(a.height*(d/a.width));a.width=d}}}a.parentNode.style.width=a.width+"px";a.parentNode.style.height=a.height+"px"}function g(a){a.src="http://s1.bdstatic.com/r/www/cache/mid/static/weibo/img/noimage_a89bbb10.jpg"}function f(a,b){while(a.parentNode&&a.tagName!="BODY"){a=a.parentNode;if(a.className=="weibo_img_holder"){var c=a.children[0];var d=a.children[1]}}if(c&&d){scroll(j(d).left,j(d).top-100);d.style.display="none";c.style.display="block"}}function i(c){var b=c;while(c.parentNode&&c.tagName!="BODY"){c=c.parentNode;if(c.className=="weibo_img_holder"){var d=c;var e=c.children[0];break}}if(d&&e){if(d.children.length<=1){var a=document.createElement("div");a.className="weibo_img_view";
a.innerHTML='<div class="weibo_r1"></div><div class="weibo_r2"></div><div class="weibo_from"><div class="weibo_img_tools"><a href="javascript:void(0)" class="weibo_icon_close" onmousedown="ns_c({\'fm\':\'alwb\',\'tab\':\'close\'});" onclick="bds.se.weibo.imgSmall(this, 1)">收起</a><a href="'+b.getAttribute("data-bgimg")+'" class="weibo_icon_view" onmousedown="ns_c({\'fm\':\'alwb\',\'tab\':\'orgimg\'});" target="_blank">查看原图</a></div><div class="weibo_img_big"><img onclick="bds.se.weibo.imgSmall(this, 2)" onload="bds.se.weibo.imgLoad(this, \'big\')" onerror="bds.se.weibo.imgError(this)" src="'+b.getAttribute("data-mdimg")+"\" onmousedown=\"ns_c({'fm':'alwb','tab':'bigimg'});\"></div></div><div class=\"weibo_r3\"></div><div class=\"weibo_r4\"></div>";d.appendChild(a)}else{d.children[1].style.display="block"}e.style.display="none"}}function j(a){var c=a.offsetTop,d=a.offsetLeft,b={};while(a=a.offsetParent){c+=a.offsetTop;d+=a.offsetLeft}b.top=c;b.left=d;return b}return{imgLoad:h,imgError:g,imgSmall:f,imgBig:i}
})();bds.util.getClientHeight=function(){return window.document.documentElement.clientHeight};bds.util.setTopBtnPos=function(){var b=bds.util.getClientHeight();if(b<400){baidu("#toTop").css("display","none")}else{if(b<600){baidu("#toTop").removeClass("totop-max").addClass("totop-min")}else{baidu("#toTop").removeClass("totop-min").addClass("totop-max")}}};baidu(window).on("load",function(){baidu(".weibo_img_small img").each(function(d,c){bds.se.weibo.imgLoad(this,"small");baidu(c).on("click",function(a){bds.se.weibo.imgBig(this)});baidu(c).on("mousedown",function(a){ns_c({fm:"alwb",tab:"smallimg"})})});bds.util.setTopBtnPos()});baidu(window).on("resize",function(b){bds.util.setTopBtnPos()});baidu(window).on("scroll",function(c){var d=baidu(window).scrollTop();if(d>0&&bds.util.getClientHeight()>=400){baidu("#toTop").css("display","block")}else{baidu("#toTop").css("display","none")}});baidu(document).on("click",function(b){if(b.target.id=="toTop"){scroll(0,0)}});