handle jQuery matches with multiple elements

A jQuery match operation may return more than one element.
Your code does not take this into account. This is a minimal patch to fix
the problem ($menu only being evaluated on the first element of the match).
Obviously the fix could be made much 'nicer' but more lines of code would change.

The reason I like to see this fixed, is because I use aim in a structure where
multiple menus are affected by it services.