document.write('<script type="text/javascript" src="/Lib/js/Info/KeyWordCommon.js"></scr' + 'ipt>');
/***********************************************************************************************************
 2007.8.22 By xianghuan
 * 目的：显示资料区的投票信息
 * 输入：
 * 输出：
 * 修改记录：
 ***********************************************************************************************************/
function ShowVote(ra,rb,rc,rd,re){
    var total=ra+rb+rc+rd+re;
    var maxlen=80;
    if(total<=0){total=1;}
    $("votResA").innerHTML=ra;
    $("votResB").innerHTML=rb;
    $("votResC").innerHTML=rc;
    $("votResD").innerHTML=rd;
    $("votResE").innerHTML=re;
    
    $("imgResA").width=(ra*maxlen/total)<1?1:ra*maxlen/total;
    $("imgResB").width=(rb*maxlen/total)<1?1:rb*maxlen/total;
    $("imgResC").width=(rc*maxlen/total)<1?1:rc*maxlen/total;
    $("imgResD").width=(rd*maxlen/total)<1?1:rd*maxlen/total;
    $("imgResE").width=(re*maxlen/total)<1?1:re*maxlen/total;
}


/***********************************************************************************************************
 2007.8.22 By xianghuan
 * 目的：投票
 * 输入：
 * 输出：
 * 修改记录：
 ***********************************************************************************************************/
function Ctrl_Vote(infoid){
    var vt=0;
	var rdarr = document.getElementsByName('rdVote');
	for (var i =0; i < rdarr.length; i++) {
		if (rdarr[i].checked == true){
			vt=rdarr[i].value;
		}
	}
	
	var url="/System/InfoAjaxService.aspx";
	var param="op=getinfovoteresult&infoid="+infoid+"&vote="+vt;
	var myajax=new Ajax.Request(url,{method:'get',parameters:param,onComplete:Ctrl_DoInfoVote});
}
function Ctrl_DoInfoVote(oriRequest){
    var sr=oriRequest.responseText;
    if(sr.substring(0,1)=="0")
    {
        alert(sr.substring(2));
        return;
    }
    else if(sr.substring(0,1)=="1")
    {
        eval("ShowVote("+sr.substring(2)+");");
        alert("投票成功，谢谢您的支持");
    }
}
function ReplyGetFocus()
{
    if ($('tbReplyContent')!=null)
    {  
      $('tbReplyContent').focus();
    }
}

/***********************************************************************************************************
 2007.8.22 By xianghuan
 * 目的：资料底层作者资料
 * 输入：
 * 输出：
 * 修改记录：
 ***********************************************************************************************************/
function showAuthorInfo() {
    var ufObj = document.getElementById("userfile02");
    var ufImg = document.getElementById("ufilelist");
    if(ufObj.style.display == '')
    {
        ufImg.src = '/images/Info/button/userfile_open.gif';
        ufObj.style.display = 'none';
    }
    else
    {
        ufImg.src = '/images/Info/button/userfile_close.gif';
        ufObj.style.display = '';
    }
}

/***********************************************************************************************************
 2007.8.22 By xianghuan
 * 目的：快速评论
 * 输入：
 * 输出：
 * 修改记录：
 ***********************************************************************************************************/
function doReplySubmit(infoid)
{ 
    //首先进行数据检测
    if ($F("tbReplyContent").length==0)
    {
        alert("评论内容不能为空！");
        return;
    }
    var strReplyContent=encodeURIComponent($F("tbReplyContent"));
    var strUserNo="";
    var strUserPsw="";
    if ($("tbReplyUserNo")!=null)
    {
        strUserNo=$F("tbReplyUserNo");    
    }
    if ($("tbReplyUserPwd")!=null)
    {
        strUserPsw=$F("tbReplyUserPwd");    
    }
    //再通过Ajax提交（处理完毕之后重新创建静态网页） 
    var url="/System/InfoAjaxService.aspx";
    var param="op=getreplyresult&infoid="+infoid+"&replycontent="+strReplyContent+"&userno="+escape(strUserNo)+"&psw="+escape(strUserPsw);
    var myajax=new Ajax.Request(url,{method:'post',parameters:param,onComplete:ShowReplyResult});
    
    //提交完之后调转到所有评论页面）
    function ShowReplyResult(oriRequest)
    {
        var sr=oriRequest.responseText;
        if(sr.substring(0,1)=="0")
        {   
            alert(sr.substring(2));
        }else if(sr.substring(0,1)=="3")
        {
            alert(sr.substring(2));
            window.parent.location.href="/Detail/ReplyList/"+infoid+"/";
        }
        else if(sr.substring(0,1)=="1")
        {
            window.parent.location.href="/Detail/ReplyList/"+infoid+"/";
        }
        else if(sr.substring(0,1)=="2")
        {
           window.open("http://user.tgnet.cn/activation.html");
        }
    }
}


function checkAnReoly() 
{
    if ($("chkanReply").checked)
    {
        $("tbReplyUserNo").value="";
        $("tbReplyUserPwd").value="";
        $("tbReplyUserNo").disabled=true;
        $("tbReplyUserPwd").disabled=true;        
    }
    else
    {
        $("tbReplyUserNo").disabled=false;
        $("tbReplyUserPwd").disabled=false;
    }        
}


