Commenters above note Scriptaculous methods to do this, but it's always worth knowing how to perform basic DOM manipulation of this manner without crutches. This code is untested but certainly extremely close to what you'd want to use:
/**
* Finds the ancestor div element of descendantDiv which has one of
* the given array of ids. If multiple div elements have with the
* given ids are ancestors of descendantDiv, the most closely related
* one (i.e. parent preferred to grandparent) is returned. If no
* ancestor of descendantDiv is a div element with one of the ids
* given by ids, returns null.
*
* @param descendantDiv : HTMLDivElement
* the div element whose containing div with one of the provided
* ids is to be determined
* @param ids : [string]
* array of ids which the desired ancestor div might have
* @returns HTMLDivElement
* the first parent, grandparent, etc. div element of descendantDiv
* which has an id contained in ids
*/
function findAncestorDivWithId(descendantDiv, ids)
{
for (var parent = descendantDiv.parentNode;
parent;
parent = parent.parentNode)
{
if (parent.nodeName.toLowerCase() !== "div")
continue;
for (var i = 0, sz = ids.length; i < sz; i++)
{
if (parent.id === ids[i])
return parent;
}
}
return null;
}