Dynamically add tabs using jQuery-ui tabs

Dynamically add tabs using jQuery-ui tabs

I have a menu system that calls a function that contains     $('#tabs > ul').tabs("add",page,page_name);
where page holds the path/name of the php page and page_name is a unique name for the page.

I suspect I then need to load and show the page but am currently confused as to how to do it.

A short example of adding, loading, showing and selecting the page would be appreciated. ie. add a tab with the new page content in it and have it as the active tab on the screen.

The other thing is to have a close button on the tab to remove it when finished but that could be another subject.

Thanks