If you don't specify a time, it automatically defaults to a session cookie and will therefore get deleted if the browser is closed.
If you set the third value of the setcookie function (the one after the value) to a timestamp it will remain set until that date.
You could use
$expire = time()+606024*30;
setcookie("agendaPass", $value, $expire, '/', false, 0);
This would set the cookie for 30 days before it gets deleted.
To delete the cookie when someone logs out you just reset the cookie but with a time in the past
e.g.
$expire = time()-60*60;
setcookie("agendaPass", $value, $expire, '/', false, 0);
The last two attributes which are set above as false and 0 can be left out.
The false is actually the field for 'domain' where you can specify which sub-domains if any the cookie should be stored from. For all you can use e.g. .phpbuilder.com
Setting it to www.phpbuilder.com would prevent being used in a subdomain such as forums.phpbuilder.com
The last attribute is whether it requires a secure connection ([url]https://)[/url] so that can be left out unless needed. It defaults to 0