﻿<script type="text/javascript" src="http://bbs.itiexue.net/js/ShareStatistics.js"></script>

<div id="sharediv" class="share">
</div>



/*==================分享 begin=======================*/
//分享到校内

shareToXiaoNei=function(){
	_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'RenRen', 1]);
	(function(s,d,e){
		u =d.location.href;
		if(u.indexOf('?')>0){
			u +="&utm_medium=Share&utm_campaign=Share&utm_source=RenRen";
		}
		else{
			u +="?utm_medium=Share&utm_campaign=Share&utm_source=RenRen";
		}
		var f = 'http://share.renren.com/share/buttonshare.do?link=', u =u, l = d.title, p = [ e(u), '&title=', e(l) ].join('');
		function a() {
		if (!window.open([ f, p ].join(''),'xnshare',['toolbar=0,status=0,resizable=no,width=626,height=436,left=',(s.width - 626) / 2, ',top=',(s.height - 436) / 2 ].join('')))
			u.href = [ f, p ].join('');
		};
		if (/Firefox/.test(navigator.userAgent))
		setTimeout(a, 0);
		else
		a();
	})(screen,document,encodeURIComponent)
};

//分享到sohu
shareToSohu=function(){
	(function(s, d, e) {
	var f = 'http://t.sohu.com/third/post.jsp?link=', u = d.location.href;
	if(u.indexOf('?')>0){
		u +="&utm_medium=Share&utm_campaign=Share&utm_source=Sohu";
	}
	else{
		u +="?utm_medium=Share&utm_campaign=Share&utm_source=Sohu";
	}
	function a() {if (!window.open([ f, e(u) ].join(''),'tsohu',['toolbar=0,status=0,resizable=no,width=660,height=470,left=',(s.width - 660) / 2, ',top=',(s.height - 470) / 2 ].join('')))
					u.href = [ f, e(u) ].join('');
			};
			if (/Firefox/.test(navigator.userAgent))
				setTimeout(a, 0);
			else
				a();
	})(screen, document, encodeURIComponent);
};

//分享到163博客
shareTo163=function(){
	u =d.location.href;
	if(u.indexOf('?')>0){
		u +="&utm_medium=Share&utm_campaign=Share&utm_source=163";
	}
	else{
		u +="?utm_medium=Share&utm_campaign=Share&utm_source=163";
	}
	var url='link=http://blog.163.com/&source='+encodeURIComponent('网易博客')+'&info='+encodeURIComponent(document.title)+' '+encodeURIComponent(u);
	window.open('http://t.163.com/article/user/checkLogin.do?'+url+'&'+new Date().getTime(),'_blank','width=510,height=300,resizable=no');
};

//分享到sina微博
shareToSinaWb=function(){
	_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'Sina', 1]);
	(function(s, d, e) {
			try {
			} catch (e) {
			}
			u =d.location.href;
			if(u.indexOf('?')>0){
				u +="&utm_medium=Share&utm_campaign=Share&utm_source=SinaWb";
			}
			else{
				u +="?utm_medium=Share&utm_campaign=Share&utm_source=SinaWb";
			}
			var f = 'http://v.t.sina.com.cn/share/share.php?', u = u, p = ['url=', e(u), '&title=', e(d.title), '&appkey=691463583' ].join('');
			function a() {
				if (!window.open([ f, p ].join(''),'mb',['toolbar=0,status=0,resizable=no,width=620,height=450,left=',(s.width - 620) / 2, ',top=',(s.height - 450) / 2 ].join('')))
					u.href = [ f, p ].join('');
			};
			if (/Firefox/.test(navigator.userAgent)) {
				setTimeout(a, 0)
			} else {
				a()
			}
	})(screen, document, encodeURIComponent);
};

