multiple div panel slideup/slidedown cookie problem

multiple div panel slideup/slidedown cookie problem

i currently have 2 panels with information that have a link that when it is clicked it adds the class collapse and shrinks div and when collapse is clicked it expands the div.

  1.  $(".collapse").live("click", function () {
  2.                 var header = $(this).parent(".header").attr('id');
  3.                 $(this).parent(".header").find('a').slice(0, 1).addClass("collapsed").removeClass("collapse");
  4.                 $(this).parent(".header").next(".panel").slideToggle("slow");
  5.                 $.cookie('customerinfo', 'collapse');
  6.                 $.cookie('header', header);
  7.                 return false;
  8.             });
  9.             $(".collapsed").live("click", function () {
  10.                 $(this).parent(".header").find('a').slice(0, 1).addClass("collapse").removeClass("collapsed");
  11.                 $(this).parent(".header").next(".panel").slideToggle("slow");
  12.                 $.cookie('customerinfo', 'collapsed');
  13.                 return false;
  14.             });

im using Klaus Hartl's cookie plugin to store the current state of the link and and the id name of the header
which i then have this code which checks the state of the link and if its state is collapse then keep it hidden otherwise show.

  1. var leftCol = $.cookie('customerinfo');
  2.             var currentheader = $.cookie('header');
  3.             alert(currentheader);
  4.             currentheader = '#' + currentheader;
  5.             // Set the user's selection for the left column
  6.             if (leftCol == 'collapse') {
  7.                 $(currentheader).find('a').slice(0, 1).addClass("collapsed").removeClass("collapse");
  8.                 //$(this).parent(".header").next(".panel").slideToggle(600).siblings("tr").slideUp("slow");
  9.                 $(currentheader).next(".panel").hide();
  10.                 //$('#customerinfo').css("display", "none");
  11.             };
this currently only works with one panel at a time which is the problem i need it working with 5 panels checking on postbacks if a panel is expanded or collapsed. i had the idea of creating an array by adding the current header with the previous header cookie and storing it but im not that great with arrays and cant get it to work right. if anyone can help by giving some pseudo-code or giving a direction to go it would be greatly appreciated

