Javascript popup on page load

I have a popup window on my index page that is loading on page load. Is there a way to integrate a cookie so that it only appearswhen a certain cookie doesnt exist? This is the Javascript I am using for the popup window:


$(function(){
	var overlay = $('<div id="overlay"></div>');
	overlay.show();
	overlay.appendTo(document.body);
	$('.popup').show();
	$('.close').click(function(){
	$('.popup').hide();
	overlay.appendTo(document.body).remove();
	return false;
});

$('.x').click(function(){
	$('.popup').hide();
		overlay.appendTo(document.body).remove();
		return false;
	});
});

$(document).ready(function(){
		$('.wrapper').hide().fadeIn(1000);
});

Thank you in advance!

Hi donboe,

Sure is!
If I was you, I’d use jQuery cookie (as you’re using jQuery anyway).
A while back I wrote a tutorial about how to use cookies with style switchers. You should be able to apply what’s described there to your current problem.

If you get stuck just give me a shout.