This is core XPages rather than the extension lib. But it already exists, through the method isCurrentTab()
getComponent("mytab").isCurrentTab()
Also, the current tab id can be accessed from the tab panel itself
getComponent("tabpnl").getSelectedTab()