heres the html
  1. <div class="header" id="header_customerinfo"> <a class="collapse">[-]</a> <a>Customer Information</a>
  2.       <div class="button">
  3.     <input type="button" value="text" />
  4.     <input type="button" value="text" />
  5.     <input type="button" value="text" />
  6.     <input type="button" value="text" />
  7.   </div>
  8.     </div>
  9. <div class="panel" id="panel_customerinfo">
  10.       <table id="tablea" class="stripes" runat="server" cellpadding="0" cellspacing="1">
  11.     <tr>
  12.           <td class="style1"> Customer ID: </td>
  13.           <td><asp:Label ID="lblCustomerID" runat="server" />
  14.         <asp:TextBox ID="txtCustID" CssClass="test" runat="server"></asp:TextBox>
  15.         <asp:RegularExpressionValidator
  16.                                     ID="RegularExpressionValidator2" ControlToValidate="txtCustID" runat="server"
  17.                                     ValidationExpression="^[0-9]+$" Text=" Must be numeric"></asp:RegularExpressionValidator></td>
  18.           <td class="style1"> Entry Date: </td>
  19.           <td><asp:Label ID="lblEntry" runat="server" />
  20.         <asp:TextBox ID="txtEntry" runat="server"></asp:TextBox>
  21.         <asp:RegularExpressionValidator
  22.                                     ID="RegularExpressionValidator1" ControlToValidate="txtEntry" runat="server"
  23.                                     ValidationExpression="^(((((((0?[13578])|(1[02]))[\.\-/]?((0?[1-9])|([12]\d)|(3[01])))|(((0?[469])|(11))[\.\-/]?((0?[1-9])|([12]\d)|(30)))|((0?2)[\.\-/]?((0?[1-9])|(1\d)|(2[0-8]))))[\.\-/]?(((19)|(20))?([\d][\d]))))|((0?2)[\.\-/]?(29)[\.\-/]?(((19)|(20))?(([02468][048])|([13579][26])))))$"
  24.                                     Text=" mm/dd/yy" /></td>
  25.         </tr>
  26.     <tr>
  27.           <td class="style1"> Company Name: </td>
  28.           <td><asp:Label ID="lblCompanyName" runat="server" />
  29.         <asp:TextBox ID="txtCompanyName" runat="server"></asp:TextBox>
  30.         <asp:RegularExpressionValidator
  31.                                     ID="regexTextBox1" ControlToValidate="txtCompanyName" runat="server" ValidationExpression="[\S\s]{4,50}"
  32.                                     Text=" 4 characters min"></asp:RegularExpressionValidator></td>
  33.           <td class="style1"> Status: </td>
  34.           <td><asp:Label ID="lblStatus" runat="server" />
  35.         <asp:TextBox ID="txtStatus" runat="server"></asp:TextBox>
  36.         <asp:RegularExpressionValidator
  37.                                     ID="RegularExpressionValidator5" ControlToValidate="txtStatus" runat="server"
  38.                                     ValidationExpression="^([a-zA-Z '/]+)$" Text=" invalid status"></asp:RegularExpressionValidator></td>
  39.         </tr>
  40.     <tr>
  41.           <td class="style1"> Tax ID: </td>
  42.           <td><asp:Label ID="lblTaxID" runat="server" />
  43.         <asp:TextBox ID="txtTaxID" runat="server"></asp:TextBox></td>
  44.           <td class="style1"> Removal Date: </td>
  45.           <td><asp:Label ID="lblRemoval" runat="server" />
  46.         <asp:TextBox ID="txtRemoval" runat="server"></asp:TextBox>
  47.         <asp:RegularExpressionValidator
  48.                                     ID="RegularExpressionValidator3" ControlToValidate="txtRemoval" runat="server"
  49.                                     ValidationExpression="^(((((((0?[13578])|(1[02]))[\.\-/]?((0?[1-9])|([12]\d)|(3[01])))|(((0?[469])|(11))[\.\-/]?((0?[1-9])|([12]\d)|(30)))|((0?2)[\.\-/]?((0?[1-9])|(1\d)|(2[0-8]))))[\.\-/]?(((19)|(20))?([\d][\d]))))|((0?2)[\.\-/]?(29)[\.\-/]?(((19)|(20))?(([02468][048])|([13579][26])))))$"
  50.                                     Text=" mm/dd/yy" /></td>
  51.         </tr>
  52.   </table>
  53.     </div>
  54.     <div class="header" id="header_tustomerinfo"> <a class="collapse">[-]</a> <a>Customer Information</a>
  55.       <div class="button">
  56.     <input type="button" value="text" />
  57.     <input type="button" value="text" />
  58.     <input type="button" value="text" />
  59.     <input type="button" value="text" />
  60.   </div>
  61.     </div>
  62. <div class="panel" id="panel_customerinfo">
  63.       <table id="tablea" class="stripes" runat="server" cellpadding="0" cellspacing="1">
  64.     <tr>
  65.           <td class="style1"> Customer ID: </td>
  66.           <td><asp:Label ID="lblCustomerID" runat="server" />
  67.         <asp:TextBox ID="txtCustID" CssClass="test" runat="server"></asp:TextBox>
  68.         <asp:RegularExpressionValidator
  69.                                     ID="RegularExpressionValidator2" ControlToValidate="txtCustID" runat="server"
  70.                                     ValidationExpression="^[0-9]+$" Text=" Must be numeric"></asp:RegularExpressionValidator></td>
  71.           <td class="style1"> Entry Date: </td>
  72.           <td><asp:Label ID="lblEntry" runat="server" />
  73.         <asp:TextBox ID="txtEntry" runat="server"></asp:TextBox>
  74.         <asp:RegularExpressionValidator
  75.                                     ID="RegularExpressionValidator1" ControlToValidate="txtEntry" runat="server"
  76.                                     ValidationExpression="^(((((((0?[13578])|(1[02]))[\.\-/]?((0?[1-9])|([12]\d)|(3[01])))|(((0?[469])|(11))[\.\-/]?((0?[1-9])|([12]\d)|(30)))|((0?2)[\.\-/]?((0?[1-9])|(1\d)|(2[0-8]))))[\.\-/]?(((19)|(20))?([\d][\d]))))|((0?2)[\.\-/]?(29)[\.\-/]?(((19)|(20))?(([02468][048])|([13579][26])))))$"
  77.                                     Text=" mm/dd/yy" /></td>
  78.         </tr>
  79.     <tr>
  80.           <td class="style1"> Company Name: </td>
  81.           <td><asp:Label ID="lblCompanyName" runat="server" />
  82.         <asp:TextBox ID="txtCompanyName" runat="server"></asp:TextBox>
  83.         <asp:RegularExpressionValidator
  84.                                     ID="regexTextBox1" ControlToValidate="txtCompanyName" runat="server" ValidationExpression="[\S\s]{4,50}"
  85.                                     Text=" 4 characters min"></asp:RegularExpressionValidator></td>
  86.           <td class="style1"> Status: </td>
  87.           <td><asp:Label ID="lblStatus" runat="server" />
  88.         <asp:TextBox ID="txtStatus" runat="server"></asp:TextBox>
  89.         <asp:RegularExpressionValidator
  90.                                     ID="RegularExpressionValidator5" ControlToValidate="txtStatus" runat="server"
  91.                                     ValidationExpression="^([a-zA-Z '/]+)$" Text=" invalid status"></asp:RegularExpressionValidator></td>
  92.         </tr>
  93.     <tr>
  94.           <td class="style1"> Tax ID: </td>
  95.           <td><asp:Label ID="lblTaxID" runat="server" />
  96.         <asp:TextBox ID="txtTaxID" runat="server"></asp:TextBox></td>
  97.           <td class="style1"> Removal Date: </td>
  98.           <td><asp:Label ID="lblRemoval" runat="server" />
  99.         <asp:TextBox ID="txtRemoval" runat="server"></asp:TextBox>
  100.         <asp:RegularExpressionValidator
  101.                                     ID="RegularExpressionValidator3" ControlToValidate="txtRemoval" runat="server"
  102.                                     ValidationExpression="^(((((((0?[13578])|(1[02]))[\.\-/]?((0?[1-9])|([12]\d)|(3[01])))|(((0?[469])|(11))[\.\-/]?((0?[1-9])|([12]\d)|(30)))|((0?2)[\.\-/]?((0?[1-9])|(1\d)|(2[0-8]))))[\.\-/]?(((19)|(20))?([\d][\d]))))|((0?2)[\.\-/]?(29)[\.\-/]?(((19)|(20))?(([02468][048])|([13579][26])))))$"
  103.                                     Text=" mm/dd/yy" /></td>
  104.         </tr>
  105.   </table>
  106.     </div>