//分享到开心
shareToKaiXin001=function(){
	_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'Kaixin001', 1]);
	var kw = window.open('','kaixin001','toolbar=no,titlebar=no,status=no,menubar=no,scrollbars=no,location=no,,resizable=no,directories:no,width=570,height=350,left='+ (screen.width - 570)/ 2+ ',top='+ (screen.height - 420) / 2);

		function openPostWindow(url, data, name) {
			var tempForm = document.createElement('form');
			tempForm.id = 'tempForm1';
			tempForm.method = 'post';
			tempForm.action = url;
			tempForm.target = 'kaixin001';
			var hideInput = document.createElement('input');
			hideInput.type = 'hidden';
			hideInput.name = 'rcontent';
			hideInput.value = data;
			tempForm.appendChild(hideInput);
			document.body.appendChild(tempForm);
			tempForm.submit();
			document.body.removeChild(tempForm);
		}
		function add2Kaixin001() {
			var u = document.location.href;
			if(u.indexOf('?')>0){
				u +="&utm_medium=Share&utm_campaign=Share&utm_source=Kaixin001";
			}
			else{
				u +="?utm_medium=Share&utm_campaign=Share&utm_source=Kaixin001";
			}
			var t = document.title;
			var c = '' + (document.getSelection ? document.getSelection()
					: document.selection.createRange().text);
			var iframec = '';
			var url = 'http://www.kaixin001.com/repaste/bshare.php?rtitle='
					+ encodeURIComponent(t) + '&rurl=' + encodeURIComponent(u)
					+ '&from=maxthon';
			var data = encodeURIComponent(c);
			openPostWindow(url, c, '_blank')
		}
		add2Kaixin001();
};

//分享到豆瓣
shareToDouBan=function(){
		_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'Douban', 1]);
		void (function(d,e) {
			u = d.location.href;
			if(u.indexOf('?')>0){
				u +="&utm_medium=Share&utm_campaign=Share&utm_source=DouBan";
			}
			else{
				u +="?utm_medium=Share&utm_campaign=Share&utm_source=DouBan";
			}
			var s1 = window.getSelection, s2 = d.getSelection, s3 = d.selection, s = s1 ? s1(): s2 ? s2() : s3 ? s3.createRange().text : '', r = 'http://www.douban.com/recommend/?url='+ e(u)+ '&title='+ e(d.title)+ '&sel='+ e(s) + '&v=1', 
			x = function() {
				if (!window.open(r, 'douban','toolbar=0,resizable=no,scrollbars=no,status=1,width=450,height=355,left='+ (screen.width - 450) / 2 + ',top='+ (screen.height - 330) / 2))
					location.href = r + '&r=1'
			};
			if (/Firefox/.test(navigator.userAgent)) {
				setTimeout(x, 0)
			} else {
				x()
			}
		})(document,encodeURIComponent)
};

//分享到MSN
shareToMSN=function(){
	var shareUrl='http://profile.live.com/badge?';
	shareUrl+='url='+encodeURIComponent(location.href);
	shareUrl+='&title='+encodeURIComponent(document.title);
	var Rj=this.aB.blogAbstract;var as=document.cloneElement('div');
	as.innerHTML=Rj||'';
	Rj=encodeURIComponent(U.dw(as.innerText,100));
	shareUrl+='&description='+Rj;
	window.open(shareUrl);
};

//分享到qq空间
shareToQQZone=function(){
	_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'QQZone', 1]);
	u = document.location.href;
	if(u.indexOf('?')>0){
		u +="&utm_medium=Share&utm_campaign=Share&utm_source=qzone";
	}
	else{
		u +="?utm_medium=Share&utm_campaign=Share&utm_source=qzone";
	}
	var shareUrl='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(u);
	window.open(shareUrl, 'qzone','toolbar=0,status=0,width=900,height=760,left='+ (screen.width - 900) / 2 + ',top='+ (screen.height - 760) / 2);
};

