This line of code:
Hides all elements with the class “alpha” which contain no visible elements with the class “beta” (i.e. if it contains any visible elements of class “beta”, the “alpha” is not hidden).
var has_visible_beta = false;
inner_element.hasClassName('beta') && inner_element.visible()
has_visible_beta = true;
(okay, that Prototype code could probably be a hair simpler, but you get my point)