﻿var postbackCommID;
function fndeleteDiray(blogid) {
    if (window.confirm("确认要删除此日志吗？")) {
        caller("?flag=2&bID=" + blogid,{});
    }
}
var commentLength = 500;
function fnAddComment() {
    var comment = $("txtblogCommnent").value.trim();
    if (comment == "") {
        $("errInfo").innerHTML = "请输入评论内容！";
        $("errInfo").style.visibility = "visible";
        $("txtblogCommnent").focus();
        return;
    }
    if (comment.length > commentLength) {
        $("errInfo").innerHTML = "内容请少于" + commentLength + "！";
        $("errInfo").style.visibility = "visible";
        $("txtblogCommnent").focus();
        return;
    }
    if(hasVerifyCode=="1"){
        if ($("_textVerifyCode").value.trim() == "") {
            $("errInfo").innerHTML = "请输入验证码！";
            $("errInfo").style.visibility = "visible";
            $("_textVerifyCode").focus();
            return false;
        }
    }
    inputVerifyCode = $("_textVerifyCode").value.trim();
    
    var cp= PagerBlogComment.PageCount;
    
    $("submitComment").disabled=true;
    caller("?flag=0", { comment: comment,verifyCode:inputVerifyCode,cp:cp});
}
function delComment(commID,pID) {
    if(window.confirm("确定要删除该评论吗？")){
        var cp= PagerBlogComment.CurrentPageIndex;
        caller("?flag=1", {commentID:commID,pID:pID,cp:cp});
    }
}
function fnbackComment(commID) {
    postbackCommID = commID;
    $("txtPostBackComment").value = "";
    winPostBack.show();
}

function fnPostBackComment() {
    var comment = $("txtPostBackComment").value.trim();
    if (comment == "") {
        alert("请输入评论内容！");
        $("txtPostBackComment").focus();
        return;
    }
    if (comment.length > commentLength) {
        alert("内容请少于" + commentLength + "！");
        $("txtPostBackComment").focus();
        return;
    }
    var cp= PagerBlogComment.CurrentPageIndex;
    caller("?flag=0", {commentID:postbackCommID,comment:comment,cp:cp});
}


function fnQuote(bID,obj) {

    var sLeft = $(obj).offsetLeft;
    var sTop = $(obj).offsetTop;
    var pobj = $(obj);

    while (pobj = pobj.offsetParent) {
        sLeft += pobj.offsetLeft;
        sTop += pobj.offsetTop;
    }
    sTop = sTop + Element.getHeight(obj);
    
    $("curPlayerBlogType").style.display = "block";
    $("curPlayerBlogType").style.zIndex = 100;
    $("curPlayerBlogType").style.left = sLeft + "px";
    $("curPlayerBlogType").style.top = sTop + "px";
    $("curPlayerBlogType").style.position = "absolute";



}
function fnQuoteBlog() {
    if ($("optCurPlayerBlogType").value == "") {
        alert("请选择转载的日志类别！")
        $("optCurPlayerBlogType").focus();
        return;
    }
    caller("?flag=3", { quoteBlogType: $("optCurPlayerBlogType").value });
}

function fnCancelQuote() {
    $("curPlayerBlogType").style.display = "none";
}
//检查申请
function checkApply(playerid,obj,type)
{
    $("validationInfo").value="";
    selectid=playerid;
    caller("?flag=checkapply",{playerid:playerid,type:type})
}

function addApplyFriend()
{
    caller("?flag=addapply",{playerid:selectid,validationInfo:$("validationInfo").value})
}

function getPicWH(width,height,maxHeight,divid)
{
    
    if(width>490)
        $(divid).style.width="490px"; 
    
    if(height>maxHeight)
        $(divid).style.height=maxHeight+"px";
    else
        $(divid).style.height=height+"px";
}