//分享到腾讯微博
shareToTxWb =function(){
	_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'TentenWb', 1]);
	var _source= 0;
	u = document.location.href;
	if(u.indexOf('?')>0){
		u +="&utm_medium=Share&utm_campaign=Share&utm_source=TentenWb";
	}
	else{
		u +="?utm_medium=Share&utm_campaign=Share&utm_source=TentenWb";
	}
	var _site=encodeURI('http://bbs.tiexue.net');
	var _pic='';
	var shareUrl='http://v.t.qq.com/share/share.php?title='+encodeURIComponent(document.title)+'&url='+encodeURIComponent(u)+'&source='+_source+'&site='+_site+'&pic='+_pic+"&appkey="+encodeURI("2d569bb36b0f453595e8c0ea391b7c85");
	window.open(shareUrl,'转播到腾讯微博','width=700,height=580,toolbar=no,menubar=no,scrollbars=no,location=yes,resizable=no,status=no');

}

//分享到163微博
shareTo163Wb=function() {
	u = document.location.href;
	if(u.indexOf('?')>0){
		u +="&utm_medium=Share&utm_campaign=Share&utm_source=163wb";
	}
	else{
		u +="?utm_medium=Share&utm_campaign=Share&utm_source=163wb";
	}
	var url = 'link='+window.location+'&source='+ encodeURIComponent(document.title) + '&info='+ encodeURIComponent(document.title) + ' '+ encodeURIComponent(u);
	window.open('http://t.163.com/article/user/checkLogin.do?'+ url + '&' + new Date().getTime(),'t163','height=330,width=550,top='+ (screen.height - 280)/2+ ',left='+(screen.width - 550)/ 2+ ', toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no');
}

//分享到百度空间
shareToBaiduHi=function(){
	_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'BaiduHi', 1]);
	u = document.location.href;
	if(u.indexOf('?')>0){
		u +="&utm_medium=Share&utm_campaign=Share&utm_source=BaiduHi";
	}
	else{
		u +="?utm_medium=Share&utm_campaign=Share&utm_source=BaiduHi";
	}
	window.open('http://apps.hi.baidu.com/share/?url=' + encodeURIComponent(u)+ '&title='+ encodeURIComponent(document.title),'baiduhi','scrollbars=no,width=820,height=550,status=no,resizable=no,left='+ (screen.width - 820) / 2 + ',top='+ (screen.height - 550) / 2);
}

//到baidu搜藏
shareToBaiduSo=function(){
	_gaq.push(['_trackEvent', 'SocialShare', 'Share', 'BaiduSo', 1]);
	u = document.location.href;
	if(u.indexOf('?')>0){
		u +="&utm_medium=Share&utm_campaign=Share&utm_source=BaiduSo";
	}
	else{
		u +="?utm_medium=Share&utm_campaign=Share&utm_source=BaiduSo";
	}
	window.open('http://cang.baidu.com/do/add?it='+ encodeURIComponent(document.title.substring(0, 76))+ '&iu=' + encodeURIComponent(u)+ '&fr=ien#nw=1', 'baidu','scrollbars=no,width=600,height=450,status=no,resizable=no,left='+ (screen.width - 600) / 2 + ',top='+ (screen.height - 450) / 2);
}

ShareToSinaNew = function(){
	var _w = 80 , _h = 16;
	var myUrl = location.href;
	if(myUrl.indexOf('?')>0){
		myUrl +=encodeURIComponent("&utm_medium=Share&utm_campaign=Share&utm_source=SinaWb");
	}
	else{
		myUrl +=encodeURIComponent("?utm_medium=Share&utm_campaign=Share&utm_source=SinaWb");
	}
	var param = {
		url:location.href,
		type:'6',
		count:'', /**是否显示分享数，1显示(可选)*/
		appkey:'691463583', /**您申请的应用appkey,显示分享来源(可选)*/
		title:'', /**分享的文字内容(可选，默认为所在页面的title)*/
		pic:'', /**分享图片的路径(可选)*/
		ralateUid:'1686474312', /**关联用户的UID，分享微博会@该用户(可选)*/
		rnd:new Date().valueOf()
	  }
	var temp = [];
	for( var p in param ){
		temp.push(p + '=' + encodeURIComponent( param[p] || '' ) )
	}
	  return  '<iframe allowTransparency="true" frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?' + temp.join('&') + '" width="'+ _w+'" height="'+_h+'">新浪微博</iframe>';
}

