function addLoadEvent(func){
       var oldonload = window.onload;
       if(typeof window.onload != 'function'){
              window.onload = func;
              }else{
                     window.onload = function(){
                            oldonload();
                            func();
                            }
                     }
       }

function wanmeiShare(){
	var url = encodeURIComponent(top.location.href);
	var title = encodeURIComponent(top.document.title);
	
	var baidu = document.getElementById("share_baidu");
	var bsh = document.getElementById("share_bsh");
	var qqbm = document.getElementById("share_qqbm");
	var qqzone = document.getElementById("share_qqzone");
	var qqt = document.getElementById("share_qqt");
	var sina = document.getElementById("share_sina");
	var douban = document.getElementById("share_douban");
	var renren = document.getElementById("share_renren");
	var kaixin = document.getElementById("share_kaixin");
	var sohut = document.getElementById("share_sohut");
	
	if(baidu) baidu.href = "http://tieba.baidu.com/i/app/open_share_api?link=" + url;	//百度搜藏
	if(bsh) bsh.href = "http://bai.sohu.com/share/blank/addbutton.do?from=fengyin&link=" + url + "&title=" + title;	//搜狐白社会
	if(qqbm) qqbm.href = "http://shuqian.qq.com/post?from=3&title=" + title + "&uri=" + url;	//QQ书签
	if(qqzone) qqzone.href = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=" + url;	//QQ空间
	if(qqt) qqt.href = "http://v.t.qq.com/share/share.php?url=" + url + "&title=" + title;	//QQ微博
	if(sina) sina.href = "http://v.t.sina.com.cn/share/share.php?url=" + url + "&title=" + title;	//新浪微博
	if(douban) douban.href = "http://www.douban.com/recommend/?url=" + url + "&title=" + title;	//豆瓣
	if(renren) renren.href = "http://share.renren.com/share/buttonshare.do?link=" + url + "&title=" + title;	//人人网
	if(kaixin) kaixin.href = "http://www.kaixin001.com/repaste/share.php?rtitle=" + url + "&rcontent=" + title;	//开心001
	if(sohut) sohut.href = "http://t.sohu.com/third/post.jsp?&url=" + url + "&title=" + title + '&content=utf-8&pic=';	//搜狐微博
	
}


addLoadEvent(wanmeiShare)


function addfav(){
   var favUrl = window.location.href;
   var favName = document.title;
   try{window.external.AddFavorite(favUrl,favName);}
   catch(e){
   try{window.sidebar.addPanel(favName,favUrl,"");}
   catch(e){alert("使用快捷键 Ctrl+D 或 Cmd+D 来收藏此页！");}
 }
} 
