Try this:

window.onload = function(){

if( document.cookie && !/(^|\s|;)shownDiv=true(;|$)/.test( document.cookie ))
{
document.cookie = 'shownDiv=true';
Shadowbox.open({
...