title: css javascript cookie to remember div toggle state
body: <p>I am fairly new to javascript and seem to be having trouble with cookies. I have found a lot of posts with similar questions but as I start reading the answers I get more and more confused. I have even tried to follow along with youtube tuorials but can't seem to find someone who explains it properly. I have been stuck on this for the last 3 hours and I cannot give up now. </p>
  
  <p>I have a div which can be toggled to be either visible or not. I am using a javascript function for this.</p>
  
  <pre><code>function exp_col(x, y){
   x = document.getElementById(x);
   y = document.getElementById(y);
  
  if (x.style.display == "block") {
      x.style.display = "none";
      y.src = "images/layout/plus.png";
  } else {
      x.style.display = "block";
      y.src = "images/layout/minus.png";
  }}
  </code></pre>
  
  <p>When a user toggles a div, I want to be able to remember that and keep the state of the div the same even if they go on to a different page. I've been told I need cookies for this but I can't seem to make one that works. I'm not sure if I even understand them properly. I know they store information in pairs like name-value but I don't understand how to use this to do what I want. Where do I set the cookie? How do I set it? How do I use it to do what I want? I'm just really confused at the moment and would appreciate some help.</p>
  
  <p>Live example of toggle @ <a href="http://hello-world.cu.cc" rel="nofollow">http://hello-world.cu.cc</a> </p>
  
  <p>Thanks</p>