<SCRIPT LANGUAGE="JavaScript">

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) 
break; 
}
return null;
}

function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (2 < argc) ? argv[2] : null;
var path = (3 < argc) ? argv[3] : null;
var domain = (4 < argc) ? argv[4] : null;
var secure = (5 < argc) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function DisplayInfo() {
var expdate = new Date();
var visit;
expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 365)); 
if(!(visit = GetCookie("visit"))) 
visit = 0;
visit++;
SetCookie("visit", visit, expdate, "/", ".webmaster-resources.com", false);
var message;
if(visit == 1) 
popup()
}


/////////////editable part///////////////////////////////////////
function popup(){
window.open('http://www.sitepoint.com/popup.php','win1','width=550,height=440,resizable')
}

/////////////editable part///////////////////////////////////////
</script>

Instructions:

1.) Paste the code aboe between the <head> tags on every page that you want it the window pop-up when that page is left.

2.) Change the URL (highlighted in red) of the pop up to the location of the pop-up file on your site.

3.) Put: OnUnload="DisplayInfo() at the very end of the BODY tag on every page that you use the JavaScript on. This is what it looks like in our BODY tag: <body bgcolor="#FFFFFF" OnUnload="DisplayInfo()">

3.) Fiddle around with the width and height settings (highlighted in green) to make sure that the window that opens isn't too big or too small. Temporarily disable cookies while testing the script in order to see the pop-up every time.

4.) Change .sitepoint.com (highlighted in blue) to your domain. If you are hosted by a free web space provider like geocities.com, use your directory there. For example you would replace .sitepoint with .yourisp.com/mysite/ -- notice the period in front of the domain.

5.) Upload the file. You're done.