fixed the way active tab index was calculated

the previous method was not working as it should
fix Res Manager sort bug #243
Merge pull request #245 from Cipa/develop

fix Res Manager sort bug #243