This script creates a cookie controlled pop up window with different expiration dates based on the user's selection.
This version of the script allows you add a "flag" to internal links to prevent the pop up from appearing until the user actually leaves your site. In order for this to work, you MUST use the onUnload command instead of the onLoad command in your body tag.
NOTE: This method only works when they click on links! If the visitor uses the back, forward, or refresh/reload buttons on their browser the window will also pop up.
For an internal link, you would add onclick="flag=0" to the anchor: <a onclick="flag=0" href="somefile.html">linktext</a>
For an external link (or any link where you want the pop up to trigger), you simply make a normal link: <a href="somefile.html">linktext</a>
Samples:A link with flag=0
A link without flag=0. Use this link to pop up the window so you can get that code!
View the source of this page for the javascript code and notes on usage. You also need the code from the pop up window for this to work. Note that if you are already using the other version of this script, you only need the changes from this page as the pop up window is the same.
Click here to reset the cookie, then reload the page to make the popup reappear.
You shouldn't have any trouble using this JavaScript, but if you have any questions, please post them in the this topic at JimWorld's forums.