function getParent(obj, parentTagName) { return (obj.tagName==parentTagName)?obj:getParent(obj.parentNode, parentTagName); }