Please do NOT double post; rules are rules.
Your answer:
just add
; expires=Thu, 01-Jan-05 00:00:01 GMT
to the end of the line reading
document.cookie=window.location.pathname+"="+selectedItem
making this:
document.cookie=window.location.pathname+"="+selectedItem; expires=Thu, 01-Jan-05 00:00:01 GMT
info found at http://www.netspade.com/articles/javascript/cookies.xml, which also details other cookie features.
cr3ative