Hello guys!
I have a jquery fancybox that pop's up on exit (using onbeforeunload), now i want it to show only once so i tried doing it with cookies but i just can get it to work. this is my script so far hope you can help me with this, Thanks!
Code:
<script type="text/javascript">
	function PopIt() 
	{
		if (document.cookie.length == 0)
		{
			var exdate=new Date();
			exdate.setDate(exdate.getDate()+7);
			document.cookie="cook=yes" + ";expires="+exdate.toUTCString();

			$("a#trigger").trigger('click');
			window.onbeforeunload = UnPopIt;
			return "Before you leave:\nPlease take a few seconds to answer 2 questions\nso we can better assist you and others in the future. \nThanks!"; 				
		}
	}
	
	function UnPopIt()  { /* nothing to return */ } 
 
	$(document).ready(function() {
		window.onbeforeunload = PopIt;
 
		$("a#trigger").fancybox({
			'hideOnContentClick': false,
			'showCloseButton': true
		});
 
		$("a[id!=trigger]").click(function(){ window.onbeforeunload = UnPopIt; });
	});	
</script>