//extern g_comment_ownertype; 
//extern g_comment_ownerid;
function reply(commentid){
    document.getElementById('id_comment').focus();
}
function quote(commentid){
    var v = document.getElementById('id_comment_'+commentid).innerHTML;
    var h = document.getElementById('id_comment').value;
    document.getElementById('id_comment').value= h+'<blockquote>'+v+'</blockquote>';
    document.getElementById('id_comment').focus();
}
function deactiveatebuttons(commentid,dtype){
    greyup = page_to_src('images/thumbs_upgrey.gif');
    greydn = page_to_src('images/thumbs_downgrey.gif');
    if(dtype=='up') greyup = page_to_src('images/thumbs_upgreen.gif');
    if(dtype=='down') greydn = page_to_src('images/thumbs_downred.gif');
    objspan = document.getElementById('id_thumbs_'+commentid);
    objspan.innerHTML='<img src="'+greyup+'"  width=16 height=19 align=absbottom> <img src="'+greydn+'"  width=16 height=19 align=absbottom>';
}
function thumbupclick(commentid){
    deactiveatebuttons(commentid,'up');
    moderate(commentid,'1',g_comment_ownertype,g_comment_ownerid);
}
function thumbdownclick(commentid){
    deactiveatebuttons(commentid,'down');
    moderate(commentid,'-1',g_comment_ownertype,g_comment_ownerid);
}
function thumbuphover(commentid){
    document.getElementById('id_thumbup_'+commentid).src=page_to_src('images/thumbs_upgreen.gif');
}
function thumbdownhover(commentid){
    document.getElementById('id_thumbdown_'+commentid).src=page_to_src('images/thumbs_downred.gif');
}
function thumbupaway(commentid){
    document.getElementById('id_thumbup_'+commentid).src=page_to_src('images/thumbs_upgrey.gif');
}
function thumbdownaway(commentid){
    document.getElementById('id_thumbdown_'+commentid).src=page_to_src('images/thumbs_downgrey.gif');
}
function moderate(commentid,val,owntype,ownid){
    var paramsobj = new Object();
    paramsobj.commentid = commentid;
    paramsobj.modval    = val;
    paramsobj.owntype   = owntype;
    paramsobj.ownid     = ownid;
    AJAX.execute(moderate_bq, moderate_cb, paramsobj)
}
function moderate_bq(paramsobj){
    var myUrl       = new Object();
    myUrl.action    = 'moderate';
    myUrl.commentid = paramsobj.commentid;
    myUrl.modval    = paramsobj.modval;
    myUrl.owntype   = paramsobj.owntype;
    myUrl.ownid     = paramsobj.ownid;
    return myUrl;
}
function moderate_cb(ajaxobj,paramsobj){
    pieces = ajaxobj.responseText.split('|');
    if (pieces[0]=='error') {alert(pieces[1]); }
    else if (pieces[0]=='success' && pieces[1]=='ok')
    {  
        obj = document.getElementById('id_commscore_'+paramsobj.commentid);
        if (paramsobj.modval=='1')
        obj.innerHTML=(obj.innerHTML*1)+1;
        else if (paramsobj.modval=='-1')
        obj.innerHTML=(obj.innerHTML*1)-1;
    }
}
