
var commentHandleSuccess = function(o){

  if(o.responseText !== undefined){
    var comments = o.responseXML.documentElement.getElementsByTagName("comment");

    for(i=0; i< comments.length; i++)
    {
      commentId = comments[i].getAttribute("commentId");
      commentText = comments[i].getAttribute("text");
      commentUserId = comments[i].getAttribute("userId");
      commentUserName = comments[i].getAttribute("username");
      commentDate = comments[i].getAttribute("commentTime");
      commentUserLevel = comments[i].getAttribute("userlevel");
      entryId = comments[i].getAttribute("entryId");
      refreshPost(entryId, rootPostId,commentId,commentText,commentUserId,commentUserName,commentDate,commentUserLevel); // (root post id, reply id)
    }
    
  }
 }

var commentHandleFailure = function(o){
  if(o.responseText !== undefined){
    catDiv.innerHTML = "<li>Transaction id: " + o.tId + "</li>";
    catDiv.innerHTML += "<li>HTTP status: " + o.status + "</li>";
    catDiv.innerHTML += "<li>Status code message: " + o.statusText + "</li>";
  }
}
var commentCallback =
{
  success:commentHandleSuccess,
  failure:commentHandleFailure,
  argument: { foo:"foo", bar:"bar" }
};

function pullComment(commentId, rootId){
  rootPostId = rootId;
  var sUrl = g_domain + "xml/commentxml.php?commentId=" + commentId;
  catRequest = YAHOO.util.Connect.asyncRequest('GET', sUrl, commentCallback);
  return false;
}

