Open first sub tab by default

Open first sub tab by default

I'm having a very hard time with this. 
I'm trying to make nested tabs that can later be used with AJAX. Everything seems to work but this:
If you click Main Tab B, then Subtab 2
Then click Main Tab A, and go back to Main Tab B - Subtab 2 is still open.
I need the default sub tab for each main tab to be the first one. 

IMPORTANT : I'm almost 100% positive that the problem lies in this line of code in the subTabs function.
  1. <!DOCTYPE html>
  2. <html>
  3. <head>

  4. <title>Subtabs & Ajax</title>

  5. <script src="http://cdn.jquerytools.org/1.2.6/full/jquery.tools.min.js"></script>
  6. <link rel="stylesheet" type="text/css" href="styles.css" />
  7.     
  8. </head>
  9. <body>
  10. <div style="width: 100%; text-align: center;">
  11. <div class="wrap">

  12.  <!-- Parent Tabs -->   
  13. <ul id="mainTabs" class="tabs" style="border-style: none;">
  14.     <li><a href="#pageA1">Main A</a></li>
  15.     <li><a href="#pageB1">Main B</a></li>
  16.   </ul>
  17.  <div style="height: 11px;"></div>

  18.  <!-- Subtabs -->  
  19.     
  20. <div class="pane">
  21. <p>Main A</p>

  22. <ul id="subTabs" class="tabs">
  23.   <li><a href="#pageA1">Subtab 1</a></li>
  24.   <li><a href="#pageA2">Subtab 2</a></li>
  25. </ul>


  26. <div class="pane">
  27. <h3>First Tab Content </h3 ><br> 
  28. <div class="initTab" class="content" style="width:400px; height: 400px; background-color: #CCC;"></div>
  29. </div>

  30. <div class="pane">
  31. <h3>Second tab content</h3 ><br>
  32. <div class="content" style="width:400px; height: 400px; background-color: #CCC;"></div>
  33. </div>
  34. </div>

  35. <div class="pane">
  36. <p>Main B</p>

  37. <ul id="subTabs" class="tabs">
  38.   <li><a href="#pageB1">Subtab 1</a></li>
  39.   <li><a href="#pageB2">Subtab 2</a></li>
  40. </ul>

  41. <div class="pane"><h3>First tab content.</h3 ><br>
  42. <div class="content" style="width:400px; height: 400px; background-color: #CCC;">
  43. </div>
  44. </div>

  45. <div class="pane"><h3>Second tab content</h3 > <br>
  46. <div class="content" style="width:400px; height: 400px; background-color: #CCC;">
  47. </div>
  48. </div>
  49. </div>

  50. <br>
  51.  
  52.         </div> </div>
  53. </div>

  54. <script>
  55.   // perform JavaScript after the document is scriptable.
  56.  $(document).ready(function(){
  57.      $(".initTab").load("pageA1.txt"); //Load ajax for initial tab when site first opens
  58.      subTabs(); //Load subtabs when main tab is clicked
  59.      loadAjax(); //Load ajax content when sub tab is clicked

  60.     });

  61. function subTabs(){ //Subtab page area
  62.      $("ul.tabs").tabs("> .pane");
  63.  }
  64. function loadAjax(){
  65.     $(".tabs a").click(function(){
  66.         var page = this.hash.substring(1); //Remove Hash from href
  67.         $(".content").load(page+".txt"); //Load .txt file corresponding to href
  68.     });

  69. }
  70.     
  71. </script>

  72. </body>
  73. </html>