/*
 * LeaveNotice - plug in to notify users of leaving your site
 * Examples and documentation at: http://rewdy.com/tools/leavenotice-jquery-plugin
 * Version: 1.0.0 (09/15/2009)
 * Copyright (c) 2009 Andrew Meyer
 * Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License
 * Requires: jQuery v1.2+
*/

/*
 * This is the code to have the prelink as clickable
 (function($){$.fn.leaveNotice=function(opt){var defaults={siteName:window.location.href,exitMessage:"<p><strong>You have requested a website outside of {SITENAME}.</strong></p><p>Thank you for visiting.</p>",preLinkMessage:"<div class='setoff'><p>You will now be directed to:<br/>{URL}</p></div>",timeOut:4000,overlayId:"ln-blackout",messageBoxId:"ln-messageBox",messageHolderId:"ln-messageHolder",overlayAlpha:0.3};var options=$.extend(defaults,opt);return this.each(function(){el=$(this);var href=el.attr('href');el.click(function(){$('body').append('<div id="'+options.overlayId+'"></div>');$('body').append('<div id="'+options.messageHolderId+'"><div id="'+options.messageBoxId+'"></div></div>');if(options.overlayAlpha!==false){$('#'+options.overlayId).css('opacity',options.overlayAlpha);}preFilteredContent=options.exitMessage+options.preLinkMessage;msgContent=preFilteredContent.replace(/\{URL\}/g,'<a href="'+href+'" target="_blank" class="external">'+href+'</a>');msgContent=msgContent.replace(/\{SITENAME\}/g,options.siteName);msgContent+='<p id="ln-cancelMessage"><a href="#close" id="ln-cancelLink">Cancel</a> or press the ESC key.</p>';$('#'+options.messageBoxId).append(msgContent);leaveIn=setTimeout(function(){$('#ln-cancelMessage').html('<em>Loading...</em>');window.open(href);window.location.reload();},options.timeOut);$('#ln-cancelLink').click(function(){clearTimeout(leaveIn);$('#'+options.overlayId+', #'+options.messageHolderId).fadeOut('fast',function(){$('#'+options.overlayId+', #'+options.messageHolderId).remove();});$(document).unbind('keyup');return false;});$(document).bind('keyup',function(e){if(e.which==27){clearTimeout(leaveIn);$('#'+options.overlayId+', #'+options.messageHolderId).fadeOut('fast',function(){$('#'+options.overlayId+', #'+options.messageHolderId).remove();$(document).unbind('keyup');});}});return false;});});};})(jQuery);
*/

(function($){$.fn.leaveNotice=function(opt){var defaults={siteName:window.location.href,exitMessage:"<p><strong>You have requested a website outside of {SITENAME}.</strong></p><p>Thank you for visiting.</p>",preLinkMessage:"<div class='setoff'><p>You will now be directed to:<br/>{URL}</p></div>",timeOut:5000,overlayId:"ln-blackout",messageBoxId:"ln-messageBox",messageHolderId:"ln-messageHolder",overlayAlpha:0.3};var options=$.extend(defaults,opt);return this.each(function(){el=$(this);var href=el.attr('href');el.click(function(){$('body').append('<div id="'+options.overlayId+'"></div>');$('body').append('<div id="'+options.messageHolderId+'"><div id="'+options.messageBoxId+'"></div></div>');if(options.overlayAlpha!==false){$('#'+options.overlayId).css('opacity',options.overlayAlpha);}preFilteredContent=options.exitMessage+options.preLinkMessage;msgContent=preFilteredContent.replace(/\{URL\}/g,href);msgContent=msgContent.replace(/\{SITENAME\}/g,options.siteName);msgContent+='<p id="ln-cancelMessage"><a href="'+href+'" target="_blank" id="ln-continueLink" class="external">Continue</a> <a href="#close" id="ln-cancelLink">Cancel</a> </p>';$('#'+options.messageBoxId).append(msgContent);leaveIn=setTimeout(function(){$('#ln-cancelMessage').html('<em>Loading...</em>');window.open(href);window.location.reload();},options.timeOut);$('#ln-continueLink').click(function(){clearTimeout(leaveIn);window.location.reload()});$('#ln-cancelLink').click(function(){clearTimeout(leaveIn);$('#'+options.overlayId+', #'+options.messageHolderId).fadeOut('fast',function(){$('#'+options.overlayId+', #'+options.messageHolderId).remove();});$(document).unbind('keyup');return false;});$(document).bind('keyup',function(e){if(e.which==27){clearTimeout(leaveIn);$('#'+options.overlayId+', #'+options.messageHolderId).fadeOut('fast',function(){$('#'+options.overlayId+', #'+options.messageHolderId).remove();$(document).unbind('keyup');});}});return false;});});};})(jQuery);
