﻿// JavaScript Document

function snshare(m,surl,stitle,sdesc) {
	var u = surl;
	var t = stitle;
	var c = sdesc;
	mshare(m);
	function mshare(m) {
		if (m == 1) rr(screen, document, encodeURIComponent);
		else if (m == 2) ow('http://www.kaixin001.com/repaste/share.php?rtitle=' + encodeURI(t) + '&rurl=' + encodeURI(u) + '&rcontent=' + encodeURIComponent(c), '分享', 600, 450);
		else if (m == 3) toT(screen, document, encodeURIComponent, c, u, '', t, u, null);
		else if (m == 4) ow('http://apps.hi.baidu.com/share/?url=' + encodeURI(u) + '&title=' + encodeURI(t) + '&content=' + encodeURI(c), '分享', 800, 550);
	}
	function ow(u, t, w, h) {
		var s = 'toolbar=no,scrollbars=no,width=' + w + ',height=' + h + ',left=' + (window.screen.width - w) / 2 + ',top=' + (window.screen.height - h) / 2 + ',status=no,resizable=yes';
		window.open(u, t, s);
	}
	function toT(s, d, e, r, l, pic, t, z, c) {
		var f = 'http://v.t.sina.com.cn/share/share.php?', u = z || d, p = ['url=', e(u), '&title=', e(t +  r), '&source=', e(r), '&sourceUrl=', e(l), '&content=', c || 'gb2312', '&pic=', e(pic)].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();
	}
	function rr(s, d, e) {
		if (/renren\.com/.test(d.location)) return;
		var f = 'http://share.renren.com/share/buttonshare?link=', u = surl, l = stitle, p = [e(u), '&title=', e(l)].join('');
		function a() {
		if (!window.open([f, p].join(''), 'xnshare', ['toolbar=0,status=0,resizable=1,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();
	}
}



function ishare(url,m,iurl) {
//	    var url = document.location.toString();
//    var us = url.substring(0, url.lastIndexOf('/'));
//    var p = par.replace('&', '[rr]');
//    var urr = us + "/mm_video_live.aspx?" + p;
//	var u = us + "/mm_video_live.aspx?" + par;
    var u = url;
	var t = '「雪碧」 家中派对好友趣 透心凉 家中享！'; 
	var c = '创建炫目派对，呼朋唤友拼人气，有机会赢3D蓝光播放器、LED电视机等大奖，还不快来参加？';
	var i = iurl;
	
	if (m == 1) rr2(screen, document, encodeURIComponent, url, i);
	else if (m == 2) ow2('http://www.kaixin001.com/repaste/share.php?rtitle=' + encodeURIComponent(t) + '&rurl=' + encodeURI(u) + '&rcontent=' + encodeURIComponent(c), '分享', 600, 450);
	else if (m == 3) toT2(screen, document, encodeURIComponent, c, u, i, t, u, null);
	//else if (m == 4) ow('http://apps.hi.baidu.com/share/?url=' + encodeURI(u) + '&title=' + encodeURI(t) + '&content=' + encodeURI(c), '分享', 800, 550);
	else if (m == 5) ow2('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=' + encodeURIComponent(url) + '&title=' + encodeURIComponent(t) + '&pics=' + encodeURIComponent(i) + '&desc=' + encodeURIComponent(c) + '&summary=' + encodeURIComponent(c), '分享', 800, 550);
    //else if (m == 6) qqWb2(t, c, u, i);
    
}

function ow2(u, t, w, h ) {
	var s = 'toolbar=no,scrollbars=no,width=' + w + ',height=' + h + ',left=' + (window.screen.width - w) / 2 + ',top=' + (window.screen.height - h) / 2 + ',status=no,resizable=yes';
	window.open(u, t, s);
}

function toT2(s, d, e, r, l, pic, t, z, c) {
		var f = 'http://v.t.sina.com.cn/share/share.php?', u = z || d, p = ['url=', e(u), '&title=', e(t + ' ' + r), '&source=', e(r), '&sourceUrl=', e(l), '&content=', c || 'gb2312', '&pic=', e(pic)].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();
	}
function rr2(s, d, e, u, i) {
	if (/renren\.com/.test(d.location)) return;
	ur = u + '/forRR.aspx';
	var f = 'http://share.renren.com/share/buttonshare?link=', u = ur, l ='' , p = [e(u), '&title=', e(l)].join('');
	function a() {
    if (!window.open([f, p].join(''), 'xnshare', ['toolbar=0,status=0,resizable=1,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();
}

