﻿document.writeln("<a href=\"javascript:void(0)\" id=\"dashuyeitb\" style=\"background:url(http:\/\/www.dashuye.com\/images/bditb-icon1.gif) no-repeat;width:105px;padding:0px 0 0 20px;height:20px;text-align:right; line-height:normal;\"><span style=\"font-size:12px;\">分享到<span style=\"font-size:14px;font-weight:bold;\">i<\/span>贴吧<\/span><\/a>"); 
document.writeln("<SCRIPT type=text/javascript>function SendToSinaWeiBo(){ (function(s,d,e,r,l,p,t,z,c){ var f=\'http://v.t.sina.com.cn/share/share.php?\', u=z||d.location, p=[\'url=\',e(u),\'&amp;title=\',e(d.title),\'&amp;source=\',e(r),\'&amp;sourceUrl=\',e(l),\'&amp;content=\',c||\'gb2312\',\'&amp;pic=\',e(p||\'\')].join(\'\'); function a(){ if(!window.open([f,p].join(\'\'),\'mb\',[\'toolbar=0,status=0,resizable=1,width=440,height=430,left=\',(s.width-440)/2,\',top=\',(s.height-430)/2].join(\'\')))u.href=[f,p].join(\'\'); }; if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a(); })(screen,document,encodeURIComponent,\'WP-WeiBo\',\'http://www.dashuye.com/\',null,null,null,null); } </SCRIPT><A onclick=javascript:SendToSinaWeiBo() href=\"javascript:;\"><img src=\"/images/sinawb.gif\" border=\"0\" alt=\"将此文分享到新浪微博\">分享到新浪微博</A> ");
document.writeln("<a href=\"javascript:window.open(\'http:\/\/cang.baidu.com\/do\/add?it=\'+encodeURIComponent(document.title.substring(0,76))+\'&iu=\'+encodeURIComponent(location.href)+\'&fr=ien#nw=1\',\'_blank\',\'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes\'); void 0\" style=\"color:#000000;text-decoration:none;font-size:12px;font-weight:normal\"><span style=\"border: 1px solid rgb(210, 210, 210); padding: 2px 5px 4px ! important; font-size: 12px; cursor: pointer; color: rgb(53, 94, 213); margin-left: 10px;\"><img src=\"http:\/\/cang.baidu.com\/-\/remote\/fav4.jpg\" alt=\"搜藏\" style=\"vertical-align: middle ! important;\" border=\"0\">搜藏<\/span><\/a>");
document.writeln("<a href=\"javascript:window.open(\'http:\/\/shuqian.qq.com\/post?from=3&title=\'+encodeURIComponent(document.title)+\'&uri=\'+encodeURIComponent(document.location.href)+\'&jumpback=2&noui=1\',\'favit\',\'width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes\');void(0)\" style=\"text-decoration:none;color:#155da5;display:block;background:url(\'http:\/\/shuqian.qq.com\/img\/add.gif\') no-repeat 0px 0px;height:18px;width:100px;padding:2px 2px 0px 20px;font-size:12px;\">收藏到QQ书签<\/a>");
var sendT = {
	getHeader : function(){
		var dede_title=document.getElementsByTagName("h2")[0].innerHTML;
		dede_title = dede_title;
		return dede_title;
	},
	getFirstImgSrc : function(){
		var allPageTags=document.getElementsByTagName("div");
		for (var i=0; i<allPageTags.length;i++) {
			if (allPageTags[i].className='picbox') {
				if (allPageTags[i].getElementsById("bigimg")[0] && allPageTags[i].getElementsById("bigimg")[0].width > 100)
				{
					return allPageTags[i].getElementsById("bigimg")[0].src;
				}
				else
				{
					return null;
				}
				
			}
		}
	},
	getContent : function(){
		var allPageTagss=document.getElementsByTagName("div");	
		for (var i=0; i<allPageTagss.length;i++) {
			if (allPageTagss[i].className=='intro') {
				return allPageTagss[i].innerHTML;
			}else if(allPageTagss[i].className=='content'){
				
				return allPageTagss[i].getElementsByTagName("P")[0].innerHTML;
			}		
			
		}
	}
}
document.getElementById("dashuyeitb").onclick=function(){
	//alert(sendT.getContent());
	//alert(window.location.href);

		var itieba_share = 'http://tieba.baidu.com/i/sys/share?link=' + encodeURIComponent(window.location.href)
		+'&type=' + encodeURIComponent('text')
		+'&title=' + encodeURIComponent(sendT.getHeader())
		+'&content=' + encodeURIComponent(sendT.getContent());
		if (!window.open(itieba_share, 'itieba', 'toolbar=0,resizable=1,scrollbars=yes,status=1,width=626,height=436')) 
		{
			location.href = itieba_share;
		}		
  
}
