JavaScript Cookie Length
<p>I am just learning JS cookies. I am able to save the cookie when a person hits a button, but seems the length of period is not correct. I need it to be 15 days, but it keeps saying the length of time is until the end of the session (http://screencast.com/t/ea7TOoGTnbA).</p>

<p>Here is the code I am using below:</p>

<pre><code>&lt;script type="text/javascript"&gt;
  function getCookie(w){
    cName = "";
    pCOOKIES = new Array();
    pCOOKIES = document.cookie.split('; ');
    for(bb = 0; bb &lt; pCOOKIES.length; bb++){
        NmeVal  = new Array();
        NmeVal  = pCOOKIES[bb].split('=');
        if(NmeVal[0] == w){
            cName = unescape(NmeVal[1]);
        }
    }
    return cName;
}
function printCookies(w){
    cStr = "";
    pCOOKIES = new Array();
    pCOOKIES = document.cookie.split('; ');
    for(bb = 0; bb &lt; pCOOKIES.length; bb++){
        NmeVal  = new Array();
        NmeVal  = pCOOKIES[bb].split('=');
        if(NmeVal[0]){
            cStr += NmeVal[0] + '=' + unescape(NmeVal[1]) + '; ';
        }
    }
    return cStr;
}
function setCookie(name, value, expires, path, domain, secure){
    document.cookie = name + "=" + escape(value) + "; ";

    if(expires){
        expires = setExpiration(expires);
        document.cookie += "expires=" + expires + "; ";
    }
    if(path){
        document.cookie += "path=" + path + "; ";
    }
    if(domain){
        document.cookie += "domain=" + domain + "; ";
    }
    if(secure){
        document.cookie += "secure; ";
    }
}

function setExpiration(cookieLife){
    var today = new Date();
    var expr = new Date(today.getTime() + cookieLife  * 60 * 60 * 10);
    return  expr.toGMTString();
}

&lt;/script&gt;

&lt;script language="JavaScript"&gt;
// set a cookie which will expire in 3 days and be accessible site wide
setCookie('drunkdriving_cta_overlay', 'Yes', 3, '/');
&lt;/script&gt;


&lt;script language="JavaScript"&gt;&lt;!--
document.write(getCookie("drunkdriving_cta_overlay"));
//--&gt;
&lt;/script&gt; 

&lt;?php if (isset($_COOKIE["drunkdriving_cta_overlay"])) {?&gt;
hello?
&lt;?php } else { ?&gt;
goodby
&lt;?php } ?&gt;
</code></pre>

<p>Any help would be greatly appreciated.</p>
