﻿function GetImgUrl(url, size) {
    return   'http://img.qigle.com/' + url.replace('_s', '_' + size);



}

/*腾讯微博*/
function shareToTXWb(title, rLink, site, pic) {
    window.open('http://v.t.qq.com/share/share.php?url=' + encodeURIComponent(rLink) + '&title=' + encodeURI(title) + '&appkey=' + encodeURI(site) + '&pic=' + encodeURI(pic), '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes')
}

/*新浪微博*/
function shareToSina(title, rLink, site, pic) {
    window.open('http://service.weibo.com/share/share.php?title=' + encodeURIComponent(title) + '&url=' + encodeURIComponent(rLink) + '&appkey=' + encodeURIComponent(site) + '&pic=' + encodeURIComponent(pic), '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes')
}

/*人人*/
function shareToRR(title, rLink, summary) {
    window.open('http://share.renren.com/share/buttonshare.do?title=' + encodeURIComponent(title) + '&link=' + encodeURIComponent(rLink), '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes');
}

/*开心网*/
function shareToKX(title, rLink, summary) {
    window.open('http://www.kaixin001.com/repaste/bshare.php?rtitle=' + encodeURIComponent(title) + '&rurl=' + encodeURIComponent(rLink) + '&rcontent=' + encodeURIComponent(summary), '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes')
}

/*百度*/
function shareToBaiDu(title, rLink) {
    window.open('http://apps.hi.baidu.com/share?title=' + encodeURIComponent(title) + '&url=' + encodeURIComponent(rLink), '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes')
}

/*豆瓣*/
function shareToDouBan(title, rLink) {
    window.open('http://www.douban.com/recommend?title=' + encodeURIComponent(title) + '&url=' + encodeURIComponent(rLink), '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes')
}

/*QQ空间*/
function shareToQzone(title, rLink, summary, site, pic) {
    window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?title=' + encodeURIComponent(title) + '&url=' + encodeURIComponent(rLink) + '&summary=' + encodeURIComponent(summary) + '&site=' + encodeURIComponent(site) + '&pics=' + encodeURIComponent(pic), '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes')
}

/*我喜欢*/
function AddUserlikeItem(itemId, UserId, uid) {
    if (UserId <= 0) {
        return alert("请登录后在收藏!");
    }
    $.getJSON('/ajax/AjaxAddUserPro', { 'itemId': itemId, 'userid': UserId, 'uid': uid }, function(data) {
        if (data.result == 'true') {
            alert(data.error);
            $('#span_' + itemId).html(data.num);
        } else {
            alert(data.error);
        }
    });
}
function AddUserLikePhoto(potoid, UserId, uid) {
    if (UserId <= 0) {
        return alert("请登录后在收藏!");
    }
    $.getJSON('/ajax/AjaxAddUserLikePhoto', { 'potoid': potoid, 'userid': UserId, 'uid': uid }, function(data) {
        if (data.result == 'true') {
            alert(data.error);
            $('#span_' + pid).html(data.num);
        } else {
            alert(data.error);
        }
    });
}
function AddUserLikePb(pbid, UserId, uid) {
    if (UserId <= 0) {
        return alert("请登录后在收藏!");
    }
    $.getJSON('/ajax/AjaxAddUserLikePb', { 'pbid': pbid, 'userid': UserId, 'uid': uid }, function(data) {
        if (data.result == 'true') {
            alert(data.error);
            $('#span_' + pid).html(data.num);
        } else {
            alert(data.error);
        }
    });
}

//$(document).ready(function() {
//    $(".aWritBack").click(function() {
//        $('.forward').attr('style', 'display:block;');
//    });
//});



function AWriteBack(uid, pid, content) {    
    if (uid <= 0) {
        return alert("请登录后在回复");        
    }

}

//转发
function TransMit(UserId, pid,contents) {
    if (UserId < 0) {
        return alert("请登录后在转发");
    }

    $.getJSON('/ajax/AjaxTransMit', { 'userid': UserId, 'pid': pid ,'contents':contents}, function(data) {
        if (data.result == 'true') {
            alert(data.error);
        }
        else {
            alert(data.error);
        }
    });
}