//分享
InitShareBar = function(shareID){
	var shareHTML="";
	shareHTML='<span class="shaplus"></span><span style="margin-top:2px"><strong>分享到:</strong></span>';
	shareHTML += "<span class=\"contsp\" >"+ShareToSinaNew()+"</span>";
	shareHTML +='<span class="shaqqwb"></span><a title="分享到腾讯微博" href="javascript:void(0)" onclick="shareToTxWb()" rel="nofollow">腾讯微博</a>';
	shareHTML +='<span class="shaqq"></span><a title="分享到QQ空间" href="javascript:void(0)" onclick="shareToQQZone()">QQ空间</a>';
	//shareHTML +='<span class="shasina"></span><a title="分享到新浪微博" href="javascript:void(0)" onclick="shareToSinaWb()" rel="nofollow">新浪微博</a>';
	shareHTML +='<span class="sharen"></span><a title="分享到人人网" href="javascript:void(0)" onclick="shareToXiaoNei()" rel="nofollow">人人网</a>';
	shareHTML +='<span class="shakai"></span><a title="分享到开心网" href="javascript:void(0)" onclick="shareToKaiXin001()" rel="nofollow">开心网</a>';
	shareHTML +='<span class="shadou"></span><a title="分享到豆瓣" href="javascript:void(0)" onclick="shareToDouBan()" rel="nofollow">豆瓣</a>';
	shareHTML +='<span class="shasou"></span><a title="分享到百度搜藏" href="javascript:void(0)" onclick="shareToBaiduSo()" rel="nofollow">百度搜藏</a>';
	shareHTML +='<span class="shabai"></span><a title="分享到百度空间" href="javascript:void(0)" onclick="shareToBaiduHi()" rel="nofollow">百度空间</a>';
	var obj = $("#"+shareID);
	if(obj!=null){
		$("#"+shareID).html(shareHTML);
	}
	shareHTML='';
}

initPostShareBar = function(shareID){
	var shareHTML="";
	shareHTML='<span class="shaplus contsp"></span><span style="margin-top:2px" class="contsp"><strong>分享到:</strong></span>';
	shareHTML += "<span class=\"contsp\" style=\"margin-top:4px\">"+ShareToSinaNew()+"</span>";
	shareHTML +='<span class="shaqqwb contsp"></span><a class="contsp" title="分享到腾讯微博" href="javascript:void(0)" onclick="shareToTxWb()" rel="nofollow">腾讯微博</a>';
	shareHTML +='<span class="shaqq contsp"></span><a class="contsp" title="分享到QQ空间" href="javascript:void(0)" onclick="shareToQQZone()">QQ空间</a>';
	//shareHTML +='<span class="shasina contsp"></span><a class="contsp" title="分享到新浪微博" href="javascript:void(0)" onclick="shareToSinaWb()" rel="nofollow">新浪微博</a>';
	shareHTML +='<span class="sharen contsp"></span><a class="contsp" title="分享到人人网" href="javascript:void(0)" onclick="shareToXiaoNei()" rel="nofollow">人人网</a>';
	shareHTML +='<span class="shakai contsp"></span><a class="contsp" title="分享到开心网" href="javascript:void(0)" onclick="shareToKaiXin001()" rel="nofollow">开心网</a>';
	shareHTML +='<span class="shadou contsp"></span><a class="contsp" title="分享到豆瓣" href="javascript:void(0)" onclick="shareToDouBan()" rel="nofollow">豆瓣</a>';
	shareHTML +='<span class="shasou contsp"></span><a   class="contsp" title="分享到百度搜藏" href="javascript:void(0)" onclick="shareToBaiduSo()" rel="nofollow">百度搜藏</a>';
	shareHTML +='<span class="shabai contsp"></span><a class="contsp" title="分享到百度空间" href="javascript:void(0)" onclick="shareToBaiduHi()" rel="nofollow">百度空间</a>';

	var obj = $("#"+shareID);
	if(obj!=null){
		$("#"+shareID).html(shareHTML);
	}
	shareHTML='';
}

/*==================分享 end=======================*/
