Why this does not work in firefox i try to select the category and then make subcategory visible.
ULs don't have a name attribute, but you can reference the ul by tag name.
Try replacing line 3 in your script with this:
var sub = cat.getElementsByTagName("UL");