jQuery 'not' function giving spurious results
<p>Made a fiddle: <a href="http://jsfiddle.net/n6ub3/" rel="nofollow">http://jsfiddle.net/n6ub3/</a></p>

<p>I'm aware that the code has a LOT of repeating in it, its on the list to refactor once functionality is correct.</p>

<p>The behaviour i'm trying to achieve is if there is no selectedTab on page load, set the first tab in each group to selectedTab. If there is a selectedTab present, then use this as the default shown div.</p>

<p>However, as you can see from the fiddle its not working as planned!</p>

<p>If anyone has any ideas how to refactor this code down that'd be great also!</p>
