PRUint32 index=0; tbodies->Item(index, &node);
PRUint32 theIndex=0; tbodies->Item(theIndex, &node);
TableRowsCollection::Item(PRUint32 aIndex, nsIDOMNode** aReturn){  *aReturn = nsnull;  nsresult rv = NS_OK;  PRUint32 count = 0;   if (nsnull != mParent) {    nsIDOMHTMLTableSectionElement *rowGroup;    // check the thead    mParent->GetTHead(&rowGroup);    if (nsnull != rowGroup) {      nsIContent *content = nsnull;      rowGroup->QueryInterface(kIContentIID, (void **)&content);      GenericElementCollection head(content, nsHTMLAtoms::tr);      PRUint32 rowsInHead;      head.GetLength(&rowsInHead);      count = rowsInHead;      NS_RELEASE(content);      NS_RELEASE(rowGroup);      if (count > aIndex) {        head.Item(aIndex, aReturn);        return NS_OK;       }    }	// check the tbodies    nsIDOMHTMLCollection *tbodies;    mParent->GetTBodies(&tbodies);    if (nsnull != tbodies) {      rowGroup = nsnull;      nsIDOMNode *node;      PRUint32 index=0;      tbodies->Item(index, &node);      while (nsnull != node) {        nsIContent *content = nsnull;        node->QueryInterface(kIContentIID, (void **)&content);        GenericElementCollection body(content, nsHTMLAtoms::tr);        NS_RELEASE(content);        NS_RELEASE(node);        PRUint32 rows;        body.GetLength(&rows);        if ((count+rows) > aIndex) {          body.Item(aIndex-count, aReturn);          NS_RELEASE(tbodies);		  return NS_OK;        }        count += rows;        index++;        tbodies->Item(index, &node);      }      NS_RELEASE(tbodies);    }    // check the tfoot    mParent->GetTFoot(&rowGroup);    if (nsnull != rowGroup) {      nsIContent *content = nsnull;      rowGroup->QueryInterface(kIContentIID, (void **)&content);      GenericElementCollection foot(content, nsHTMLAtoms::tr);      foot.Item(aIndex-count, aReturn);      NS_RELEASE(content);      NS_RELEASE(rowGroup);    }  }  return rv;}