Cookie not found even though it exists
<p>I'm having a really strange problem and I'm looking for any possible ideas. I have a flyover that I load based on whether or not a cookie is found on the client's machine. In the flyover there is a 'No thanks' checkbox saying "<strong>Don't show again</strong>". I check to see if it has been checked like this in the flyover page:</p>

<pre><code>$(document).ready(function() {
jQuery(window).bind("beforeunload", function(){ setCookieFO('noShowMerkleCpn','true',180);       });
}); 

function setCookieFO(c_name,value,exdays){
if($('#noThanks').attr('checked') ){
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}else{
}
} 
</code></pre>

<p>I have ran the code in Firebug and verified that the cookie gets saved on document unload. I can even go into my cookies and find the cookie. Here is how I check for the cookie:</p>

<pre><code>function runFancyBox(){
var idx = document.cookie.indexOf('noShowMerkleCpn');
if(idx &lt; 0 ){
$('#cpnForm').click();
}else{
}
} 
</code></pre>

<p>I don't really care about the cookie value. I just check to see if it exists and display the flyover if it doesn't. However, for some reason this check will return -1 even when the cookie exists. </p>

<p><strong>Extra info</strong>:</p>

<p>The cookie is saved in my flyover.Html page under</p>

<pre><code>server/bank/ima
</code></pre>

<p>The script that looks for the cookie is on the same server</p>

<pre><code>server/bank/ima/script
</code></pre>

<p>The cookie is saved with this Path value with Host: <code>server</code></p>

<pre><code>/bank/ima/
</code></pre>

<p>Is there anything that jumps out that could be causing this issue? Any suggestions?</p>
