function updateCheckSessionImg(checkImgID){
    var obj=$(checkImgID);
    obj.src='/checkKey/?r='+Math.random();
    return false;
}
function submitComment(theFrm){
    if(!Validator.Validate(theFrm,3)) return false;

    var f=theFrm;
    var params='comment_name='+encodeURIComponent(f['comment.name'].value)+
               '&comment_url='+encodeURIComponent(f['comment.url'].value)+
               '&comment_checkKey='+f['checkKey'].value+
               '&comment_content='+encodeURIComponent(f['comment.content'].value)+
               '&comment_log_id='+f['comment.log_id'].value+'&r='+Math.random();
               
    var ajax_url='/blog/ajax_post_comment_act.php';
    xmlHttp = new createXHR();
    xmlHttp.onreadystatechange=function(){
        if(xmlHttp.readyState==4 && xmlHttp.status==200){
            if('key_error' == xmlHttp.responseText){
                alert('请输入正确的校验码！');
                e=f['checkKey'];
                try{
                    var r=e.createTextRange();
                    r.moveStart('character',e.value.length);
                    r.collapse(true);
                    r.select();
                }catch(e){}
                return ;
            }
            if('ok' == xmlHttp.responseText){
                var d=new Date();
                var dStr=d.getYear()+'年'+(d.getMonth()+1)+'月'+d.getDate()+'日 '+d.getHours()+':'+d.getMinutes()+':'+d.getSeconds();
                if(''==f['comment.url'].value){
                    if(f['comment.currenUid'].value)
                    var uhref='http://blog.cnfstar.com/user/'+f['comment.currenUid'].value;
                    else uhref='#';
                }else{
                    var uhref=f['comment.url'].value;
                }
               
                var insertHtml='<dl class="question">'+
                    '<dt><a href="#" >#</a><a href="'+uhref+'"  target="_blank" rel="nofollow">'+f['comment.name'].value+'</a>&nbsp;发表于'+dStr+'&nbsp;&nbsp;</dt>'+
                    '<dd class="quesauthor"><img src="/blog/get_mem_img.php?id='+f['comment.currenUid'].value+'&t=0" width="40px" height="40px" border=0 alt=""></dd>'+
                    '<dd>'+f['comment.content'].value+'</dd></dl>';
                $('commentslist').innerHTML=$('commentslist').innerHTML+insertHtml;
                f['comment.content'].value='';
                f['checkKey'].value='';
            }else if('txt_error' == xmlHttp.responseText){
                alert('请输入姓名或评论内容！');
            }else if('url_error' == xmlHttp.responseText){
                alert('主页url地址不合法！');
            }else if('db_error' == xmlHttp.responseText){
                alert('很抱歉，服务器太忙了，请稍后再提交.');
            }
            updateCheckSessionImg('Post.checkKeyImage');
        }
    }
    
    xmlHttp.open('post',ajax_url,true);
    xmlHttp.setRequestHeader("content-length",params.length);
    xmlHttp.setRequestHeader("content-type","application/x-www-form-urlencoded");
    xmlHttp.send(params);
}
