var listpos;
var comments;
var len;
var comments_table = [];
var no_comments = 2;

function display_comments(n)
{
  len = 0;
	no_comments = n;
  comments = document.getElementById("comments");
  for(var i=0;i<comments.childNodes.length;i++)
  {
    if(comments.childNodes[i].tagName!=undefined && comments.childNodes[i].tagName.toLowerCase() == "li")
    {
      comments_table[len]   = comments.childNodes[i];
      comments_table[len++].style.display = "none"; /* done this way so that non javascript browsers have something to display */
    }
  }
  listpos = Math.floor(Math.random()*len);
  rotate_comments(n);
}
  
function rotate_comments()
{
  var disp;
  if(typeof(listpos)==undefined) { alert("undef"); return; }
  for(disp = listpos+1; disp<listpos+no_comments+1; disp++)
  {
    comments_table[(disp + len - no_comments)%len].style.display = "none";
    comments_table[disp % len].style.display = "block"; 
  } 
  listpos = (listpos + no_comments)%len;
}
