Cookie it's not working (hide div with script)
<p>Based on a script I saw I did a modification to fill out my needs, however it was suposed to close the alert box and not display it again as set on code below, however as soon as I refresh page the box shows up again.
Unfortunately my knowledge of jquery is almost none, actually I can't believe how I was able at least create the box lolol</p>

<pre><code>&lt;div id="alert"&gt;
&lt;style type="text/css"&gt;
&lt;!--
.hide {
display:none;
}
.show {
display:block;
}
--&gt;
&lt;/style&gt;
&lt;script type="text/javascript"&gt;
&lt;!--
var state;
window.onload=function() {
obj=document.getElementById('alert');
state=(state==null)?'show':state;
obj.className=state;

document.getElementById('close').onclick=function() {
obj.className=(obj.className=='show')?'hide':'show';
state=obj.className;
setCookie();
return false;
}
}

function setCookie() {
exp=new Date();
plusMonth=exp.getTime()+(31*24*60*60*1000);
exp.setTime(plusMonth);
document.cookie='State='+state+';expires='+exp.toGMTString();
}

function readCookie() {
    if(document.cookie) {
        var tmp = document.cookie.split(';')[0];
        state = tmp.split('=')[1];
        alert(state);
    }
}
//--&gt;
&lt;/script&gt;

&lt;?php if ( !isset($_COOKIE[ 'gb_location_preference' ] ) ) { ?&gt; 
    &lt;div id="lightbox" class="title"&gt;
        &lt;a href="onClick="closebar(); return false"&gt;&lt;img id="close" border="0" src="http://downloads.mailchimp.com/img/closebox.png"/&gt;&lt;/a&gt;
        &lt;?php gb_subscription_form(true,'Confirm Location','Subscribe') ?&gt;
    &lt;/div&gt;
    &lt;div id="lightbox_sub" class="subscription"&gt;
        &lt;?php gb_e('teste')?&gt;
    &lt;/div&gt;
&lt;?php } ?&gt;
&lt;/div&gt;&lt;!-- #alert --&gt;   
</code></pre>
