Create Cookie with Javascript and set expire time
<p>I am trying to create a cookie with javascript. This cookie will change dependent on what the user selects in a dropdown. I also want this cookie to expire after 5 min. I can create the cookie fine, but when I try to add the expires part. It adds the expires time to my cookie value. </p>

<pre><code>var exp = new Date();
    var minutes = 5;
    exp.setTime(exp.getTime() + (minutes * 60 * 1000));

     document.cookie ='orgunit' + "=" + document.getElementById('orgUnit').value + ";expires="+exp+';';
</code></pre>

<p>I'm sure this is a syntax error or something like that. Can someone lead me in the right direction?</p>