The following function goes up the DOM parent chain until if finds a node whose name was passed as a second parameter.
If it does not find it, it returns null. For example, you can pass it an HTMLTableCellElement as the first argument, and a "TABLE"
as the second argument, and it will return an HTMLTableElement object.
function findParent(node, parentName){
while(node.parentNode)
{
if(node.parentNode.nodeName==parentName.toUpperCase()){
return node.parentNode;
}
else
node= node.parentNode;
}
return null;
}
