/*
 *	xtrnlLinks.js  :  REQUIRES jQuery 1.3.2 or later
 *
 *	Trap external links and prompt user with 
 *	legal notification to accept or deny visiting the link.
 *
 *	andrew.wright@iomer.com
 *	iomer.com
 *
 *
 */
 
 var xtrnlLinks = {
	 regex : /^(https?|ftp|gopher|telnet|file|notes|ms-help):/i,
	 exitMsg : "YOU ARE NOW LEAVING CASH STORE FINANCIAL'S WEBSITE\n\nCash Store Financial Inc. cannot and does not warrant the accuracy, completeness, timeliness, non-infringement, merchantability or fitness for a particular purpose of any information available through these links and disclaims any opinions expressed on such sites.\n\nClick OK to proceed.",
	 
	 confirmExit : function(e){
		var ok = confirm( xtrnlLinks.exitMsg );
		if( !ok ) { // if not confirmed exit, stop.
			e.preventDefault();
			e.stopPropagation();	
		}
	}
};

/* initialize and execute */
$(function(){
	$('a').each( function(){
		var _$this = $(this);
		if( xtrnlLinks.regex.test( _$this.attr('href') ) ){
			// attach onclick event to confirm they want to leave.
			_$this.click( xtrnlLinks.confirmExit );
		}
	});
});