I have the following script which gets the index of the selected tab:
http://jsfiddle.net/oshirowanen/eWncA/
Is it possible to get the id instead, if the li's had id's. If it is easier to get it from elsewhere, then that would also be fine, i.e. the related div tags, or somewhere else.
jQuery UI just adds a class to the selected li. You could just pull the li with the selected class out like this:
var id = $("li.tab.ui-tabs-selected").attr("id");
If you wanted to get one of the unselected tabs you could do something like this:
var id = $("li.tab:not(.ui-tabs-selected)").first().attr("id");
Working example: