Here is a compact way to replicate jQuery UI tabs without the UI. I wrote this code to account for unlimited tabs and to create dynamic “selected” class on the clicked item and removes the class when you click on another tab. This lends itself to easier styling of the tabs as well.
I was recently working on a BuddyPress site where the site owner wanted everyone who signed up to be a friend of a “support” user. He wanted people to be able to direct message this account, and in this case, he had Comet Chat installed. This meant that if “support” were online, then anyone could chat with support. I dug into the BuddyPress DB to see how friends were enabled and wrote this function that you can put into your themes functions.php to enable.