var shareToSNS = {
    "openWindow": function(url, name, properties) {
        properties = (properties || "");
        if (!window.open(url, name, properties)) {
            window.self.location.href = url;
        }
        return false;
    }
};
shareToSNS.kaixin001 = function(title, href, content) {
    title = (title || "");
    href = (href || window.self.location.href);
    content = (content || "");
    var url = "http://www.kaixin001.com/repaste/share.php?rtitle=" + encodeURIComponent(title) + "&rurl=" + encodeURIComponent(href) + "&rcontent=" + encodeURIComponent(content);
    return shareToSNS.openWindow(url, "KaiXin001");
};
shareToSNS.xiaonei = function(title, href, content) {
    title = (title || "");
    href = (href || window.self.location.href);
    content = (content || "");
    var url = "http://share.renren.com/share/buttonshare/post/1001?url=" + encodeURIComponent(href) + "&title=" + encodeURIComponent(title)+"&content=" + encodeURIComponent(content);
    return shareToSNS.openWindow(url, "XiaoNei", "toolbar=0, resizable=1, scrollbars=yes, status=1, width=626, height=436");
};
shareToSNS.douban = function(title, href, content) {
    title = (title || "");
    href = (href || window.self.location.href);
    content = (content || "");
    var url = "http://www.douban.com/recommend/?url=" + encodeURIComponent(href) + "&title=" + encodeURIComponent(title);
    return shareToSNS.openWindow(url, "DouBan", "toolbar=0, resizable=1, scrollbars=yes, status=1, width=450, height=330");
};
shareToSNS.qzone = function(title, href, content) {
    title = (title || "");
    href = (href || window.self.location.href);
    content = (content || "");
    var url = "http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url=" + encodeURIComponent(href);
    return shareToSNS.openWindow(url, "QZone");
};
shareToSNS.sohu = function(title, href, content) {
    title = (title || "");
    href = (href || window.self.location.href);
    content = (content || "");
    var url = "http://bai.sohu.com/share/blank/addbutton.do?from=tudou&link=" + href + "&title=" + title;
    return shareToSNS.openWindow(url, "BaiSohu");
};
shareToSNS.sina = function(title, href, content) {
    title = (title || "");
    href = (href || window.self.location.href);
    content = (content || "");
    var url = "http://v.t.sina.com.cn/share/share.php?c=spr_web_bd_tudou_weibo&title=" + encodeURIComponent(title + "\n" + content) + "&url=" + encodeURIComponent(href);
    return shareToSNS.openWindow(url, "Sina");
};

function gotosns(sType, sTitle, sUrl, sInfo, sAttr, sAttr2, sAttr3,pic) {

    switch (sType) {
    case 'kaixin':
        shareToSNS.kaixin001(sTitle, sUrl, sInfo);
        break;
    case 'xiaonei':
        shareToSNS.xiaonei(sTitle, sUrl, sInfo,pic);
        break;
    case 'douban':
        shareToSNS.douban(sTitle, sUrl, sInfo);
        break;
    case 'qzone':
        shareToSNS.qzone(sTitle, sUrl, sInfo);
        break;
    case 'sohu':
        shareToSNS.sohu(sTitle, sUrl, sInfo);
        break;
    case 'sina':
        shareToSNS.sina(sTitle, sUrl, sInfo);
        break;
    default:
        alert('default');
        break;
    }
}

