/**
 * 
 */
var _rel = ""
var _title = "";
var _url = "";
var _cont = "";
function getQueryString(arg ){
    // 分离参数对 ?key=value&key2=value2
    var parameters = arg.split("&");
    var pos, paraName, paraValue;
    for(var i=0; i<parameters.length; i++){
        // 获取等号位置
        pos = parameters[i].indexOf('=');
        if(pos == -1){continue; }
        // 获取name 和 value
        paraName = parameters[i].substring(0, pos);
        paraValue = parameters[i].substring(pos + 1);
        // 如果查询的name等于当前name，就返回当前值，同时，将链接中的+号还原成空格
        switch(paraName) {
            case 'rel':
                _rel = decodeURIComponent(paraValue);
                break;
            case 'title':
                _title = paraValue;
                break;
            case 'url':
                _url = decodeURIComponent(paraValue);
                break;
            case 'content':
                _cont = decodeURIComponent(paraValue);
            case 'pic':
                _pic = decodeURIComponent(paraValue);
        }
    }
    
    if(_rel != 'sina') {
    	_title = decodeURIComponent(_title);
    }
    if(_rel == 'kaixin'){
		kxShare();
	} else if(_rel == 'QQ') {
        qqShare();
    } else if(_rel == 'douban'){
		dbShare();
	}else if(_rel == 'renren'){
		renrenShare();
	} else if(_rel == 'sina'){
		sinaShare();
	} else if(_rel == 'tieba'){
		tiebaShare();
	} else if(_rel == '51'){
		wuyiShare();
	} else if(_rel == '163'){
		mangyiShare();
	}else if(_rel == 'badiduzone'){
		baiduzongShare();
	}else if(_rel == 'qqbook'){
		qqbookShare();
	}
}

function qqbookShare(){
	_url = encodeURIComponent(_url);
    window.location.href='http://shuqian.qq.com/post?from=3&title='+_title+'&uri='+_url+'&jumpback=2&noui=1';void(0);
}
function baiduzongShare(){
	_url = encodeURIComponent(_url);
    window.location.href='http://apps.hi.baidu.com/share/?url='+_url+'&title='+_title;void(0);
}	
function mangyiShare(){
	_url = encodeURIComponent(_url);
    window.location.href='http://t.163.com/article/user/checkLogin.do?source=IT知识库&info='+_title+'+-+'+'IT知识库'+'+'+_url;void(0);
}
function wuyiShare(){
	_url = encodeURIComponent(_url);
    window.location.href='http://share.51.com/share/share.php?type=8&vaddr='+_url+'&title='+_title;void(0);
}
function tiebaShare(){
	_url = encodeURIComponent(_url);
    window.location.href='http://www.jiathis.com/send/send.php/?webid=tieba&url='+_url+'&title='+_title+'&uid=0&jtss=0&appkey=';void(0);
}
function qqShare(){
	_url = encodeURIComponent(_url);
    window.location.href='http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+_url;void(0);
}

function sinaShare(){
	_url = encodeURIComponent(_url);
    window.location.href='http://v.t.sina.com.cn/share/share.php?appkey=372219794&url='+_url+'&title='+encodeURIComponent(' IT知识库技术分享：')+_title+'&source=&sourceUrl=&content=utf-8&pic='+_pic;void(0);
}

function kxShare(){
	var c = "http://www.kaixin001.com/~repaste/repaste.php?rtitle=" + encodeURIComponent(_title) + "&rurl=" + encodeURIComponent(_url) + "&rcontent=" + encodeURIComponent(_cont);
	window.location.href = c
    return false
}

function dbShare(){
	 var d = "http://www.douban.com/recommend/?url=" + encodeURIComponent(_url) + "&title=" + encodeURIComponent(_title);
     location.href = d
    return false
}

function renrenShare(){
	var d = "http://share.renren.com/share/buttonshare.do?link=" + encodeURIComponent(_url) + "&title=" + encodeURIComponent(_title);
	location.href = d;
	return false
}
