function addtofacebook() {u=location.href;t=document.title;window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(u)+"&t="+encodeURIComponent(t));}

function addtoplurk(){
var u = location.href;var titles=document.getElementsByTagName('title');var title=titles[0].innerHTML;var metas=document.getElementsByTagName('meta');for(var i=0;i<metas.length;i++){if(metas[i].getAttribute('name')=='title'){title=metas[i].getAttribute('content');break;}}
var url='http://www.plurk.com/?qualifier=shares&status=';url+=encodeURIComponent(u)+' '+encodeURIComponent('('+title+') ');window.open(url);}

function addtotwitter() {u=location.href;t=document.title;window.open("http://twitter.com/?status="+encodeURIComponent(u)+" ("+encodeURIComponent(t)+") ");}

function addtofavorite() {
var title = document.title;
var url   = location.href;

if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}


function addtoweibo(){
	var getHeader = function(){
			var titles=document.getElementsByTagName('title');var g_title=titles[0].innerHTML;
			var re = /<[^<>]*?font[^<>]*?>/gi;
			g_title = g_title.replace(re,"");
			return g_title;
		},
		getFirstImgSrc = function(){
			try {
				return document.getElementById("rs").src;
			} catch (e) {
				return null;
			}
		};
		
	(function(s,d,e,r,l,p,t,z,c){
		 var f='http://service.weibo.com/share/share.php?ralateUid=1888725725appkey=2581446257&language=zh_tw&',u=z||d.location,p=['url=',e(u),'&title=',e(getHeader()),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'utf-8','&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,'新浪新聞','http://news.sina.com.tw/',getFirstImgSrc(),null,null,null);
}

function addtoweibo2( uid ,tPic , width ,height ){
    (function(){
      var _w = width ? width : 55 , _h = height ? height : 66;
      var param = {
        url:location.href,
        type:'1',
        count:'1', /**是否显示分享数，1显示(可选)*/
        appkey:'', /**您申请的应用appkey,显示分享来源(可选)*/
        title:'', /**分享的文字内容(可选，默认为所在页面的title)*/
        pic:tPic, /**分享图片的路径(可选)*/
		language:'zh_tw', /**设置语言，zh_cn|zh_tw(可选)*/
        ralateUid:uid, /**关联用户的UID，分享微博会@该用户(可选)*/
        rnd:new Date().valueOf()
      }
      var temp = [];
      for( var p in param ){
        temp.push(p + '=' + encodeURIComponent( param[p] || '' ) )
      }
      document.write('<iframe allowTransparency="true" frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?' + temp.join('&') + '" width="'+ _w+'" height="'+_h+'"></iframe>')
    })()
}
