Im having a problem to determine how to manipulate the Borders for some Tabs

You can see the functionality here on ASP.NET if you are logged-in http://forums.asp.net/user/editprofile.aspx#
You can see for an onClick Event the background-color of the Tab changes to white like its supposed to.
The problem that Im having has to do with the Borders for onClick:
The border-bottom should change from the grey color to white. The border-left and the border-right should change to the grey color.
Likewise when a Tab is not selected: The border-bottom should change to the grey color from white. The border-left and border-right should not have a border.
In my CSS, Im using both the blue and white class for the JavaScript. However I also have: .common-heading-tabs a.selected and this is confusing me.
Here is my Fiddle- if someone could help It would be great http://jsfiddle.net/NinjaSk8ter/ZSeFA/