Search_terms on the groups directory

This commit applies search term and order by selections to ajax group
requests from the tree. So when you expand a parent group, the
subgroups are filtered by search term and ordered as requested. I also
made some logic changes to accommodate BP Group meta queries. See also:
https://buddypress.trac.wordpress.org/ticket/5679
Remember tab upon page reload

This commit helps the group directory page "remember" what tab should
be displayed at page load, using cookies and modifying the object
passed to bp_ajax_querystring. This is targeted at installations where
the regular groups directory has been replaced with the tree view.
Properly use jQuery "on"

Because the subitem indicator is replaced when switching tabs, event
delegation is required for on:
http://api.jquery.com/on/#direct-and-delegated-events
Correct creation of cookies
Merge pull request #12 from dcavins/allow-meta-queries

Search_terms on the groups directory